In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following brings you how Zabbix monitors mysql and mongodb, hoping to give you some help in practical application. MYSQL involves more things, there are not many theories, and there are many books on the Internet. today, we will use the accumulated experience in the industry to do an answer.
The company's monitoring has been replaced by zabbix. In addition to the basic monitoring of the system, we also want to monitor mysql and mongodb in order to directly check the status of mysql and mongodb when needed. Therefore, we studied how zabbix monitors mysql and mongodb; to record these notes.
The installation and basic configuration of zabbix are not detailed here; go directly to how to monitor mysql and mongodb; (most of the online articles I refer to in this process, this article page is only for my own note-taking, if this brings an impact on the original blogger, please forgive and leave a message, and I will delete this article immediately.)
-
There is a template with mysql in zabbix, but it is not supported by default, because it cannot get the value of key defined in the template, so we need to use plug-ins to help zabbix;zabbix plug-ins are actually scripts, that is, we need to write a script to help zabbix get the values of these key.
First of all, authorize in mysql, because zabbix actually views some information of mysql through mysql users.
Mysql > grant all on mysql.* to zabbix@localhost identified by 'zabbix123456'
Mysql > flush privileges
Secondly, add plug-ins to zabbix_agentd.conf
Vim / usr/local/zabbix_agentd/etc/zabbix_agentd.conf
UserParameter=mysql.version,mysql-V
UserParameter=mysql.ping,mysqladmin-uzabbix-pzabbix123456-S / var/lib/mysql/mysql.sock ping | grep-c alive
UserParameter=mysql.status [*], / usr/local/zabbix/script/checkmysqlperformance.sh $1
The plug-in script for zabbix monitoring mysql has been uploaded to the attachment: get mysql information script
Restart zabbix_agentd
Killall zabbix_agentd
/ usr/local/zabbix_agentd/sbin/zabbix_agentd start
Check to see if agentd starts successfully
Ps axuf | grep zabbix_agentd
Check the mysql project status of the host in zabbix, and if it becomes enabled, you can see the data in the drawing later.
At this point, zabbix's monitoring of mysql has been completed. If you need to monitor anything else, you can add your own plug-ins.
-
Zabbix Monitoring mongodb
There is no template for monitoring mongodb in zabbix by default, so you need to add your own template. I'll take a project as an example here.
Add a mongodb template (create a template in the upper right corner after clicking the template)
Configuration-- > template-- > create template-- > mongodb monitor
Add a monitoring item (create a monitoring item in the upper right corner after clicking on the project)
Configuration-- > template-- > Project-- > create Monitoring item-- > MongoDB.Status [connections,available]
The most important thing is to fill in the key value
Then add the other monitoring items you want, and here are all my monitoring items
After the monitoring items are added, you also need to add graphics, triggers, etc., which will not be detailed here.
After the template for monitoring mongodb is added, it is time to add the zabbix plug-in and let him support the monitoring of mongodb.
The template for zabbix monitoring mongodb has been uploaded to the attachment: zabbix_mongodb template
Add plug-ins to zabbix_agentd.conf
Vim / usr/local/zabbix_agentd/etc/zabbix_agentd.conf
UserParameter=MongoDB.Status [*], / usr/local/zabbix_agentd/script/mongdbmonitor.sh $1 $2
UserParameter=MongoDB.ping,ps axuf | grep mongod | grep-v "grep" | wc-l
Mongdbmonitor.sh script content
Vim / usr/local/zabbix_agentd/script/mongdbmonitor.sh
#! / bin/bash
/ bin/echo "db.serverStatus (). $1" | / usr/local/mongodb/bin/mongo admin | grep-w "$2" | awk-F': |,'{print $2}'| sed's /'
Restart zabbix_agentd
Killall zabbix_agentd
/ usr/local/zabbix_agentd/sbin/zabbix_agentd start
Check to see if agentd starts successfully
Ps axuf | grep zabbix_agentd
Then check the mongodb monitoring status of the host later, and the status of the host should be started.
At this point, the monitoring of mongodb by zabbix has been configured, so that some information of mongodb can be seen for analysis and monitoring.
After reading the above about how Zabbix monitors mysql and mongodb, if there is anything else you need to know, you can find out what you are interested in in the industry information or find our professional and technical engineers to answer, technical engineers have more than ten years of experience in the industry.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.