[check_postgres] check_postgres.pl
Georg Schieche-Dirik
georg.schieche-dirik at zalando.de
Wed Apr 3 07:52:03 UTC 2013
Hallo Team,
in the check_postgres.pl exist something not functioning. It is visible
if a request is executed at a replication client, because a value of ""
is returned.
I hobe my mail helps. If I overlook something or should not use my
proposed solution because of other reasons you may tell me.
The error message is:
"Use of uninitialized value $s_rec_offset in subtraction (-) at
/usr/lib/nagios/plugins/check_postgres.pl line 4089. "
The querey which is used by the script is:
SELECT pg_last_xlog_receive_location() AS receive,
pg_last_xlog_replay_location() AS replay
The answer is:
receive | replay
---------+---------------
| 3CAB/85FFFF68
(1 row)
The code is:
<snip>
## On slave
$SQL = q{SELECT pg_last_xlog_receive_location() AS receive,
pg_last_xlog_replay_location() AS replay};
$info = run_command($SQL, { dbnumber => $slave, regex => qr/\// });
for $db (@{$info->{db}}) {
my $receive = $db->{slurp}[0]{receive};
my $replay = $db->{slurp}[0]{replay};
</snip>
Because the variable "$receive" is empty the result is the error.
To get rid of the error message I added:
if ($receive eq "") {
$receive = $replay;
}
Now the section is:
<snip>
my $receive = $db->{slurp}[0]{receive};
my $replay = $db->{slurp}[0]{replay};
if ($receive eq "") {
$receive = $replay;
}
</snip>
--
Georg Schieche-Dirik
Systemadministration/24x7-Team
Zalando GmbH
11501 Berlin
Germany
Phone: +49.30.2000 88 368
Mail: georg.schieche-dirik at zalando.de
Web: http://www.zalando.de
Zalando GmbH:
Eingetragen im Handelsregister Berlin.
Handelsregisternummer: HRB-11 23 94 B.
Steuer-Nr. 37/125/21423 * USt-ID-Nr. DE 260543043
Geschäftsführer: Robert Gentz, David Schneider, Rubin Ritter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x0B082ED4.asc
Type: application/pgp-keys
Size: 1764 bytes
Desc: not available
URL: <https://mail.endcrypt.com/pipermail/check_postgres/attachments/20130403/61d16554/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 553 bytes
Desc: OpenPGP digital signature
URL: <https://mail.endcrypt.com/pipermail/check_postgres/attachments/20130403/61d16554/attachment.sig>
More information about the Check_postgres
mailing list