pgbouncer 納入 Zabbix 監控
@pgbouncer Server 設定程序
- 新增 connection.pl
vi /usr/local/bin/connection.pl
#!/usr/bin/perl # Date : 19:44 2015/10/5 # Author : Jonathan Tsai <[email protected]> # Desc : Get connection# for Zabbix $chkport=!defined($ARGV[0])?"5432":$ARGV[0]; $mrtgline1 = `netstat -n | grep ":$chkport "| wc -l|awk '{print\$1 - 1}'`; print($mrtgline1);
chmod a+x /usr/local/bin/connection.pl
- 新增 UserParameters_pgbouncer_connection
vi /etc/zabbix/zabbix_agentd.d/UserParameters_pgbouncer_connection
UserParameter=PgBouncer.Connection[*],/usr/local/bin/connection.pl $1
service zabbix-agent restart
@Zabbix Server 設定程序
- 將 zbx_pgbouncer_templates.xml 匯入至 Zabbix Server → Configuration → Templates → Import