Zabbix Automatic Discovery Monitoring Redis

Source: Internet
Author: User
Tags redis server

1: Write the automatic discovery script on the Zabbix_agentd side, mainly to automatically discover the monitoring port of Redis, the script is as follows:

vim/usr/local/zabbix/zabbix_discover_redis.sh

#!/bin/sh

#zhuangweihong 20160419 Zabbix Discover Redis


res= ' sudo ss-tulnp|grep redis|awk ' {print $ (NF-2)} ' |awk-f ': ' {print $ (NF)} ' |sort-u '

If [-Z ' $res ']];then

echo "Redis have not find"

Exit 2

Fi

Count= ' echo ' $res ' |wc-l '

If [$count-eq 0];then

echo "Redis have not find"

Exit 2

Fi

printf ' {\ n '

printf ' \ t ' data: [\ n '

Mycount=1

echo "$res" |while read Line;do

If [$count-eq $mycount];then

printf "\t\t\t{\" {#REDISPORT}\ ": \" $line \ "}\n"

Else

printf "\t\t\t{\" {#REDISPORT}\ ": \" $line \ "},\n"

Let "mycount++"

Fi

Done


printf ' \t]\n '

printf '}\n '

Exit 0


The automatic discovery script needs to be noted:

1:visudo Zabbix user needs the operation of the SS, configured as follows, Visudo:

Zabbix all= nopasswd:/usr/sbin/ss

Defaults:zabbix!requiretty


2: Configure the following on the Zabbix_agentd side:

userparameter=zabbix.discovery.redis,/usr/local/zabbix/zabbix_discover_redis.sh

Userparameter=redis.status[*],redis-cli-p $ info|grep "$:" |cut-d:-f2


Where to look for configuration:

1:zabbix_discover_redis.sh Zabbix need to have execute permission

2:redis server does not set the password situation, otherwise it will generally have to add a verification.

3: Restart ZABBIX_AGENTD after configuration


3: Create a template in the Zabbix server's Web page configuration, name such as: template Redis Discovery Service


4: Create a Discovery rule: The name is: Redis Discovery, key value configuration: Zabbix.discovery.redis.


5: Create the project prototype, the name and the corresponding key values are as follows:

{#REDISPORT}:redis Connected clients redis.status[{#REDISPORT},connected_clients]

{#REDISPORT}:redis mem_fragmentation_ratio redis.status[{#REDISPORT},mem_fragmentation_ratio]

{#REDISPORT}:redis Port Check net.tcp.service[tcp,,{#REDISPORT}]

{#REDISPORT}:redis used_memory redis.status[{#REDISPORT},used_memory]

{#REDISPORT}:redis used_memory_rss redis.status[{#REDISPORT},used_memory_rss]

Monitor the number of client connections, memory fragmentation, and Redis port survivability detection for Redis, respectively.


6: Create a trigger:

1: For Port checking

2: Depends on port check for the number of connected clients

3: Depends on port check for fragmentation


7: Create a graphical prototype:

1: Number of client connections

2:redis uses memory and actually practical memory.

This article is from the "Zhangweihong" blog, make sure to keep this source http://zhuangweihong.blog.51cto.com/8808431/1772250

Zabbix Automatic Discovery Monitoring Redis

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.