差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

下次修改
前次修改
tech:zabbix:pgbouncer [2015/10/05 19:13] – 建立 jonathantech:zabbix:pgbouncer [2015/10/05 20:14] (目前版本) jonathan
行 1: 行 1:
 +====== pgbouncer 納入 Zabbix 監控 ======
 +
 +===== @pgbouncer Server 設定程序 =====
 +  * 新增 connection.pl <code sh>
 +vi /usr/local/bin/connection.pl
 +</code><file>
 +#!/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);
 +</file><code sh>
 +chmod a+x /usr/local/bin/connection.pl
 +</code>
 +  * 新增 UserParameters_pgbouncer_connection <code sh>
 +vi /etc/zabbix/zabbix_agentd.d/UserParameters_pgbouncer_connection
 +</code><file>
 +UserParameter=PgBouncer.Connection[*],/usr/local/bin/connection.pl $1
 +</file><code sh>
 +service zabbix-agent restart
 +</code>
 +
 +==== @Zabbix Server 設定程序 =====
 +  * 將 zbx_pgbouncer_templates.xml 匯入至 Zabbix Server → Configuration → Templates → Import
 +<file>
 +
 +</file>
 +
 +===== 參考網址 =====
 +  * https://github.com/lesovsky/zabbix-extensions/tree/master/files/pgbouncer
 +
 +
 +{{tag>pgbouncer zabbix}}