Commit 20274928 authored by Mike Hibler's avatar Mike Hibler

Complain if there have been no updated to the RRD for an hour.

Also, allow percentages (-P) of greater than 100%.
parent b1e15c87
...@@ -178,11 +178,6 @@ if (defined($options{'L'})) { ...@@ -178,11 +178,6 @@ if (defined($options{'L'})) {
if (defined($options{'P'})) { if (defined($options{'P'})) {
if ($options{'P'} =~ /^(\d+)$/) { if ($options{'P'} =~ /^(\d+)$/) {
$loadpct = $1; $loadpct = $1;
if ($loadpct > 100) {
print STDERR "Load percentage must be less than 100.\n";
usage();
exit(1);
}
} else { } else {
print STDERR "Load percentage must be a number.\n"; print STDERR "Load percentage must be a number.\n";
usage(); usage();
...@@ -262,7 +257,7 @@ openlog("cpuwatch", "pid", $TBLOG); ...@@ -262,7 +257,7 @@ openlog("cpuwatch", "pid", $TBLOG);
logit("cpuwatch starting:"); logit("cpuwatch starting:");
logit(" check=${interval}s, loadave=" . sprintf("%.2f", $loadave) . logit(" check=${interval}s, loadave=" . sprintf("%.2f", $loadave) .
", loadpct=${loadpct}%, loadmin=" . sprintf("%.2f", $loadave) . ", loadpct=${loadpct}%, loadmin=" . sprintf("%.2f", $loadmin) .
", dothreads=$dothreads"); ", dothreads=$dothreads");
if ($sendmail) { if ($sendmail) {
logit(" mailmax=$MAIL_MAX messages"); logit(" mailmax=$MAIL_MAX messages");
...@@ -466,6 +461,14 @@ sub reportevents($) ...@@ -466,6 +461,14 @@ sub reportevents($)
foreach my $node (sort keys %pcs) { foreach my $node (sort keys %pcs) {
if (!$ref->{$node}{'valid'} || if (!$ref->{$node}{'valid'} ||
$ref->{$node}{'tstamp'} == $pcs{$node}{'lastcheck'}) { $ref->{$node}{'tstamp'} == $pcs{$node}{'lastcheck'}) {
my $now = time();
# no slothd report for an hour, whine
if ($pcs{$node}{'lastcheck'} + (60 * 60) <= $now) {
logit("$node: WARNING: no slothd report since ".
POSIX::strftime("20%y-%m-%d %H:%M:%S",
$pcs{$node}{'lastcheck'}));
}
next; next;
} }
$pcs{$node}{'lastcheck'} = $ref->{$node}{'tstamp'}; $pcs{$node}{'lastcheck'} = $ref->{$node}{'tstamp'};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment