Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1300819
  • 博文数量: 127
  • 博客积分: 2286
  • 博客等级: 大尉
  • 技术积分: 1943
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-10 10:37
文章分类

全部博文(127)

文章存档

2018年(1)

2015年(2)

2014年(1)

2013年(30)

2012年(88)

2011年(5)

分类: 系统运维

2012-08-31 15:26:47

1 首先需要在agentd.conf中添加自定义变量
vi /etc/zabbix_agentd.conf

UserParameter=mysql.ping,mysqladmin ping | grep -c alive
UserParameter=mysql.version,mysql -V
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | mysql -N -uroot | awk '{print $$2}'

2 命令行测设测试
zabbix_agentd -c /etc/zabbix_agentd.conf -t mysql.status[uptime]
mysql.status[uptime] [t|64575]

3 在web上把该server添加mysql模板

4 重新启动agent,查看zabbix server端的log
service zabbix_agentd restart

查看zabbix server端的log
3060:20120831:145536.484 resuming Zabbix agent checks on host [slave2]: connection restored
3083:20120831:150134.918 item [slave2:mysql.status[Bytes_received]] became supported
3083:20120831:150134.918 item [slave2:mysql.status[Bytes_sent]] became supported
3083:20120831:150134.919 item [slave2:mysql.status[Com_begin]] became supported
3081:20120831:150139.924 item [slave2:mysql.status[Com_commit]] became supported
3081:20120831:150139.925 item [slave2:mysql.status[Com_delete]] became supported
3081:20120831:150139.925 item [slave2:mysql.status[Com_insert]] became supported
3081:20120831:150139.926 item [slave2:mysql.status[Com_rollback]] became supported
3081:20120831:150139.926 item [slave2:mysql.status[Com_select]] became supported
3082:20120831:150144.932 item [slave2:mysql.status[Com_update]] became supported
3082:20120831:150144.933 item [slave2:mysql.status[Questions]] became supported
3082:20120831:150144.933 item [slave2:mysql.status[Slow_queries]] became supported
3082:20120831:150144.933 item [slave2:mysql.status[Uptime]] became supported


Zabbix自带的mysql监控是通过自定义变量来实现的,当然它的功能还很简单,只有10来个变量,我们可以照葫芦画瓢添加自己感兴趣的东西,网上有些比较专业的监视mysql的插件,比如我马上要研究的FromDual的mysql performance monitor,包含复制,性能方面的数据,支持mysql cluster等功能。
阅读(17142) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~