1, configure the MySQL client, create a user to get MySQL data, use the MySQL account password to log into the database,
> grant all on *.* to [email protected]‘localhost‘ identified by ‘123456789‘;
I am testing the environment with all for authorization, if you want to control the account permissions can use the following command, grant usage on the . to [email protected] ' localhost ' identified by ' 123456789 ';
Refreshing the database
2. After setting up the account, create a new/etc/zabbix/etc/.my.cnf on the monitored side to provide the Zabbix agent access to the database, similar to the following:
Vim/etc/zabbix//etc/.my.cnf
[MySQL]
Host=localhost
User=zabbix
password=123456789
Socket=/tmp/mysql.sock
[Mysqladmin]
Host=localhost
User=zabbix
password=123456789
Socket=/tmp/mysql.sock
注:agent安装路径/etc/zabbix/,etc目录若不存在,需要自已创建,创建.my.cnf,为隐藏文件。
3. Modify the MySQL path/etc/zabbix/zabbix_agentd.d in the template, complete the following three directories, Home=/etc/zabbix/etc/usr/local/mysql/bin/mysqladmin
#vim userparameter_mysql.conf
4. Restart Agent Service
#service zabbix-agent Restart
5,zabbix-web settings
6. View the monitored MySQL data graph
Zabbix self-template monitoring MySQL