Skip to content

pavelnemirovsky/zabbix-redis-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redis Template for Zabbix

Redis General View

Dashboard

Table of Contents

Features

  • Ability to discovery multiple Redis instances running on same host
  • Generate automatically a zabbix screen for general statistics, commands and replication overview on host! level.
  • Triggers identify command anomaly (not done yet) and instance crash

Installation

  • Import zbx_template/zbx_export_templates.xml via Zabbix -> Configuration -> Templates -> Import
  • Place zbx_template/zbx_redis_discovery.sh under /usr/bin/zbx_redis_discovery.sh
  • Place template userparameters under /etc/zabbix/zabbix_agentd.d/ or other place according your installation
  • Restart your zabbix agent where all above were placed

Installation (OPTIONAL)

  • Replace following line your.first.redis.host.local under zbx_screens/zbx_export_screens.xml with your first redis host
  • Import saved file zbx_export_screens.xml via Zabbix -> Monitoring -> Screens

Important

  • Make sure your redis-server configuration file ends with .conf otherwise INSTANCE name won't be discovered
  • Discovery produce stats files from where template gathers stats per 1 min basis, so important to leave discovery rules to run with short interval only. (current template do that each 1 min)
  • You don't have to worry about discovery process to update all items per 1 min basic, actually Zabbix Server use its own cache and perform DB update only when there is a new item appears.

Debuging / Issue reporting

  • if Discovery: "Discover Redis Instances" doesn't work: execute following command zbx_template/zbx_redis_discovery.sh general debug and output attach to the issue ticket
  • if Discovery: "Discover Redis Commands" doesn't work: execute following command zbx_template/zbx_redis_discovery.sh stats debug and output attach to the issue ticket
  • if Discovery: "Discover Redis Slaves" doesn't work: execute following command zbx_template/zbx_redis_discovery.sh replications debug and output attach to the issue ticket

Plans

  • Keep pushing on Zabbix R&D to let create graphs with multiple prototype items, meanwhile use Zabbix Grafana

Discovery with Statistics Report Flow

Discovery Flow

Example Instance Discovery:

zabbix_get -s redis.host.me -k redis.discovery[general,"123456 123456"] | jq .
{
  "data": [
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6399",
      "{#INSTANCE}": "INSTANCE1",
      "{#RDB_PATH}": "/usr/share/redis/instance1.rdb"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6395",
      "{#INSTANCE}": "INSTANCE2",
      "{#RDB_PATH}": "/usr/share/redis/instance2.rdb"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6397",
      "{#INSTANCE}": "INSTANCE3",
      "{#RDB_PATH}": "/usr/share/redis/instance3.rdb"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6389",
      "{#INSTANCE}": "INSTANCE4",
      "{#RDB_PATH}": "/usr/share/redis/instance4.rdb"
    }
  ]
}

Example Commands Stats Discovery:

zabbix_get -s redis.host.me -k redis.discovery[stats,"123456 123456"] | jq .
{
  "data": [
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6399",
      "{#COMMAND}": "cmdstat_auth",
      "{#INSTANCE}": "INSTANCE1"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6399",
      "{#COMMAND}": "cmdstat_ping",
      "{#INSTANCE}": "INSTANCE1"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6399",
      "{#COMMAND}": "cmdstat_info",
      "{#INSTANCE}": "INSTANCE1"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6399",
      "{#COMMAND}": "cmdstat_config",
      "{#INSTANCE}": "INSTANCE1"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6399",
      "{#COMMAND}": "cmdstat_slowlog",
      "{#INSTANCE}": "INSTANCE1"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6395",
      "{#COMMAND}": "cmdstat_auth",
      "{#INSTANCE}": "INSTANCE2"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6395",
      "{#COMMAND}": "cmdstat_ping",
      "{#INSTANCE}": "INSTANCE2"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6395",
      "{#COMMAND}": "cmdstat_info",
      "{#INSTANCE}": "INSTANCE2"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6395",
      "{#COMMAND}": "cmdstat_config",
      "{#INSTANCE}": "INSTANCE2"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6395",
      "{#COMMAND}": "cmdstat_slowlog",
      "{#INSTANCE}": "INSTANCE2"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6397",
      "{#COMMAND}": "cmdstat_set",
      "{#INSTANCE}": "INSTANCE3"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6397",
      "{#COMMAND}": "cmdstat_select",
      "{#INSTANCE}": "INSTANCE3"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6397",
      "{#COMMAND}": "cmdstat_auth",
      "{#INSTANCE}": "INSTANCE3"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6397",
      "{#COMMAND}": "cmdstat_ping",
      "{#INSTANCE}": "INSTANCE3"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6397",
      "{#COMMAND}": "cmdstat_info",
      "{#INSTANCE}": "INSTANCE3"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6397",
      "{#COMMAND}": "cmdstat_config",
      "{#INSTANCE}": "INSTANCE3"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6397",
      "{#COMMAND}": "cmdstat_slowlog",
      "{#INSTANCE}": "INSTANCE3"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6389",
      "{#COMMAND}": "cmdstat_auth",
      "{#INSTANCE}": "INSTANCE4"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6389",
      "{#COMMAND}": "cmdstat_ping",
      "{#INSTANCE}": "INSTANCE4"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6389",
      "{#COMMAND}": "cmdstat_info",
      "{#INSTANCE}": "INSTANCE4"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6389",
      "{#COMMAND}": "cmdstat_config",
      "{#INSTANCE}": "INSTANCE4"
    },
    {
      "{#HOST}": "127.0.0.1",
      "{#PORT}": "6389",
      "{#COMMAND}": "cmdstat_slowlog",
      "{#INSTANCE}": "INSTANCE4"
    }
  ]
}

Example Commands Stats Discovery:

zabbix_get -s redis.host.me -k redis.discovery[replication] | jq .
{
 "data": [
   {
     "{#HOST}": "127.0.0.1",
     "{#PORT}": "6400",
     "{#SLAVE}": "slave0",
     "{#INSTANCE}": "INSTANCE1"
   },
   {
     "{#HOST}": "127.0.0.1",
     "{#PORT}": "6400",
     "{#SLAVE}": "slave1",
     "{#INSTANCE}": "INSTANCE1"
   },
   {
     "{#HOST}": "127.0.0.1",
     "{#PORT}": "6400",
     "{#SLAVE}": "slave2",
     "{#INSTANCE}": "INSTANCE1"
   },
   {
     "{#HOST}": "127.0.0.1",
     "{#PORT}": "6400",
     "{#SLAVE}": "slave4",
     "{#INSTANCE}": "INSTANCE1"
   },
   {
     "{#HOST}": "127.0.0.1",
     "{#PORT}": "6400",
     "{#SLAVE}": "slave5",
     "{#INSTANCE}": "INSTANCE1"
   }
 ]
}    

About

Multi Instance Redis Discovery Template for Zabbix

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages