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等功能。
阅读(17134) | 评论(0) | 转发(0) |