summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorGreg Sabino Mullane2011-02-17 00:53:21 +0000
committerGreg Sabino Mullane2011-02-17 00:53:21 +0000
commitef446d0dff287891167e8d2592c95cba5bafa322 (patch)
tree19713141fda7a0d324584c8b3d8d7dd954a4fa03 /check_postgres.pl
parent2003e63da36a737c53a3a0a6f269c7fabbc0486e (diff)
More fixes to the MRTG action inside various actions.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl26
1 files changed, 13 insertions, 13 deletions
diff --git a/check_postgres.pl b/check_postgres.pl
index f232025d8..8851e755c 100755
--- a/check_postgres.pl
+++ b/check_postgres.pl
@@ -2862,9 +2862,7 @@ ORDER BY datname
}
if ($MRTG) {
- $stats{$db->{dbname}} = $total;
- $statsmsg{$db->{dbname}} = msg('backends-mrtg', $db->{dbname}, $limit);
- return;
+ do_mrtg({one => $total, msg => msg('backends-mrtg', $db->{dbname}, $limit)});
}
if (!$total) {
@@ -3442,8 +3440,7 @@ JOIN pg_user u ON (u.usesysid=d.datdba)$USERWHERECLAUSE
}
if ($MRTG) {
- $stats{$db->{dbname}} = $max;
- next;
+ do_mrtg({one => $max, msg => "DB: $db->{dbname}"});
}
if ($max < 0) {
$stats{$db->{dbname}} = 0;
@@ -4108,19 +4105,20 @@ FROM (SELECT nspname, relname, $criteria AS v
}
if ($time > $maxtime) {
$maxtime = $time;
- $maxrel = "$schema.$name";
+ $maxrel = "DB: $dbname TABLE: $schema.$name";
$maxptime = $ptime;
}
if ($time > 0 and ($time < $mintime or !$mintime)) {
$mintime = $time;
- $minrel = "$schema.$name";
+ $minrel = "DB: $dbname TABLE: $schema.$name";
}
if ($opt{perflimit}) {
last if ++$count >= $opt{perflimit};
}
}
if ($MRTG) {
- do_mrtg({one => $mintime});
+ $maxrel eq '?' and $maxrel = "DB: $db->{dbname} TABLE: ?";
+ do_mrtg({one => $mintime, msg => $maxrel});
return;
}
if ($maxtime == -2) {
@@ -4976,9 +4974,12 @@ FROM pg_class c, pg_namespace n WHERE (relkind = %s) AND n.oid = c.relnamespace
next;
}
if ($MRTG) {
- $stats{$db->{dbname}} = $max;
- $statsmsg{$db->{dbname}} = sprintf "DB: $db->{dbname} %s %s$nmax",
- $kmax eq 'i' ? 'INDEX:' : 'TABLE:', $kmax eq 'i' ? '' : "$smax.";
+ my $msg = sprintf 'DB: %s %s %s%s',
+ $db->{dbname},
+ $kmax eq 'i' ? 'INDEX:' : 'TABLE:',
+ $kmax eq 'i' ? '' : "$smax.",
+ $nmax;
+ do_mrtg({one => $max, msg => $msg});
next;
}
@@ -6962,8 +6963,7 @@ sub check_timesync {
my $diff = abs($pgepoch - $localepoch);
if ($MRTG) {
- $stats{$db->{dbname}} = $diff;
- next;
+ do_mrtg({one => $diff, msg => "DB: $db->{dbname}"});
}
$db->{perf} = sprintf '%s=%ss;%s;%s',
perfname(msg('timesync-diff')), $diff, $warning, $critical;