From ed4ecf22253f559ae720fbd52dc79abb9e0694a6 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 29 Oct 2009 19:09:41 +0100 Subject: [PATCH] dsa-check-mirrorsync: Handle case where we cannot parse a tracefile better (do not reference undefined values, properly exit with UNKNOWN). --- dsa-nagios-checks/checks/dsa-check-mirrorsync | 9 ++++++++- dsa-nagios-checks/debian/changelog | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dsa-nagios-checks/checks/dsa-check-mirrorsync b/dsa-nagios-checks/checks/dsa-check-mirrorsync index 4637cab..fc913b0 100755 --- a/dsa-nagios-checks/checks/dsa-check-mirrorsync +++ b/dsa-nagios-checks/checks/dsa-check-mirrorsync @@ -99,6 +99,11 @@ foreach my $slave (@slaves) { my $content = $response->content; # or whatever my ($date, $foo, $bar) = split("\n", $content); my $synctime = str2time($date);; + if (! defined $synctime) { + $synctime = 0; + $exitcode = $UNKNOWN; + push @exitstatus, "Cannot parse tracefile on $slave"; + }; print "$slave last synced $synctime\n" if $params->{'verbose'}; $status->{$slave}->{'synced'} = $synctime; } @@ -124,9 +129,11 @@ if ($o_sync > 1) { } if ($exitcode == $CRITICAL) { - print "CRITICAL: " . join(',',@exitstatus) . "\n"; + print "CRITICAL: " . join(',',@exitstatus) . "\n"; } elsif ($exitcode == $OK) { print "OK: all mirrors up2date\n"; +} else { + print join(',',@exitstatus) . "\n"; } foreach my $mirror (keys(%{$status})) { diff --git a/dsa-nagios-checks/debian/changelog b/dsa-nagios-checks/debian/changelog index e74e040..6c8754c 100644 --- a/dsa-nagios-checks/debian/changelog +++ b/dsa-nagios-checks/debian/changelog @@ -1,3 +1,10 @@ +dsa-nagios-checks (8X) Xtable; urgency=low + + * dsa-check-mirrorsync: Handle case where we cannot parse a tracefile + better (do not reference undefined values, properly exit with UNKNOWN). + + -- Peter Palfrader Thu, 29 Oct 2009 19:09:36 +0100 + dsa-nagios-checks (83) stable; urgency=low * Add dsa-check-cert-expire: Checks if a given cert on disk will expire -- 2.20.1