projects
/
infodrom
/
icinga-plugins
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4bf2c4e
)
Handle case with no current work
master
author
Joey Schulze
<joey@infodrom.org>
Wed, 1 Oct 2014 22:23:38 +0000
(
00:23
+0200)
committer
Joey Schulze
<joey@infodrom.org>
Wed, 1 Oct 2014 22:23:38 +0000
(
00:23
+0200)
check_infocon
patch
|
blob
|
history
diff --git
a/check_infocon
b/check_infocon
index
83f0d54
..
a265033
100755
(executable)
--- a/
check_infocon
+++ b/
check_infocon
@@
-76,15
+76,19
@@
my $sth = $dbh->prepare($sql);
$sth->execute;
my $row = $sth->fetchrow_hashref;
$sth->execute;
my $row = $sth->fetchrow_hashref;
-if ($row->{open} > $config->{crit}) {
+if ($row->{open}
&& $row->{open}
> $config->{crit}) {
printf "CRITICAL: %s - EUR %.2f (%.2fh)\n", $config->{customer}, $row->{open}, $row->{hours};
exit $ERRORS{'CRITICAL'};
}
printf "CRITICAL: %s - EUR %.2f (%.2fh)\n", $config->{customer}, $row->{open}, $row->{hours};
exit $ERRORS{'CRITICAL'};
}
-if ($row->{open} > $config->{warn}) {
+if ($row->{open}
&& $row->{open}
> $config->{warn}) {
printf "WARNING: %s - EUR %.2f (%.2fh)\n", $config->{customer}, $row->{open}, $row->{hours};
exit $ERRORS{'WARNING'};
}
printf "WARNING: %s - EUR %.2f (%.2fh)\n", $config->{customer}, $row->{open}, $row->{hours};
exit $ERRORS{'WARNING'};
}
-printf "OK: %s - EUR %.2f (%.2fh)\n", $config->{customer}, $row->{open}, $row->{hours};
+if (defined $row->{open} && defined $row->{hours}) {
+ printf "OK: %s - EUR %.2f (%.2fh)\n", $config->{customer}, $row->{open}, $row->{hours};
+} else {
+ printf "OK: %s - Nyms\n", $config->{customer};
+}
exit $ERRORS{'OK'};
exit $ERRORS{'OK'};