[check_postgres] Perf data for pgb_pool_

adrien nayrat adrien.nayrat.axess at gmail.com
Fri Oct 18 13:33:37 UTC 2013


Hi,



I use your impressive and useful plugin for nagios : check_postgres.pl to
monitor pgbouncer in centreon.



I notice your plugin reports bad values for perfdata with the actions
pgb_pool_*:



./check_postgres.pl -H  *.*.*.* -p **** -db pgbouncer --dbuser=centreon
--dbpass=******  --action pgb_pool_sv_used

POSTGRES_PGB_POOL_SV_USED OK: DB "pgbouncer" (host:*.*.*.*) (port=****)
db1=0 * db2=0 * db3=20 * pgbouncer=0 * postgres=0 |  time=0.01s time=0.01s
time=0.01s time=0.01s time=0.01s



For the action: pgbouncer_backends    => It is ok



I tried to add this line :

5803 my $msg = "$i->{database}=$i->{$stat}";
5804 *$db->{perf} .= " '$i->{database}'=$i->{$stat};$warning;$critical";*
5805 if ($MRTG) {

But the script return several time the perfdata :

time=0.01s 'db1'=0; time=0.01s 'db1'=0; 'db2'=0; time=0.01s 'db1'=0;
'db2'=0;; 'db3'=0; time=0.01s 'db1'=0; 'db2'=0;; 'db3'=0;; 'pgbouncer'=0;
time=0.01s 'db1'=0; 'db2'=0;; 'db3'=0;; 'pgbouncer'=0;; 'postgres'=0;



I looked in the source code. For “pgbouncer_backends” the function is “sub
check_pgbouncer_backends” in line 5633. The script call the function
“add_ok” (line 5781)

But for check_pgb_pool (5789), the add_ok function is in a “for”, so it is
called for each database.

I’m not a guru in perl but I think we have to change the check_pgb_pool
function to call only one time the “add_ok” function and manage warning and
critical threshold.





Best regards,



Adrien NAYRAT
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.endcrypt.com/pipermail/check_postgres/attachments/20131018/f5f7086b/attachment.html>


More information about the Check_postgres mailing list