Skip to content

allenta/zabbix-template-for-redis

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

This is a Zabbix template + script useful to monitor Redis Server & Redis Sentinel instances:

  1. Copy zabbix-redis.py to /usr/local/bin/.

  2. Add the redis_server.discovery & redis_server.stats and / or redis_sentinel.discovery & redis_sentinel.stats user parameters to Zabbix:

    UserParameter=redis_server.discovery[*],/usr/local/bin/zabbix-redis.py -i '$1' -t server discover $2 2> /dev/null
    UserParameter=redis_server.stats[*],/usr/local/bin/zabbix-redis.py -i '$1' -t server stats 2> /dev/null
    UserParameter=redis_sentinel.discovery[*],/usr/local/bin/zabbix-redis.py -i '$1' -t sentinel discover $2 2> /dev/null
    UserParameter=redis_sentinel.stats[*],/usr/local/bin/zabbix-redis.py -i '$1' -t sentinel stats 2> /dev/null
    
  3. Import the templates. You may download the appropriate versions from the releases page or generate them using the Jinja2 skeletons:

    $ pip install jinja2-cli
    $ PYTHONPATH=. jinja2 \
        -D version={6.0,6.2,6.4} \
        [-D name='Redis Server'] \
        [-D description=''] \
        [-D release='trunk'] \
        --extension=extensions.zabbix.ZabbixExtension --strict -o template.xml template-app-redis-server.j2
    $ PYTHONPATH=. jinja2 \
        -D version={6.0,6.2,6.4} \
        [-D name='Redis Sentinel'] \
        [-D description=''] \
        [-D release='trunk'] \
        --extension=extensions.zabbix.ZabbixExtension --strict -o template.xml template-app-redis-sentinel.j2
    
  4. Link hosts to the templates. Beware depending on the used template you must set a value for the {$REDIS_SERVER.LOCATIONS} or {$REDIS_SENTINEL.LOCATIONS} macro (comma-delimited list of Redis instances; port, host:port and unix:///path/to/socket formats are allowed). Additional macros and contexts are available for further customizations.