X-Git-Url: https://git.openstreetmap.org./dns.git/blobdiff_plain/536a47f45e76979cba7be7a81eb65dc2f899dc00..41fe9fb8e0d9433730b8a94d231a9e0652ff296f:/bin/mkgeo diff --git a/bin/mkgeo b/bin/mkgeo index eda6247..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"; @@ -84,7 +88,7 @@ if ($ENV{STATUSCAKE_APIKEY}) while ($page <= $pages) { - my $response = $ua->get("https://api.statuscake.com/v1/uptime?limit=100&page=${page}"); + my $response = $ua->get("https://api.statuscake.com/v1/uptime?nouptime=true&limit=100&page=${page}"); if ($response->is_success) { @@ -221,6 +225,25 @@ while (grep { !exists($_->{cluster}) } values %$origins) allocate_clusters(@mappings); } +# Report on allocation results +foreach my $name (sort keys %$clusters) +{ + my $cluster = $clusters->{$name}; + my $used = int($cluster->{requests_used} + 0.5); + my $limit = $cluster->{requests_limit}; + + if ($limit > 0) + { + my $proportion = int($used / $limit * 100 + 0.5); + + print "${name}: used ${used} of ${limit} (${proportion}%)\n"; + } + else + { + print "${name}: used ${used} of ${limit}\n"; + } +} + # Create JSON collection object my @json;