From 6a2813274f94662bc9654fe5cb74b4f0f9d85f01 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Tue, 17 Jan 2012 09:17:59 -0500 Subject: Have MRTG show a set message, for times when we end up there indirectly. --- check_postgres.pl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'check_postgres.pl') 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_' : ''; -- cgit v1.2.3