Redis Learning (zabbix monitoring redis)
The Common commands and redis info information in the configuration file box of redis are all explained. The next step is to monitor our redis. I am using zabbix monitoring software, here I will introduce in detail how to set zabbix to monitor reids, including zabbix plug-in configuration, plug-in script, template monitoring item creation, and image creation.
Redis Learning (notes for configuration files and Common commands ):
Http://54snow.blog.51cto.com/2690157/1537449
Redis Learning (redis info ):
Http://54snow.blog.51cto.com/2690157/1537464
========================================================== ========================================================== ============
1. Configure the zabbix plug-in
I personally think zabbix is very convenient and powerful because it can be customized as needed. We want to monitor something that zabbix itself does not have a template, you can write a plug-in by yourself (in fact, a script) to monitor what needs to be monitored. The following is the monitoring redis plug-in I configured (the above plug-in configuration is to monitor MySQL, also defined plug-in monitoring, need to view the zabbix monitoring MySQL information, please move to the http://54snow.blog.51cto.com/2690157/1425807)
Add a plug-in zabbix_agentd.conf
Vim/usr/local/zabbix_agentd/etc/zabbix_agentd.conf
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/39/wKioL1Pkfw_Tq8P4AACTEni5EY0388.jpg "Title =" 111111.jpg" alt = "wkiol1pkfw_tq8p4aacteni5ey0388.jpg"/>
Redis. Status is used to monitor whether redis can be connected. You can use grep-C to obtain the number of Pong instances, 0 or 1.
Redis. info is another item to be monitored. Check the script information later. ($1 $2 is followed here. If zabbix is only used to pass one parameter, when $2 does not exist)
Restart zabbix_agentd after adding the plug-in.
Killallzabbix_agentd
/Usr/local/zabbix_agentd/sbin/zabbix_agentdstart
PS axuf | grepzabbix_agentd
Ii. Plug-in script
The plug-in script is also a shell script, which extracts the required data and converts it to the data that zabbix can accept, and then transmits it to zabbix; in the following plug-in script, these parameter names are all information in redis info, and no changes have been made, if you do not understand the meaning of these parameters, refer to another article (redis info details :)
I will not describe this plug-in script in detail. I believe everyone can understand what it means. Here, I will use the shell variable $ # to determine the number of parameters, and then determine how to operate it.
Tip: the plug-in script is provided in the attachment below and can be downloaded by yourself.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/38/wKiom1PkehzAuTc3AAGmf6wRjJI785.jpg "Title =" 2.jpg" alt = "wkiom1pkehzautc3aagmf6wrjji785.jpg"/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/38/wKiom1PkelHD7rVRAAEOXYstkWM816.jpg "style =" float: none; "Title =" 3.jpg" alt = "wkiom1pkelhd7rvraaeoxystkwm816.jpg"/>
This plug-in script is used to count the number of keys, expired keys, and deleted keys in the redis database. It needs to count the database ($1), so two parameters need to be passed.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/39/wKioL1Pke2vxHLoAAACuPm9QWZ8931.jpg "style =" float: none; "Title =" 4.jpg" alt = "wkiol1pke2vxhloaaacupm9qwz8931.jpg"/>
3. Create a zabbix template metric item
Tip: The template is provided in the attachment below. If you do not want to download the template and import it yourself
1. Create a template first
Configuration --> template --> Create Template
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/39/wKioL1Pke7-SGNjvAACQs4KeS7I058.jpg "Title =" 523.jpg" alt = "wKioL1Pke7-SGNjvAACQs4KeS7I058.jpg"/>
2. Add an application set
Configuration --> template --> redismonitor --> Create application set
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/38/wKiom1PkezrS1mxMAADPZMe1IqM730.jpg "style =" float: none; "Title =" qased.jpg "alt =" wkiom1pkezrs1mxmaadpzme1iqm730.jpg "/>
3. Create a metric (19 metric items in total here, I will illustrate several different examples)
The most important part of adding metric items is the key value and data type. The data proposed by redis is mostly in decimal format. All such data types are configured for most metric items.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/39/wKioL1PkfFTTMJnHAAETCauAzJE974.jpg "style =" float: none; "Title =" qwer.jpg "alt =" wkiol1pkffttmjnhaaetcauazje974.jpg "/>
CPU data is basically retrieved with a decimal point, and all numbers cannot be of the positive or negative type, instead of the floating point type.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/38/wKiom1PkezvQHKSZAAEq4RvToS0954.jpg "style =" float: none; "Title =" 1111.jpg" alt = "wkiom1pkezvqhkszaaeq4rvtos0954.jpg"/>
The uptime metric, the data retrieved from redis is measured in seconds. here you need to enter the unit of uptime.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/39/wKioL1PkfFXihZLJAAEVkHNr6aU402.jpg "style =" float: none; "Title =" 222.jpg" alt = "wkiol1pkffxihzljaaevkhnr6au402.jpg"/>
The version is obtained from redis for data similar to 2.8.11, so the data type here requires the use of Characters
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/38/wKiom1PkezyzP9WgAADykQLQDFA897.jpg "style =" float: none; "Title =" 333.jpg" alt = "wkiom1pkezyzp9wgaadykqlqdfa897.jpg"/>
The above is the monitoring of different data types in redis metric items. Other metric items are basically the same. create the desired metric item according to the example.
4. Create a graph
Creating a graph is much simpler. Simply add the metric items you want to put on a graph. Here I will show my graph.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/38/wKiom1Pke93yaNxoAADG-PN-YWw083.jpg "style =" float: none; "Title =" 111.jpg" alt = "wKiom1Pke93yaNxoAADG-PN-YWw083.jpg"/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/39/wKioL1PkfPfx62M4AAEHib2nMAs219.jpg "style =" float: none; "Title =" 222.jpg" alt = "wkiol1pkfpfx62m4aaehib2nmas219.jpg"/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/38/wKiom1Pke-HjbHb5AAD1SEHew6c569.jpg "style =" float: none; "Title =" 333.jpg" alt = "wKiom1Pke-HjbHb5AAD1SEHew6c569.jpg"/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/45/39/wKioL1PkfPqS9x0pAAD_chmeUnE410.jpg "style =" float: none; "Title =" 444.jpg" alt = "wkiol1pkfpqs9x0paad_chmeune410.jpg"/>
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M02/45/38/wKiom1Pke-LhxDxjAAEE-MpjtLg276.jpg "style =" float: none; "Title =" 555.jpg" alt = "wKiom1Pke-LhxDxjAAEE-MpjtLg276.jpg"/>
Create a trigger
Configuration --> template --> trigger --> Create trigger
Here I will be redis. status creates a trigger to determine whether redis can be connected, because no matter whether redis is used as a cache server to cache some real-time data or for database use, if redis cannot be connected, it will definitely affect the existing business. I will identify the severity of the disaster, you can also define according to your own situation.
650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/45/39/wKioL1PkfPuxYa2yAACxPnukSVY504.jpg "style =" float: none; "Title =" 666.jpg" alt = "wkiol1pkfpuxya2yaacxpnuksvy504.jpg"/>
Here, the entire process of zabbix monitoring redis is almost completed, and the rest is to apply the template to the redis host, which I will not detail here. You can then export this template for future use.
This article is from the "snow" blog, please be sure to keep this source http://54snow.blog.51cto.com/2690157/1537482