summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorGreg Sabino Mullane2012-01-17 14:17:59 +0000
committerGreg Sabino Mullane2012-01-17 14:17:59 +0000
commit6a2813274f94662bc9654fe5cb74b4f0f9d85f01 (patch)
treef8f51766e51a9e79a693a36f9acf078585c1fcd5 /check_postgres.pl
parentc16989813a6112ce82acf5d9a1586e4e449ed4a0 (diff)
Have MRTG show a set message, for times when we end up there indirectly.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl18
1 files changed, 17 insertions, 1 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index 4a2afd22f..d6af95ccd 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -1592,7 +1592,23 @@ sub finishup {
## Final output
## These are meant to be compact and terse: sometimes messages go to pagers
- $MRTG and do_mrtg_stats();
+ if ($MRTG) {
+ ## Try hard to ferret out a message in case we short-circuited here
+ my $msg = [[]];
+ if (keys %critical) {
+ ($msg) = values %critical;
+ }
+ elsif (keys %warning) {
+ ($msg) = values %warning;
+ }
+ elsif (keys %ok) {
+ ($msg) = values %ok;
+ }
+ elsif (keys %unknown) {
+ ($msg) = values %unknown;
+ }
+ do_mrtg_stats($msg->[0][0]);
+ }
$action =~ s/^\s*(\S+)\s*$/$1/;
my $service = sprintf "%s$action", $FANCYNAME ? 'postgres_' : '';