From: Joey Schulze Date: Wed, 1 Oct 2014 22:23:38 +0000 (+0200) Subject: Handle case with no current work X-Git-Url: https://git.infodrom.org/?p=infodrom%2Ficinga-plugins;a=commitdiff_plain;h=0795cbd6f9c5230ed51c1291f76c0ab5582a2dd1;hp=4bf2c4e69b421be2b76fb04df11e3dc7f408d05f Handle case with no current work --- diff --git a/check_infocon b/check_infocon index 83f0d54..a265033 100755 --- a/check_infocon +++ b/check_infocon @@ -76,15 +76,19 @@ my $sth = $dbh->prepare($sql); $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'}; } -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 "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'};