zabbix monitoring mysql

 

userparameter_mysql.conf

/var/lib/zabbix/my.cnf

 

zabbix_get  在本地使用前需在zabbix_agentd.conf配置文件中Server项添加本机ip 127.0.0.1

zabbix_get -s 127.0.0.1 -p 10050 -k "mysql.status[Uptime]"

 

#specify db configuration file

 

 

修改MySQL配置文件

 allowroot=1

 

create user 'zbx_monitor'@'localhost' identified with mysql_native_password by 'Letnn3!n_cL0218';

grant usage,replication client,process,show databases,show view on *.* to 'zbx_monitor'@'localhost';

 

ln -s /mysql/bin/{mysql,mysqldump,mysqladmin,mysqld,mysqlshow} /usr/bin/

 

 rm -f /app/zabbix/conf/zabbix_agentd/userparameter_examples.conf

mkdir -p /var/lib/zabbix/

cat >/var/lib/zabbix/.my.cnf<<EOF
[client]
user=zbx_monitor
password='Letnn3!n_cL0218'
host=localhost
socket=/data/binlog/mysql.sock
EOF

 

service zabbix_agentd restart

 

posted @ 2021-01-28 10:41  sam_wang10  阅读(49)  评论(0编辑  收藏  举报