MariaDB作为MySQL的重要分支,在企业级应用中广泛使用。通过Zabbix监控MariaDB可以实时掌握:
系统要求:
CREATE USER 'zabbix_monitor'@'localhost' IDENTIFIED BY 'StrongPassword';
GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'zabbix_monitor'@'localhost';
FLUSH PRIVILEGES;
编辑zabbix_agentd.conf添加:
UserParameter=mysql.status[*],mysqladmin -uzabbix_monitor -pStrongPassword extended-status | grep "$1" | awk '{print $$4}'
UserParameter=mysql.ping,mysqladmin -uzabbix_monitor -pStrongPassword ping | grep -c alive
从Zabbix官网下载并导入:
| 监控项 | 说明 | 报警阈值建议 |
|---|---|---|
| Threads_connected | 当前连接数 | 超过max_connections的80% |
| Slow_queries | 慢查询数量 | 每小时>50 |
| Innodb_buffer_pool_hit | 缓冲池命中率 | <95% |
问题1:Zabbix获取不到数据
解决方案: