X-Git-Url: https://git.openstreetmap.org./dns.git/blobdiff_plain/e0022fedb09f3e9d36ebdc78c06aa6a73c9926c1..2d49e3f40fc1d2d582e77c661b9d764da719bb72:/bin/mkgeo diff --git a/bin/mkgeo b/bin/mkgeo index 4a183e8..9a36ae2 100755 --- a/bin/mkgeo +++ b/bin/mkgeo @@ -35,7 +35,7 @@ while (my($name,$cluster) = each %$clusters) push @servers, $server; } } - else + elsif ($cluster->{requests} > 0) { my $server = { cluster => $cluster, @@ -50,6 +50,10 @@ while (my($name,$cluster) = each %$clusters) push @servers, $server; } + else + { + $cluster->{servers} = []; + } $cluster->{name} = $name; $cluster->{status} = "down"; @@ -227,9 +231,17 @@ foreach my $name (sort keys %$clusters) my $cluster = $clusters->{$name}; my $used = int($cluster->{requests_used} + 0.5); my $limit = $cluster->{requests_limit}; - my $proportion = int($used / $limit * 100 + 0.5); + + if ($limit > 0) + { + my $proportion = int($used / $limit * 100 + 0.5); - print "${name}: used ${used} of ${limit} (${proportion}%)\n"; + print "${name}: used ${used} of ${limit} (${proportion}%)\n"; + } + else + { + print "${name}: used ${used} of ${limit}\n"; + } } # Create JSON collection object