Ad Widget

Collapse

Discussion thread for official Zabbix Template Redis

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nani
    Junior Member
    • Oct 2020
    • 1

    #16
    when i try to run this command zabbix_get -s redis-master -k redis.ping, i was getting an error saying zabbix_get[11572]: Get value error: cannot resolve [redis-master]? what is this, how can i over come this

    Comment

    • Alicris7
      Junior Member
      • Feb 2020
      • 1

      #17
      Is ther any alternative solution for multi instance of redis on one host?

      Comment

      • Victor Sudakov
        Junior Member
        • Apr 2020
        • 17

        #18
        This seems to have been asked several times, but I have seen no definite answer yet. I configured several Redis instances on a test host, I can query all of them by
        Code:
        zabbix-get -s testhost -k 'redis.info[redis1]
        zabbix-get -s testhost -k 'redis.info[redis2]
        etc, but how do I monitor all of them on testhost? Should not the template discover the instances?
        Last edited by Victor Sudakov; 19-03-2021, 07:12. Reason: Forgot to mention Zabbix version: 5.0.9

        Comment

        • tanvlt
          Junior Member
          • Apr 2021
          • 1

          #19
          Originally posted by Alicris7
          Is ther any alternative solution for multi instance of redis on one host?
          hi guys, here is my solution.
          For each Redis instance, i just add new host with different host-name on the same real HOST, then i adjust the "{$REDIS.CONN.URI}" macro to match with each instance name which configured in zabbix-agent2.conf.
          Click image for larger version

Name:	zabbix.png
Views:	1795
Size:	47.3 KB
ID:	423076
          Click image for larger version

Name:	Screenshot from 2021-04-19 15-20-19.png
Views:	1776
Size:	19.0 KB
ID:	423077

          Click image for larger version

Name:	Screenshot from 2021-04-19 16-04-48.png
Views:	1786
Size:	22.3 KB
ID:	423079

          Click image for larger version

Name:	Screenshot from 2021-04-19 15-53-05.png
Views:	1768
Size:	38.8 KB
ID:	423080

          Hope this can help you guys.
          Attached Files

          Comment


          • gelowe
            gelowe commented
            Editing a comment
            I am monitoring 20+ instances on one server using this method. I now have a problem. Now I don't get consistent returns from the redis ping. Sometime 1 hour between good returns. I think there is a concurrency issue with this method. Other metrics work fine, Anyone know how redis ping works?

          • gelowe
            gelowe commented
            Editing a comment
            My earlier issue with pings was fixed after a agent 2 update.
        • BernhardMM
          Junior Member
          • Jul 2021
          • 2

          #20
          Having installed the template (5.2 version) and checked with the current one, I would suggest to change the following:

          Code:
          item_prototypes:
          -
          name: 'Redis slave {#SLAVE_IP}:{#SLAVE_PORT}: Replication lag in bytes'
          type: DEPENDENT
          key: 'redis.replication.lag_bytes["{#SLAVE_IP}:{#SLAVE_PORT}"]'
          delay: '0'
          history: 7d
          units: B
          description: 'Replication lag in bytes'
          application_prototypes:
          -
          name: 'Redis: Slave {#SLAVE_IP}:{#SLAVE_PORT}'
          preprocessing:
          -
          type: JAVASCRIPT
          parameters:
          - |
          var repl = JSON.parse(value).Replication;
          var res = Object.keys(repl)
          .filter(function (v) {return v.match(/slave\d+/)})
          .filter(function (v) {return (repl[v].ip === "{#SLAVE_IP}" && repl[v].port === "{#SLAVE_PORT}")})
          .map(function (v) {return repl[v].offset})[0];
          
          if (res === undefined) {
          throw 'Slave {#SLAVE_IP}:{#SLAVE_PORT} is no longer available.';
          }
          
          return res;
          master_item:
          key: 'redis.info["{$REDIS.CONN.URI}"]'
          to

          Code:
          item_prototypes:
          -
          name: 'Redis slave {#SLAVE_IP}:{#SLAVE_PORT}: Replication lag in bytes'
          type: DEPENDENT
          key: 'redis.replication.lag_bytes["{#SLAVE_IP}:{#SLAVE_PORT}"]'
          delay: '0'
          history: 7d
          units: B
          description: 'Replication lag in bytes'
          application_prototypes:
          -
          name: 'Redis: Slave {#SLAVE_IP}:{#SLAVE_PORT}'
          preprocessing:
          -
          type: JAVASCRIPT
          parameters:
          - |
          var repl = JSON.parse(value).Replication;
          var res_master = JSON.parse(value).Replication.master_repl_offset;
          
          var res_slave = Object.keys(repl)
          .filter(function (v) {return v.match(/slave\d+/)})
          .filter(function (v) {return (repl[v].ip === "{#SLAVE_IP}" && repl[v].port === "{#SLAVE_PORT}")})
          .map(function (v) {return repl[v].offset})[0];
          
          if (res_slave === undefined) {
          throw 'Slave {#SLAVE_IP}:{#SLAVE_PORT} is no longer available.';
          }
          
          res = res_master - res_slave
          
          return res;
          master_item:
          key: 'redis.info["{$REDIS.CONN.URI}"]'
          Else the lag is not shown correctly. Works well for redis version 4.0.9 & Zabbix 5.2

          Comment

          • gelowe
            Member
            • Jun 2008
            • 30

            #21
            I think I found a concurrency issue when monitoring many (10+) redis using the multiple host method described by tanvlt
            The Redis Ping tests seem to inconsistently get data. They will get no data for 10 to 45 minutes. I am going to look further into why this might be. Any Ideas?

            (edit) I found out how it works but I still don't know why the template fails to gather the data when i run multiple hosts using methodology described above.


            I was able to work around this by not using the template and creating a Redis Ping item for every Redis instance as individual items on the same Zabbix host. Then creating triggers to monitor these.
            These check don't seem go offline for 10 to 45 minutes like the other ones mentioned.
            IE
            redis.ping[tcp://localhost:6378]
            redis.ping[tcp://localhost:6379]
            redis.ping[tcp://localhost:6380]

            Last edited by gelowe; 16-09-2021, 15:19.

            Comment

            • frank108
              Junior Member
              • Mar 2022
              • 15

              #22
              Hello,
              I hope that author is still checking this thread.

              I used this template on several servers and it works nice.
              Now I need to use for the servers behind zabbix proxy and no data are coming. The very same server that had a proper results is moved behind the proxy.
              The other metrics are working as expected.

              Logs are not so much helpful, only this entries:
              HTML Code:
              Zabbix agent item "proc.num["{$REDIS.LLD.PROCESS_NAME}"]" on host "my-server" failed: first network error, wait for 15 seconds
              Is there any other setting necessary ?

              Comment

              • frank108
                Junior Member
                • Mar 2022
                • 15

                #23
                Please, ignore above entry, seems to work now.
                Although, not sure what has been changed.
                The template is working again via zabbix proxy as expected.

                Comment

                • Gregbo
                  Junior Member
                  • May 2022
                  • 3

                  #24
                  Does this integration work with Redis 6.2.6 using SSL?

                  Comment

                  • DUGi
                    Junior Member
                    • Apr 2022
                    • 5

                    #25
                    Hello,

                    after upgrade from Zabbix 6.0 to Zabbix 6.4.2 I noticed that DB keys and Expires values are not collecting any more on all hosts with Agent2 Redis Template.
                    I imported 6.4 Template after upgrade without any luck.
                    Everything else is Working, all other data are collected.
                    Keystores are discovered.

                    Additional tests which I did:

                    I got info from command line: zabbix_agent2 -t "redis.info[Redis01]" -c /etc/zabbix/zabbix_agent2.conf - It should be stored in "Redis: Get info" Item

                    {"CPU":{"used_cpu_sys":"31.139694","used_cpu_sy s_c hildren":"0.000000","used_cpu_user":"40.104081","u sed_cpu_user_children":"0.000000"},"Clients":{"blo cked_clients":"0","client_recent_max_input_buffer" :"2",...........................

                    I used otput and tested "Redis: Get Keyspace info" Item Preprocessing which returned:
                    {"db5":{"expires":"262963","avg_ttl":"750169123 60" ,"keys":"262966"},"db6":{"expires":"534","avg_t tl" :"589570014","keys":"535"}}
                    it was OK

                    then I checked "DB db5: Get Keyspace info" and it looks WRONG !!!
                    It should have Master Item "Redis: Get info" instead of "Redis: Get Keyspace info" !!!

                    What to do to fix Template:
                    In Template -> Item "DB db5: Get Keyspace info" change Master Item from "Redis: Get Keyspace info" to "Redis: Get info"

                    I also added Memory Utilization Item in %, added Memory Utilization Graph and 2 Triggers for Memory Utilization.
                    Fixed and Upgraded Template is attached.​
                    Attached Files

                    Comment

                    • gelowe
                      Member
                      • Jun 2008
                      • 30

                      #26
                      Can someone update the plugin for Zabbix agent2 to for Redis instances with ACL's? The plugin supports passwords but not user id's.
                      Last edited by gelowe; 21-05-2024, 21:08.

                      Comment

                      • Satrier
                        Junior Member
                        • Mar 2023
                        • 3

                        #27
                        Issue with Redis Item Graphs and Errors in Nginx/PHP Logs

                        Zabbix Version: 7.0.2
                        Problem Description:
                        I have configured the Redis template in Zabbix, and data collection works fine. However, when trying to generate any item graph for Redis, I encounter the following error:
                        HTML Code:
                        incorrect value for field delay: invalid delay

                        Additionally, the Nginx logs show the following errors:
                        HTML Code:
                        2024/12/03 11:43:37 [error] 2880636#2880636: *121309647 FastCGI sent in stderr: "PHP message: PHP Warning: Undefined array key "file" in /usr/share/zabbix/include/classes/debug/CProfiler.php on line 374;
                        PHP message: PHP Warning: Undefined array key "line" in /usr/share/zabbix/include/classes/debug/CProfiler.php on line 374;
                        PHP message: PHP Warning: Cannot modify header information - headers already sent in /usr/share/zabbix/include/classes/helpers/CCookieHelper.php on line 54;
                        PHP message: PHP Warning: PHP Request Shutdown: Failed to write session data using user defined save handler. (session.save_path: /var/lib/php/sessions, handler: update_timestamp) in Unknown on line 0"
                        while reading upstream, client: 10.18.140.130, server: zabbix.info, request: "GET /chart.php?from=now-1h&to=now&itemids%5B0%5D=903506&type=0&resolve_mac ros=1&profileIdx=web.item.graph.filter&profileIdx2 =903506&width=1734&height=200&_=wxx0rwj3 HTTP/1.1",
                        upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: "zabbix.info", referrer: "https://zabbix.info/history.php?itemids%5B0%5D=903506&action=showgraph "

                        Steps Taken So Far:
                        1. The Redis template has been checked — data collection is working without errors.
                        2. The issue occurs only when generating graphs.
                        3. PHP configuration: using php8.2-fpm, session.save_path is set correctly.

                        Questions:
                        1. What could be the cause of the error incorrect value for field delay: invalid delay?

                        I would greatly appreciate any advice or troubleshooting steps to resolve this issue.

                        Click image for larger version

Name:	image.png
Views:	365
Size:	16.4 KB
ID:	495346
                        Click image for larger version

Name:	image.png
Views:	262
Size:	53.1 KB
ID:	495347
                        Click image for larger version

Name:	image.png
Views:	263
Size:	32.4 KB
ID:	495348
                        Click image for larger version

Name:	image.png
Views:	262
Size:	54.0 KB
ID:	495349​​​

                        Comment

                        • Satrier
                          Junior Member
                          • Mar 2023
                          • 3

                          #28
                          my problem fixed https://support.zabbix.com/browse/ZBX-25715

                          Comment

                          • TDex96
                            Junior Member
                            • Jan 2021
                            • 14

                            #29
                            Hey guys!

                            I have a problem with this redis plugin, please someone can help me?
                            I opened a thread about the problem, here is:

                            Comment

                            Working...