Ad Widget

Collapse

Zabbix RabbitMQ Monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mcintoshj
    Junior Member
    • Oct 2013
    • 9

    #1

    Zabbix RabbitMQ Monitoring

    Zabbix RabbitMQ Configuration. Contribute to jasonmcintosh/rabbitmq-zabbix development by creating an account on GitHub.


    uses the management API and user config files, plus some python scripts to monitor RabbitMQ queues and server configuration. Just thought I'd share,

    Jason
  • mcintoshj
    Junior Member
    • Oct 2013
    • 9

    #2
    Updated

    Originally posted by mcintoshj
    https://github.com/jasonmcintosh/rabbitmq-zabbix

    uses the management API and user config files, plus some python scripts to monitor RabbitMQ queues and server configuration. Just thought I'd share,

    Jason
    I've updated this template to v2. The update uses zabbix_sender to push data back to zabbix, has some updated discovery and triggers, numerous other fixes, simplified python, etc.

    Comment

    • Alwaysin
      Junior Member
      • Jan 2012
      • 27

      #3
      Hi, thanks for this! It's exactly what I was loooking for

      However I'm having errors in zabbix_agentd log:

      Traceback (most recent call last):
      File "./api.py", line 117, in <module>
      main()
      File "./api.py", line 106, in main
      print api.check_queue(filters)
      File "./api.py", line 57, in check_queue
      for queueData in self.call_api('queues'):
      File "./api.py", line 29, in call_api
      return json.loads(urllib2.build_opener(handler).open(url) .read())
      File "/usr/lib/python2.7/urllib2.py", line 406, in open
      response = meth(req, response)
      File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
      'http', request, response, code, msg, hdrs)
      File "/usr/lib/python2.7/urllib2.py", line 438, in error
      result = self._call_chain(*args)
      File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
      result = func(*args)
      File "/usr/lib/python2.7/urllib2.py", line 890, in http_error_401
      url, req, headers)
      File "/usr/lib/python2.7/urllib2.py", line 865, in http_error_auth_reqed
      response = self.retry_http_basic_auth(host, req, realm)
      File "/usr/lib/python2.7/urllib2.py", line 878, in retry_http_basic_auth
      return self.parent.open(req, timeout=req.timeout)
      File "/usr/lib/python2.7/urllib2.py", line 406, in open
      response = meth(req, response)
      File "/usr/lib/python2.7/urllib2.py", line 519, in http_response
      'http', request, response, code, msg, hdrs)
      File "/usr/lib/python2.7/urllib2.py", line 444, in error
      return self._call_chain(*args)
      File "/usr/lib/python2.7/urllib2.py", line 378, in _call_chain
      result = func(*args)
      File "/usr/lib/python2.7/urllib2.py", line 527, in http_error_default
      raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
      urllib2.HTTPError: HTTP Error 401: Unauthorized

      What could be the reason for that?

      Comment

      • mcintoshj
        Junior Member
        • Oct 2013
        • 9

        #4
        Off hand, it looks like you are missing or have incorrect username/passwords. The key thing to note is the "urllib2.HTTPError: HTTP Error 401: Unauthorized" - that means that rabbitmq refused authorization using the ".rab.auth" file that should be created to use these. You should have a file: /etc/zabbix/scripts/.rab.auth
        containing something like:
        USERNAME=guest
        PASSWORD=guest

        That user has to have access to the RabbitMQ management API's.

        Comment

        • Alwaysin
          Junior Member
          • Jan 2012
          • 27

          #5
          Thanks for the reply!

          I double-checked that I have this file and that the rights are correct. And then I wondered if I had to use capital letters like you did in your message, and it looks like this was the point...
          As it is written in lowercase on the github page and on the README, maybe you should change this to prevent other ones from having this problem.

          Thank you very much for your help, it is greatly appreciated!

          Comment

          • mcintoshj
            Junior Member
            • Oct 2013
            • 9

            #6
            Readme updated Thanks for the feedback! A thing I'm working on right now is trying to figure out which metric will give me a rate change, and then use Zabbix deltas. For example, I'm looking at the backing queue stats and the sequence ID as a possible delta field that would give me a messages per second rate. I'll post here as I update things.

            Comment

            • Alwaysin
              Junior Member
              • Jan 2012
              • 27

              #7
              Nice idea for an update, I'm eagerly waiting for it

              Besides this, I have a suggestion : to add dependencies on triggers, so that when you've got 80% of sockets in use for example, you don't have notification for >50% and for >75% but only for >75%.

              Attached is the screenshot of the dependencies I added.
              Attached Files

              Comment

              • mcintoshj
                Junior Member
                • Oct 2013
                • 9

                #8
                Originally posted by Alwaysin
                Nice idea for an update, I'm eagerly waiting for it

                Besides this, I have a suggestion : to add dependencies on triggers, so that when you've got 80% of sockets in use for example, you don't have notification for >50% and for >75% but only for >75%.

                Attached is the screenshot of the dependencies I added.
                Will get the template updated hopefully here a bit later today with the dependencies Thanks for the suggestion! I don't have a good feel right now on the delta for message rates - so that's still a "goal" rather than something I'm super actively working on. But I can at least get your dependencies added! Note, I've updated the template recently and the API python has gone through some significate revisions allowing filtering and more advanced configuration.

                Comment

                • mcintoshj
                  Junior Member
                  • Oct 2013
                  • 9

                  #9
                  Originally posted by mcintoshj
                  Will get the template updated hopefully here a bit later today with the dependencies Thanks for the suggestion! I don't have a good feel right now on the delta for message rates - so that's still a "goal" rather than something I'm super actively working on. But I can at least get your dependencies added! Note, I've updated the template recently and the API python has gone through some significate revisions allowing filtering and more advanced configuration.
                  SO here's a fun question on this. Is it better to do dependencies, or to add a "And less than 75%" as part of the check. I'm not sure which are more efficient - depenedencies or the extra check on the trigger. I've done both ways.

                  Comment

                  • rchannel
                    Junior Member
                    • Apr 2014
                    • 5

                    #10
                    URL issues.

                    Found this issue, I do not know how to delete this post. I missed a where the password variable was set.

                    I keep getting errors in the url and authentication. I have moved my user and password into the api to eliminate the conf file as a issue.

                    Traceback (most recent call last):
                    File "api.py", line 184, in <module>
                    main()
                    File "api.py", line 169, in main
                    print json.dumps({'data': api.list_nodes()})
                    File "api.py", line 56, in list_nodes
                    for node in self.call_api('nodes'):
                    File "api.py", line 32, in call_api
                    return json.loads(urllib2.build_opener(handler).open(url) .read())
                    File "/usr/lib64/python2.6/urllib2.py", line 397, in open
                    response = meth(req, response)
                    File "/usr/lib64/python2.6/urllib2.py", line 510, in http_response
                    'http', request, response, code, msg, hdrs)
                    File "/usr/lib64/python2.6/urllib2.py", line 429, in error
                    result = self._call_chain(*args)
                    File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
                    result = func(*args)
                    File "/usr/lib64/python2.6/urllib2.py", line 880, in http_error_401
                    url, req, headers)
                    File "/usr/lib64/python2.6/urllib2.py", line 858, in http_error_auth_reqed
                    return self.retry_http_basic_auth(host, req, realm)
                    File "/usr/lib64/python2.6/urllib2.py", line 868, in retry_http_basic_auth
                    return self.parent.open(req, timeout=req.timeout)
                    File "/usr/lib64/python2.6/urllib2.py", line 397, in open
                    response = meth(req, response)
                    File "/usr/lib64/python2.6/urllib2.py", line 510, in http_response
                    'http', request, response, code, msg, hdrs)
                    File "/usr/lib64/python2.6/urllib2.py", line 435, in error
                    return self._call_chain(*args)
                    File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
                    result = func(*args)
                    File "/usr/lib64/python2.6/urllib2.py", line 518, in http_error_default
                    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
                    urllib2.HTTPError: HTTP Error 401: Unauthorized
                    Last edited by rchannel; 18-08-2014, 16:32. Reason: Solved this issue.

                    Comment

                    • rchannel
                      Junior Member
                      • Apr 2014
                      • 5

                      #11
                      Add request

                      So figured out all my earlier issues. But would love to get this added:
                      /api/aliveness-test/vhost

                      Just a hopeful.

                      Comment

                      • pskittz
                        Junior Member
                        • Aug 2014
                        • 1

                        #12
                        HTTPError: HTTP Error 401: Unauthorized

                        Hi!

                        Been trying to configure zabbix to monitor rabbitmq queues. I stumbled upon the same issue as mentioned above. I created the file but I still get the same error.

                        [root@my-server scripts]# ll .rab.auth
                        -rwxr-xr-x. 1 zabbix zabbix 209 Aug 18 07:17 .rab.auth
                        [root@my-server scripts]#


                        [root@my-server scripts]# pwd
                        /etc/zabbix/scripts

                        [root@my-server scripts]# cat .rab.auth
                        USERNAME=guest
                        PASSWORD=guest
                        CONF=/etc/zabbix/zabbix_agentd.conf

                        FILTER='[{"Inbound Queue" : "inbound.queue"}, {"Outbound Queue" : "outbound.queue"}, {"Not Outgoing Routable" : "notoutgoing.queue"}]'

                        Error
                        ------

                        [root@my-server rabbitmq]# ./list_rabbit_queues.sh
                        ./list_rabbit_queues.sh: line 11: .rab.auth: No such file or directory
                        Traceback (most recent call last):
                        File "./api.py", line 185, in <module>
                        main()
                        File "./api.py", line 168, in main
                        print json.dumps({'data': api.list_queues(filters)})
                        File "./api.py", line 42, in list_queues
                        for queue in self.call_api('queues'):
                        File "./api.py", line 32, in call_api
                        return json.loads(urllib2.build_opener(handler).open(url) .read())
                        File "/usr/lib64/python2.6/urllib2.py", line 397, in open
                        response = meth(req, response)
                        File "/usr/lib64/python2.6/urllib2.py", line 510, in http_response
                        'http', request, response, code, msg, hdrs)
                        File "/usr/lib64/python2.6/urllib2.py", line 429, in error
                        result = self._call_chain(*args)
                        File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
                        result = func(*args)
                        File "/usr/lib64/python2.6/urllib2.py", line 880, in http_error_401
                        url, req, headers)
                        File "/usr/lib64/python2.6/urllib2.py", line 858, in http_error_auth_reqed
                        return self.retry_http_basic_auth(host, req, realm)
                        File "/usr/lib64/python2.6/urllib2.py", line 868, in retry_http_basic_auth
                        return self.parent.open(req, timeout=req.timeout)
                        File "/usr/lib64/python2.6/urllib2.py", line 397, in open
                        response = meth(req, response)
                        File "/usr/lib64/python2.6/urllib2.py", line 510, in http_response
                        'http', request, response, code, msg, hdrs)
                        File "/usr/lib64/python2.6/urllib2.py", line 435, in error
                        return self._call_chain(*args)
                        File "/usr/lib64/python2.6/urllib2.py", line 369, in _call_chain
                        result = func(*args)
                        File "/usr/lib64/python2.6/urllib2.py", line 518, in http_error_default
                        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
                        urllib2.HTTPError: HTTP Error 401: Unauthorized
                        [root@my-server rabbitmq]# cd ../

                        The other issue is, I have installed zabbix_sender and the zabbix-rabbitmq.conf is configured correctly but when I restart the zabbix_agentd nothing in regards to the zabbix_rabbitmq is logged on the zabbix_agentd log. What I'm I missing?

                        Comment

                        • rmsys
                          Junior Member
                          • Jul 2013
                          • 13

                          #13
                          urllib2.HTTPError: HTTP Error 401: Unauthorized

                          I'm with the same error.

                          Comment

                          • kamill
                            Junior Member
                            • Oct 2014
                            • 1

                            #14
                            Answer in first line - ./list_rabbit_queues.sh: line 11: .rab.auth: No such file or directory.
                            File .rab.auth must be in same folder with list_rabbit_queues.sh, by default in /etc/zabbix/scripts/rabbitmq/.rab.auth

                            Comment

                            • marty.fox
                              Junior Member
                              • Feb 2015
                              • 4

                              #15
                              Cant see queue data

                              Hi All,

                              I have been trying to configure this plugin and have followed the advice on this thread but I still receive the same error as above (except i dont get "./list_rabbit_queues.sh: line 11: .rab.auth: No such file or directory" just the traceback error)

                              The .rab.auth file is in the /scripts/rabbitmq/ folder and i have given it 777 access (and I have tried both root and zabbix as owner) just to make sure that wasn't the issue but still nothing.

                              Any tips on what i could be doing wrong?

                              Thanks
                              Marty
                              Last edited by marty.fox; 28-04-2015, 13:44.

                              Comment

                              Working...