二、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
navidog_postgres
Templates
active connections
0
0
psql.server_processes
90
90
365
0
3
0
0
1
0
0
0
psql.alive
0
0
psql.alive
90
90
365
0
3
0
0
1
0
0
0
psql.tps
0
0
psql.tx_commited
90
90
365
0
3
1
0
1
50/1-7,00:00-24:00
0
0
0
psql.version
0
0
psql.version
300
90
365
0
1
0
0
1
0
0
0
{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
阅读(3893) | 评论(0) | 转发(0) |