pgbouncer 納入 Zabbix 監控

  • 新增 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
  • 將 zbx_pgbouncer_templates.xml 匯入至 Zabbix Server → Configuration → Templates → Import

  • tech/zabbix/pgbouncer.txt
  • 上一次變更: 2015/10/05 20:14
  • jonathan