MPM Plug-in deployment
1. Installing the relevant Perl module for MPM dependencies
Related dependencies required to install MPM: [For insurance purposes, the agent side also installs the following dependency package]
# yum-y Install Perl-file-which perl-libwww-perl perl-digest-sha1 perl-dbd-mysql perl-time-hires Perl-Crypt-SSLeay
# yum-y Install Perl-file-which perl-libwww-perl perl-digest-sha1 perl-dbd-mysql perl-time-hires Perl-Crypt-SSLeay
# yum-y Install perl-cpan.x86_64
# yum-y Install which.x86_64
# yum-y Install Perl-lwp-authen-negotiate.noarch
# yum-y Install perl-digest-sha1.x86_64
# yum-y Install Perl-class-dbi-mysql.noarch
# yum-y Install perl-time-hires.x86_64
# yum-y Install perl-crypt-ssleay.x86_64
Download MPM and Unzip:
[Email protected] zabbix]# wget http://www.shinguz.ch/download/mysql_performance_monitor-latest.tar.gz
[Email protected] zabbix]# Tar XF mysql_performance_monitor-latest.tar.gz
[Email protected] zabbix]# LS-LRT
Mysql_performance_monitor_agent-0.9.1.tar.gz
Mysql_performance_monitor_templates-0.9.1.tar.gz
2.Zabbix web-side import of MPM templates
Templates required for Zabbix Web UI Import Monitoring ("Configuration", "Templates", "Import"):
The specific template file uses the following:
Template_FromDual.MySQL.ndb.xml # Monitor MySQL cluster
Template_FromDual.MySQL.security.xml
Template_FromDual.MySQL.innodb.xml # monitoring InnoDB storage engine state variables
Template_FromDual.MySQL.mpm.xml # Monitor the MPM agent itself, this must be imported
Template_FromDual.MySQL.myisam.xml # monitoring MyISAM storage engine state variables
Template_FromDual.MySQL.mysql.xml # Monitoring MySQL Common state variables
Template_FromDual.MySQL.aria.xml # Monitor the status variables of the ARIA storage Engine
Template_FromDual.MySQL.galera.xml # Monitor MySQL galera cluster
Template_FromDual.MySQL.slave.xml # Monitor the status of slave in MySQL master-slave replication
Template_FromDual.MySQL.server.xml # Monitor the Linux system for additional items related to database usage
Template_FromDual.MySQL.master.xml # Monitor the status of MySQL master for master-slave replication
Template_FromDual.MySQL.drbd.xml # Monitor status information for DRBD devices
Template_FromDual.MySQL.pbxt.xml # monitoring PBXT storage engine state variables
Template_FromDual.MySQL.process.xml # Monitor various Linux processes (e.g., MYSQLD,NDBD)
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7F/E8/wKiom1cxdL6BZvVIAAH2JApnY2o809.png "title=" 1.png " alt= "Wkiom1cxdl6bzvviaah2japny2o809.png"/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7F/E8/wKiom1cxdM7gHAHuAADp_ppAdlA588.png "title=" 2.png " alt= "Wkiom1cxdm7ghahuaadp_ppadla588.png"/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/E6/wKioL1cxdbvDdjkbAAE2heDCT_I150.png "title=" 3.png " alt= "Wkiol1cxdbvddjkbaae2hedct_i150.png"/>
3. Install MPM and configure the Zabbix Keys of the MPM Agent to implement the Zabbix hook-up MPM
Installing the MPM Agent
Install mysql_performance_monitor_agent on client [MySQL database server side]
[Email protected] ~]# Tar XF mysql_performance_monitor_agent-0.9.1.tar.gz
[Email protected] ~]# MV Mysql_performance_monitor_agent-0.9.1/usr/local/mysql_performance_monitor_agent
# Modify the fromdualmysqlagent.pl file to specify the location of the Zabbix_sender
[Email protected] ~]# cd/usr/local/mysql_performance_monitor_agent
# sed-i "[email protected]/usr/local/[email protected]/usr/local/zabbix/[email protected]" fromdualmysqlagent.pl
Add the MPM Agent's keys information to the ZABBIX_AGENTD configuration directory
This parameter configuration file is your own new
# cd/usr/local/zabbix/etc/zabbix_agent.conf.d/
# Vim Fromdual_mysql_monitoring.conf
# Cat Fromdual_mysql_monitoring.conf
userparameter=fromdual.mysql.check,/usr/local/mysql_performance_monitor_agent/fromdualmysqlagent.pl/usr/local/ Mysql_performance_monitor_agent/etc/fromdualmysqlagent.conf
4.MPM Agent Configuration
Create a MPM MySQL monitoring user
mysql> create user ' mpm ' @ ' 127.0.0.1 ' identified by "123456";
Query OK, 0 rows Affected (0.00 sec)
Mysql> Grant Process,replication Client on * * to ' mpm ' @ ' 127.0.0.1 ';
Query OK, 0 rows Affected (0.00 sec)
mysql> flush Privileges;
Query OK, 0 rows Affected (0.00 sec)
Mysql> Grant Process,replication Client on * * to ' mpm ' @ ' localhost ' identified by "123456";
Query OK, 0 rows Affected (0.00 sec)
Configure the MPM Agent:
[Email protected] ~]# cd/usr/local/mysql_performance_monitor_agent/etc/
[email protected] etc]# CP FromDualMySQLagent.conf.template fromdualmysqlagent.conf
[Email protected] etc]# mkdir-p/var/log/zabbix
[Email protected] etc]# mkdir-p/var/log/zabbix/cache
[Email protected] etc]# Touch/var/log/zabbix/fromdualmysqlagent.log
[Email protected] etc]# chown-r Zabbix:zabbix/var/log/zabbix
[Email protected] etc]# Ll/data/3306/mysql.pid
-RW-RW----1 MySQL mysql 5 May 6 16:36/data/3306/mysql.pid
[Email protected] etc]# chmod o+r/data/3306/mysql.pid
[Email protected] etc]# vim fromdualmysqlagent.conf
[Default]
Type = mysqld
Debug = 2
#执行日志文件路径, Zabbix user writable permissions are required
LogFile =/var/log/zabbix/fromdualmysqlagent.log
Cachefilebase =/var/log/zabbix/cache/fromdualagentcache
#需要在本机的Mysql中进行授权 (What permissions do you need?) Process,replication client)
Username = MPM
Password = 123456
Mysqlhost = 127.0.0.1
Mysqlport = 3306
Zabbixserver = 192.168.1.214
Disabled = False
Modules = Process MySQL MyISAM innodb
#ClusterLog =/var/lib/mysql-cluster/ndb_1_cluster.log
# mysql PID file requires Zabbix user-readable permissions
Pidfile =/data/3306/mysql.pid
# This cannot be dropped or changed to the section name to detect if the machine's MPM is available
[Db_server]
Type = mysqld
Modules = MPM Server
The hostname defined in the #下面的主机名需要跟Zabbix server is the same, the name is arbitrary
[Hostname1]
Type = mysqld
#这些模块必须在mysql数据库上已经实现了功能, such as Master and slave, if not configured master and slave, and added master template, during the execution of the error will be
Type = mysqld
Mysqlport = 3306
Modules = MPM Server process mysql MyISAM InnoDB master
Pidfile =/data/3306/mysql.pid
Debug = 1
[email protected] etc]# cat fromdualmysqlagent.conf |egrep-v "^#|^$"
[Default]
Type = mysqld
Debug = 2
LogFile =/var/log/zabbix/fromdualmysqlagent.log
Cachefilebase =/var/log/zabbix/cache/fromdualagentcache
Username = MPM
Password = 123456
Mysqlhost = 127.0.0.1
Mysqlport = 3306
Zabbixserver = 192.168.1.214
Disabled = False
Modules = Process MySQL MyISAM innodb
Clusterlog =/var/lib/mysql-cluster/ndb_1_cluster.log
Pidfile =/data/3306/mysql.pid
[Db_server]
Type = mysqld
Modules = MPM Server
[mysqld_192.168.1.212] # This must match Hostname in zabbix!
Type = mysqld
Mysqlport = 3306
Modules = Process MySQL MyISAM innodb slave
Pidfile =/data/3306/mysql.pid
Debug = 1
[Email protected] etc]#
Check the MPM plugin working condition:
[Email protected] etc]#/usr/local/mysql_performance_monitor_agent/fromdualmysqlagent.pl/usr/local/mysql_ Performance_monitor_agent/etc/fromdualmysqlagent.conf
1
[Email protected] etc]#
# return value of 1: Indicates that the MPM plug-in is normal, restart zabbix_agent, load MPM plugin
[Email protected] etc]#/etc/init.d/zabbix_agentd restart
Stopping Zabbix Agent: [OK]
Starting Zabbix Agent: [OK]
[Email protected] etc]#
Zabbix web-side operations
Create a monitoring database group
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/7F/E6/wKioL1cxddah6OxqAAEbxsp56oE320.png "title=" 4.png " alt= "Wkiol1cxddah6oxqaaebxsp56oe320.png"/>
Creating a monitoring host
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7F/E8/wKiom1cxdQTgWjLYAAGFR9sFTQ0079.png "title=" 5.png " alt= "Wkiom1cxdqtgwjlyaagfr9sftq0079.png"/>
Fill in the relevant host information
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/E6/wKioL1cxdeuCBTbAAADtEHRJAdA297.png "title=" 6.png " alt= "Wkiol1cxdeucbtbaaadtehrjada297.png"/>
Add a template
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7F/E9/wKiom1cxdRzSVdx4AAEBZwPGVLE958.png "title=" 7.png " alt= "Wkiom1cxdrzsvdx4aaebzwpgvle958.png"/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7F/E9/wKiom1cxdTOQxGfRAACFUt9j5Xg500.png "title=" 8.png " alt= "Wkiom1cxdtoqxgfraacfut9j5xg500.png"/>
Zabbix Agent Error occurred
[Email protected] ~]# tail-f/usr/local/zabbix/logs/zabbix_agentd.log
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/E6/wKioL1cxdiHRmHq-AABFu-R3DkM562.png "title=" 9.png " alt= "Wkiol1cxdihrmhq-aabfu-r3dkm562.png"/>
1. View hostname in the zabbix_agentd.conf file
[[email protected] etc]# grep hostname/usr/local/zabbix/etc/zabbix_agentd.conf
hostname=mysqld_192.168.1.212
2. In the Zabbix Web page monitoring->configuration->hosts page change the host name and the hostname in zabbix_agentd.conf.
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/E6/wKioL1cxdjKTVukHAACBeRGrYqs494.png "title=" 10.png "alt=" Wkiol1cxdjktvukhaacbergryqs494.png "/>
3. Restart the Zabbix-agent service
[Email protected] etc]#/etc/init.d/zabbix_agentd restart
Stopping Zabbix Agent: [OK]
Starting Zabbix Agent: [OK]
[Email protected] etc]#
Not resolved or this error:
17486:20160510:130427.528 no active checks on server [192.168.1.214:10051]: host [mysqld_192.168.1.212] not found
Troubleshooting Errors:
Zabbixserver is zabbix-3.0.2.tar.gz,Zabbix web is zabbix-2.4.8.tar.gz, so reinstall under Zabbix server is zabbix-2.4.8.tar.gz.
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/EC/wKiom1cxiXuzCyNdAAH-qREm4J4962.png "title=" 1.png " alt= "Wkiom1cxixuzcyndaah-qrem4j4962.png"/>
Step no problem, version of the issue.
To solve this problem:
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/E9/wKioL1cxim_Cpe2FAAEYvmrwAZs816.png "title=" 2.png " alt= "Wkiol1cxim_cpe2faaeyvmrwazs816.png"/>
# egrep-v "^#|^$"/usr/local/zabbix/etc/zabbix_agentd.conf
Pidfile=/tmp/zabbix_agentd.pid
Logfile=/tmp/zabbix_agentd.log
server=127.0.0.1
listenport=10050
serveractive=127.0.0.1
Hostname=zabbixserver
# cdzabbix-2.4.8
# cpmisc/init.d/fedora/core5/zabbix_agentd/etc/init.d/
# VIM/ETC/INIT.D/ZABBIX_AGENTD
Prog= "Zabbixagent"
Zabbix_bin= "/usr/local/zabbix/sbin/zabbix_agentd"
Conf_file= "/usr/local/zabbix/etc/zabbix_agentd.conf"
Start () {
...
Daemon $ZABBIX _bin-c $CONF _file
...
}
[Email protected]_serverzabbix-2.4.8]#/etc/init.d/zabbix_agentd Restart
Stop Zabbix Agent: [ OK ]
is starting Zabbix Agent: [ OK ]
[[Email protected]_serverzabbix-2.4.8]#
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/EC/wKiom1cxiaKgDfBNAAGSSPuj-1s627.png "title=" 3.png " alt= "Wkiom1cxiakgdfbnaagsspuj-1s627.png"/>
Fix it.
Deploy Zabbix monitor MySQL (iii) MPM plugin introduction and Deployment