zabbix使用pg_monz模板日常监控postgresql

本文介绍如何使用pg_monz模板监控PostgreSQL和pgpool-II。包括下载pg_monz 2.1版本、配置文件复制步骤、定义Zabbix代理设置等关键步骤。还介绍了如何在Zabbix前端上传模板及创建监控组。

使用pg_monz模板
下载pg_monz2.1
https://github.com/pg-monz/pg_monz/archive/2.1.tar.gz
[root@localhost ~]# tar -zxvf 2.1.tar.gz
cp usr-local-etc/* /usr/local/etc
cp usr-local-bin/* /usr/local/bin

参考以下pg_monz的quick-install.txt按照说明就可以监控postgresql
* How to install pg_monz v2

  1. requirements

    • Zabbix server version 2.0+
    • monitored PostgreSQL 9.2+
    • monitored pgpool-II 3.4.0
    • installing zabbix_agentd to PostgreSQL and pgpool-II host.
    • installing zabbix_sender to PostgreSQL and pgpool-II host.
    • ServerActive setting in zabbix_agentd.conf (zabbix_sender read this file)
    • psql command(and serch path setting) on each PostgreSQL/pgpool server
  2. Uploading Zabbix template using Zabbix frontend.

    Template_App_PostgreSQL.xml
    Template_App_PostgreSQL_SR.xml
    Template_App_PostgreSQL_SR_Cluster.xml
    Template_App_pgpool-II.xml
    Template_App_pgpool-II-36.xml
    Template_App_pgpool-II_watchdog.xml

  3. Copy usr-local-etc files (pgsql_funcs.conf and pgpool_funcs.conf) to “/usr/local/etc”

    cp usr-local-etc/* /usr/local/etc

    default variables for pgsql_funcs.conf


    PGHOST=127.0.0.1
    PGPORT=5432
    PGROLE=postgres
    PGDATABASE=postgres


    default variables for pgpool_funcs.conf


    PGPOOLHOST=127.0.0.1
    PGPOOLPORT=9999
    PGPOOLROLE=postgres
    PGPOOLDATABASE=postgres
    PGPOOLCONF=/usr/local/etc/pgpool.conf


    (*) the definition of configuration directory is in the tempalte macro.
    {PGSCRIPT_CONFDIR}  
       {
    PGSCRIPT_CONFDIR}     {
    PGPOOLSCRIPTS_CONFDIR}

  4. Copy usr-local-bin files (*.sh) to “/usr/local/bin”

    cp usr-local-bin/* /usr/local/bin

    (*) the definition of scripts directory is in the template macro.
    {PGSCRIPTDIR}  
       {
    PGSCRIPTDIR}     {
    PGPOOLSCRIPTDIR}

  5. Define groups using Zabbix frontend.

    Create “PostgreSQL” group and add PostgreSQL host to “PostgreSQL” group.
    Create “pgpool” group and add pgpool-II host to “pgpool” group.

    Each groups are referenced by Template_App_PostgreSQL_SR_Cluster.xml
    and Template_App_pgpool-II_watchdog.xml using {$HOST_GROUP} template macro.

  6. Check the filepath of zabbix_agentd.conf.

    if your installation of zabbix_agentd.conf is not /etc/zabbix/zabbix_agentd.conf,
    add {$ZABBIX_AGENTD_CONF} macro to HOST’S MACRO.

    the definition of zabbix_agentd.conf path is in the template macro.

    {$ZABBIX_AGENTD_CONF} => /etc/zabbix/zabbix_agentd.conf

  7. Link template to host.

    Link “Template App PostgreSQL SR” to PostgreSQL host.
    Link “Template App pgpool-II” to pgpool-II host.

    “Template App PostgreSQL SR Cluster”/ “Template App pgpool-II-watchdog”
    are simply counting
    -the number of running service (sr/pgpool-II),
    -the number of primary server (sr),
    -the number of standby server (sr),
    -the number of delegate_ip (pgpool-II),
    in same {$HOST_GROUP} using zabbix aggregate key.
    you want to monitor the split-brain or the number of primary server,
    Link the above templates to arbitrary host.
    ex) “PostgreSQL Cluster” as a virtual host

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值