zabbix中監視mysql數據庫



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等功能。 html

相關文章
相關標籤/搜索