Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report