Zabbix (III): Monitors multiple Redis instances on Microsoft cloud Azure using the official Zabbix template, zabbixredis

Source: Internet
Author: User
Tags ssl connection install redis

Zabbix (III): Monitors multiple Redis instances on Microsoft cloud Azure using the official Zabbix template, zabbixredis
1. Running environment:

OS: CentOS 7.3/Python: 2.7.3/Pip: 9.0.1/Zabbix: 3.2.8/Redis: Microsoft cloud Redis 3.2.7

Monitoring templates officially provided by Zabbix.

Project address: https://github.com/blacked/zbx_redis_template

Python and Nodejs monitoring scripts are officially provided. This article uses Python scripts.

All official Zabbix templates: http://www.zabbix.org/wiki/Zabbix_Templates

 

2. Deployment

The official monitoring script supports two deployment methods: zabbix agent deployment and trap-messages deployment.

Zabbix agent method: zabbix requests redis parameters from the agent at intervals. The agent obtains the parameters from redis and delivers them to zabbix.

Trap-messages: the script automatically obtains redis parameters and integrates a message to send it to zabbix.

If you need to frequently obtain a large amount of redis data, the official recommendation is to use the trap-messages method, and the trap-messages method only supports python scripts.

Here we use the trap-messages Method for deployment.

 

1> install Python Dependencies

# yum -y install python-pip# pip install argparse# pip install redis

2> place zbx_redis_stats.py to a path on the zabbix server, such as/etc/zabbix/script/redis /.

3> modify the zabbix parameter in the script:

zabbix_host = '127.0.0.1'    # Zabbix Server IPzabbix_port = 10051            # Zabbix Server Port

4> because I have only enabled SSL connections for redis on Microsoft cloud, the script adds the redis SSL connection parameters:

client = redis.StrictRedis(host=redis_hostname, port=args.redis_port, password=args.redis_pass, ssl=True)

5> test whether the script can connect to redis on Microsoft cloud and obtain the parameters:

/etc/zabbix/script/redis/zbx_redis_stats.py  -a redispassword -p 6380 test.redis.cache.chinacloudapi.cn list_key_space_db

6> Add crontab and periodically execute the script to send data to zabbix. Note that if the password contains %, escape it with \ (\ % ).

To monitor multiple redis instances, add multiple crontabs:

*/1 * * * * /etc/zabbix/script/redis/zbx_redis_stats.py  -a redispassword -p 6380 test.redis.cache.chinacloudapi.cn

7> Import zbx_redis_trapper_template.xml to the zabbix template.

8> Use redis hostname to create a zabbix host and link the template to implement monitoring.

 

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.