Agentd端配置Zabbix监控

1、mysql 数据库上创建一个普通用户zabbix

mysql>grant all PRIVILEGES on *.* to [email protected]'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.04 sec)

2、添加编辑mysql 登录

vim /etc/zabbix/zabbix_agentd.d/.my.cnf
[mysql]
host=localhost
user=zabbix
password=zabbix
[mysqladmin]
host=localhost
user=zabbix
password=zabbix

3、添加redis键值,把默认键值注释掉

sudo vi /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf
### MySQL DB Infomation
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';"|mysql --defaults-file=/etc/zabbix/zabbix_agentd.d/.my.cnf -N|awk '{print $$2}'
UserParameter=mysql.variables[*],echo "show global variables where Variable_name='$1';"|mysql --defaults-file=/etc/zabbix/zabbix_agentd.d/.my.cnf -N|awk '{print $$2}'
UserParameter=mysql.ping,mysqladmin --defaults-file=/etc/zabbix/zabbix_agentd.d/.my.cnf ping|grep -c  alive
UserParameter=mysql.version,echo "select version();"|mysql --defaults-file=/etc/zabbix/zabbix_agentd.d/.my.cnf -N

4、重启zabbix_agentd客户端服务

Server端验证

zabbix_get -s xxx.xxx.xxx.xxx -k mysql.status[Com_insert]

Web端配置,将Template App MySQL模版关联到mysql主机