Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1730589
  • 博文数量: 150
  • 博客积分: 660
  • 博客等级: 上士
  • 技术积分: 2480
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-08 11:39
文章分类

全部博文(150)

文章存档

2019年(4)

2018年(36)

2017年(53)

2016年(7)

2015年(3)

2014年(3)

2013年(27)

2012年(2)

2011年(1)

2006年(1)

2005年(13)

分类: 系统运维

2013-08-12 12:39:33

二、postgres的监控设置




1、目的


postgres的版本号;
是否存活;
连接数;
每秒处理数 (tps) .
 
2、简略实施步骤


zabbix的自定义脚本采集数据;
自定义模板文件
自定义screen显示


3、zabbix_agentd.conf 配置增加


#20130104 for postgres
#Get the PostgreSQL version
UserParameter=psql.version,psql -U postgres --version|head -n1
#Get the total number of Server Processes that are active
UserParameter=psql.server_processes,psql -U postgres -t -c "select sum(numbackends) from pg_stat_database"
#Get the total number of commited transactions
UserParameter=psql.tx_commited,psql -U postgres  -t -c "select sum(xact_commit) from pg_stat_database"
#Get the total number of rolled back transactions
#UserParameter=psql.tx_rolledback,psql -U postgres -t -c "select sum(xact_rollback) from pg_stat_database"
#Get postgres  alive status,1=alived,others dead
UserParameter=psql.alive,psql -U postgres  -p 5432 -Atqc "select '1'"


4、zabbix_server 设置


增加postgres组;
增加db01和db02为组成员,并增加postgres模板文件;
增加北京机房postgres状态的screen。
 
5、postgres模板文件内容




 


    2.0
    2013-01-05T03:02:48Z
   
       
            Templates
       

   

   
       
   

   
       
            {navidog_postgres:psql.server_processes.last(0)}>1000
            {HOSTNAME} active connections reached 1K
           
            0
            4
           
            0
           
       

       
            {navidog_postgres:psql.alive.last(0)}#1
            {HOSTNAME} is down
           
            0
            4
           
            0
           
       

   

   
       
            postgres status
            900
            200
            0.0000
            100.0000
            1
            1
            0
            1
            0
            0.0000
            0.0000
            0
            0
            0
            0
           
               
                    0
                    0
                    C80000
                    0
                    2
                    0
                   
                        navidog_postgres
                        psql.server_processes
                   

               

               
                    1
                    0
                    00C800
                    0
                    2
                    0
                   
                        navidog_postgres
                        psql.alive
                   

               

               
                    2
                    0
                    0000C8
                    0
                    2
                    0
                   
                        navidog_postgres
                        psql.tx_commited
                   

               

           

       

   



阅读(3818) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~