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配置文件

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

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<[client]
user=zbx_monitor
password='Letnn3!n'
host=localhost
socket=/data/binlog/mysql.sock
EOF

service zabbix_agentd restart