push @servers, $server;
}
}
- else
+ elsif ($cluster->{requests} > 0)
{
my $server = {
cluster => $cluster,
push @servers, $server;
}
+ else
+ {
+ $cluster->{servers} = [];
+ }
$cluster->{name} = $name;
$cluster->{status} = "down";
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