Get the App
SLTechnology News&Howtos  ›  Database  › 

Use the percona monitoring plug-in to monitor MySQL in zabbix

Shulou Source: shulou.com Published: 2022-06-01 12:15:52 10月19日 Update

Download and install the Percona source, which you can use later with percona toolkit or innobackup

Wget-N-no-check-certificate rpm-ivh percona-release-0.1-4.noarch.rpm

two。 Install the percona monitoring plug-in using Yum

Yum-y install percona-zabbix-templates

After installation, most of the files are placed in the / var/lib/zabbix/percona directory

3. Create a new / conf.d/ directory under the zabbix_agent folder and copy the percona monitoring configuration files generated by the installation to this directory

Mkdir-p / usr/local/zabbix_agent/conf.d/cp / var/lib/zabbix/percona/templates/userparameter_percona_mysql.conf / usr/local/zabbix/conf.d/chown-R zabbix.zabbix / usr/local/zabbix_agent/

4. The specific parameters of the local machine are involved in the configuration percona monitoring script. The script uses sock to access the local database.

Vim / var/lib/zabbix/percona/scripts/ss_get_mysql_stats.php# = $mysql_user = 'mpm';$mysql_pass =' 123456

ITEM=$1HOST=localhostDIR= `dirname $0`CMD = "/ usr/bin/php-Q $DIR/ss_get_mysql_stats.php-- host $HOST--items gg" CACHEFILE= "/ tmp/$HOST-mysql_cacti_stats.txt" if ["$ITEM" = "running-slave"] Then # Check for running slave RES= `/ usr/local/mysql/bin/mysql-umpm-p123456-S / data/mysql/3306/tmp/mysql3306.sock-e 'SHOW SLAVE STATUS\ G' | egrep' (Slave_IO_Running | Slave_SQL_Running):'| awk-F:'{print $2}'| tr'\ n', `if ["$RES" = "Yes, Yes,"]; then echo 1 else echo 0 fi

5. Edit the zabbix_agent configuration file to read the conf of the percona plug-in

Vim / usr/local/zabbix_agent/conf/zabbix_agentd.conf### Option: Include# You may include individual files or all files in a directory in the configuration file.# Installing Zabbix will create include directory in / usr/local/etc, unless modified during the compile time.## Mandatory: no# Default:# Include=# Include=/usr/local/etc/zabbix_agentd.userparams.conf# Include=/usr/local/etc/zabbix_agentd.conf.d/ Include=/usr/local/zabbix_agent/conf.d/

6. Restart zabbix_agent

/ etc/init.d/zabbix_agentd restart

7. Test whether the pecona monitoring script is running properly

/ var/lib/zabbix/percona/scripts/get_mysql_stats_wrapper.sh gg

If the configuration is correct, a number will appear

8. Upload the xml template file in the / var/lib/percona/templates directory to zabbix_web

You can see the surveillance graphics.

Tags: Monitoring files directories configurations scripts plug-ins parameters graphics most numbers data databases folders templates and will native test generate run Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Information Linux OPPO Reno NVidia