使用Zabbix + MPM全面監控MySQL
阿新 • • 發佈:2019-02-10
MPM Agent配置
建立MySQL監控使用者mpm:
mysql> create user 'mpm'@'127.0.0.1' identified by '123456'; mysql> grant process, replication client on *.* to 'mpm'@'127.0.0.1'; mysql> flush privileges;
配置MPM Agent:
cd /usr/local/mysql_performance_monitor-agent/etc cp FromDualMySQLagent.conf.template FromDualMySQLagent.conf mkdir -p /var/log/zabbix mkdir -p /var/log/zabbix/cache touch /var/log/zabbix/FromDualMySQLagent.log chown -R zabbix:zabbix /var/log/zabbix chmod o+r /var/run/mysqld/mysqld.pid #這裡要根據自己實際情況進行修改 vi FromDualMySQLagent.conf # cat FromDualMySQLagent.conf
[default] # Type of section: # mysqld for a normal MySQL database # ndbd for a MySQL cluster Type = mysqld # Debug levels are: # 1 is logging only errors # 2 is logging errors and warnings (this is the default) # 3 logs some informations messages as well # 4 logs everything (for debugging purposes only) Debug = 2 LogFile = /var/log/zabbix/FromDualMySQLagent.log # Directory where the Cache files should be written to: CacheFileBase = /var/log/zabbix/cache/FromDualAgentCache # If you agent is not located in the same time zone as your server # TimeShift = +0.0 # Information for MySQL connections: 下面的這幾項需要修改 Username = mpm Password = 123456 MysqlHost = 127.0.0.1 MysqlPort = 3306 # Zabbix Server IP address 需要修改 ZabbixServer = 192.168.1.190 # If section is disabled Disabled = false # Possible modules for databases are: # process mysql myisam aria innodb pbxt ndb master slave drbd galera memcache # Possible modules for servers are: # mpm server # Usual modules are Modules = process mysql myisam innodb # Special parameter which is used for module ndb and process ClusterLog = /var/lib/mysql-cluster/ndb_1_cluster.log # MySQL Pid file, need read permission for zabbix user PidFile = /var/run/mysqld/mysqld.pid #這裡也需要修改 [db_server] Type = mysqld Modules = mpm server # All MySQL databases here # Try to avoid section names with spaces! [192.168.1.191_MySQL_5.5.29] # This MUST match Hostname in Zabbix! 注意:該行及以下的幾行需要取消註釋 Type = mysqld MysqlPort = 3306 Modules = process mysql myisam innodb slave PidFile = /var/run/mysqld/mysqld.pid Debug = 1
注:這裡監控的MySQL Server是MySQL主從複製的中的Slave機器.