Coder Social home page Coder Social logo

rabbitmq-zabbix's Introduction

rabbitmq-zabbix

Project is in ARCHIVED state. I no longer work on zabbix nor rabbitmq, and don't have the time to maintain it. If there are others who'd like to continue maintenance, feel free to reach out to me - ideally show it with a PR and an updated Readme ;). Note, for monitoring in general, I'd look at alternatives to Zabbix. Most of what I see is SaaS or Prometheus and there are solutions for those platforms which are MUCH better supported at this point. Sorry for the lack of updates but I have other projects I work on (Spinnaker is my main area of focus at this time, as well as DevOps automation for Cloud infrastructure)

Build Status

Template and checks to monitor rabbitmq queues and server via Zabbix.

SOURCE:

https://github.com/jasonmcintosh/rabbitmq-zabbix

WHY:

Because the SNMP plugin isn't an officially supported plugin, and rabbitmqctl based monitors are REALLY slow in comparison.

WHAT:

Set of python scripts, zabbix template, and associated data to do autodiscovery

HOW:

  1. Install the files into /etc/zabbix/ folder, change permissions to Zabbix.
  2. Setup configuration (see below)
  3. Import the template to your zabbix server
  4. Make sure zabbix_sender is installed
  5. WARNING Watch your process timeout. I hit an issue with the amount of data and queues in rabbit where processing the results took longer than 3 seconds - that's the default timeout for the agent to kill a process. If I can switch to a file based push instead of calling send for each item, this will hopefully reduce the time to send even further
  6. Restart the local zabbix agent

CONFIGURATION:

Basic security recommendation See https://www.rabbitmq.com/access-control.html for more information on access control.

When setting up a monitoring system, a general rule is that you should not to use tbe built-in
guest account.  Guest is an admin account with full permissions.  A basic suggestion is to setup 
a read only account who can access the management API.  Make sure that account is READ ONLY.  With 
one caveat - the monitoring user should be able execute the aliveness-test api.  That might mean
needing a slightly different set of permissions or pre-creation of the aliveness check queues.
IF using guest a warning - it can only access RabbitMQ management via localhost so you will 
need to set HOSTNAME=localhost

Below are sample commands to add a monitoring user with the required permissions.  Use these
at your own risk or as a starting point - NOT a finishing point!  

rabbitmqctl add_user zabbix pass
rabbitmqctl set_user_tags zabbix monitoring
rabbitmqctl set_permissions -p / zabbix '^aliveness-test$' '^amq\.default$' '^aliveness-test$'

You should create a .rab.auth file in the scripts/rabbitmq directory. This file allows you to change default parameters. The format is VARIABLE=value, one per line: The default values are as follows:

USERNAME=guest
PASSWORD=guest
CONF=/etc/zabbix/zabbix_agent.conf
LOGLEVEL=INFO
LOGFILE=/var/log/zabbix/rabbitmq_zabbix.log
PORT=15672

You can also add a filter in this file to restrict which queues are monitored. This item is a JSON-encoded string. The format provides some flexibility for its use. You can either provide a single object or a list of objects to filter. The available keys are: status, node, name, consumers, vhost, durable, exclusive_consumer_tag, auto_delete, memory, policy

For example, the following filter could find all the durable queues: FILTER='{"durable": true}'

To only use the durable queues for a given vhost, the filter would be: FILTER='{"durable": true, "vhost": "mine"}'

To supply a list of queue names, the filter would be: FILTER='[{"name": "mytestqueuename"}, {"name": "queue2"}]'

To debug any potential issues, make sure the log directory exists and can be written to by zabbix, then set LOGLEVEL=DEBUG in the .rab.auth file and you'll get quite verbose output

Macros

You can adjust the values for the critical and warning levels for the amount of messages by changing the following macros:

  • RABBIT_QUEUE_MESSAGES_CRIT Defines the critical value for the amount of messages in a queue. It is set to 200000 messages per default
  • RABBIT_QUEUE_MESSAGES_WARN Defines the warning value for the amount of messages in a queue. It is set to 100000 messages per default

Low level discovery of queues, including GLOBAL REGULAR EXPRESSIONS:

https://www.zabbix.com/documentation/3.0/manual/regular_expressions The low level discovery, which is what determines what queues to be monitored, requires with the existing template that a filter be defined as a global regular expression. You can modify the template to do it in other ways, e.g. with a host level macro (NOT TESTED), or override it per host. Or any number of methods. But without a filter, NO queues will be discovered, JUST server level items will show up, and your checks will fail.

At some point the filters may be improved to include regular expressions or "ignore these queues"

CHANGES

  • Updated to use zabbix_sender to push data on request to an item request. This is similar to how the FromDual MySQL Zabbix stuff works and the concept was pulled from their templates.
  • Updated the filters to handle a list of objects

Ideas for the future?

Add a local cache of the results (may be overkill for RabbitMQ). Feel free to submit changes or ideas - [email protected]

Repo: https://github.com/jasonmcintosh/rabbitmq-zabbix

Definite kudos to some of the other developers around the web. In particular,

rabbitmq-zabbix's People

Contributors

199sm avatar adamlc avatar bouke avatar denisby avatar geekpete avatar intigabriel avatar jasonmcintosh avatar jsosic avatar leweafan avatar niakrisn avatar randomreaper avatar rikwasmus avatar sfesfizh avatar shaunrampersad avatar tuxmartin avatar twillouer avatar vladimirglazkov avatar zentavr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rabbitmq-zabbix's Issues

I don't know why fail to discovery queues.

hi,

now the zbx server could get the data but RabbitMQ Refresh Rabbit Queue Status, it's so strange, could you give any suggestions?

seems the discovery rules didn't work.

root@v01:/etc/zabbix/scripts/rabbitmq# zabbix_sender -c /etc/zabbix/zabbix_agentd.conf -i /tmp/tmpnGsuad -vv
zabbix_sender [26100]: DEBUG: answer [{"response":"success","info":"processed: 0; failed: 250; total: 250; seconds spent: 0.001954"}]
info from server: "processed: 0; failed: 250; total: 250; seconds spent: 0.001954"
zabbix_sender [26101]: DEBUG: answer [{"response":"success","info":"processed: 0; failed: 74; total: 74; seconds spent: 0.000586"}]
info from server: "processed: 0; failed: 74; total: 74; seconds spent: 0.000586"
sent: 324; skipped: 0; total: 324

Now the soft versions:
Zabbix 3.0.3
RabbitMQ 3.2.4, Erlang R16B03
Linux v01 3.13.0-86-generic #130-Ubuntu SMP
zabbix_sender has been installed.
And I have activated UnsafeUserParameters=1 in zabbix_agentd.conf.

BTW:
some tips for deploying this repo:

  • add /etc/zabbix/scripts/
  • modify rabbitmq user/pass /etc/zabbix/scripts/rabbitmq/.rab.auth
  • install zabbix_sender on client side
  • modify /etc/zabbix/zabbix_agentd.conf:
    • UnsafeUserParameters=1
    • /etc/zabbix/zabbix_agentd.conf.d/zabbix-rabbitmq.conf
  • /etc/zabbix/zabbix_agentd.conf.d/zabbix-rabbitmq.conf
    • UserParameter=rabbitmq.discovery_queue,/etc/zabbix/scripts/rabbitmq/list_rabbit_queues.sh
    • UserParameter=rabbitmq.discovery_nodes,/etc/zabbix/scripts/rabbitmq/list_rabbit_nodes.sh
    • UserParameter=rabbitmq[*],/etc/zabbix/scripts/rabbitmq/rabbitmq-status.sh $1 $2 $3
  • mkdir /var/log/zabbix
  • /etc/init.d/zabbix-agent restart
  • import template into zbx server portal and use it

BRs,
Hua

How to config agent to trap data

Hi,

Thanks for your job. All works fine for but I have just a misunderstanding about Trap data from agent to server after LLD discovery.
Could you explain ? It should not have a UserParameter with a script sending data ?

Regards.

HTTP Error 404: Object Not Found

Hello,

I'm having an issue with trying to get the Rabbit monitoring up and running:

6
Traceback (most recent call last):
File "./api.py", line 275, in
main()
File "./api.py", line 264, in main
print api.check_aliveness()
File "./api.py", line 196, in check_aliveness
return self.call_api('aliveness-test/%2f')['status']
File "./api.py", line 36, in call_api
return json.loads(urllib2.build_opener(handler).open(url).read())
File "/usr/lib64/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/lib64/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.7/urllib2.py", line 469, in error
result = self._call_chain(*args)
File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 926, in http_error_401
url, req, headers)
File "/usr/lib64/python2.7/urllib2.py", line 901, in http_error_auth_reqed
response = self.retry_http_basic_auth(host, req, realm)
File "/usr/lib64/python2.7/urllib2.py", line 914, in retry_http_basic_auth
return self.parent.open(req, timeout=req.timeout)
File "/usr/lib64/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/lib64/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python2.7/urllib2.py", line 475, in error
return self._call_chain(*args)
File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 558, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Object Not Found

Any help would be much appreciated.

Thanks

no discovery

Hi and sorry for being unable to wrap my head around this myself...
I read the README and some of the issues reported by others, but to no avail so far.

  • scripts installed, .rab.auth configured
  • list_queues.sh and so on work (I can see json output)
  • check_aliveness shows 'ok' on zabbix server
  • but all other items are never filled or even checked
  • discovery does not work
  • I have a regex like
@rabbitmq vhosts for discovery  ^.*$    [Result is TRUE]

should this be named with or without the @? Would this be enough?

when I run rabbitmq-status.sh (after having added some debug code to api.py), I get:

/etc/zabbix/scripts/rabbitmq/rabbitmq-status.sh queues messages

out: info from server: "processed: 0; failed: 96; total: 96; seconds spent: 0.000702"
sent: 96; skipped: 0; total: 96

probably beccause the corresponing items do not yet exist???

I also tried zabbix_get from the server:

 zabbix_get -s rabbitmq1.mydomain.loc -k rabbitmq.discovery_queue

This also returns the JSON data, so this does not seem an issue.

I also set debug in zabbix_agentd.conf, but only ever see the check_aliveness, never the discovery even attempted.

So far not being very experienced with Zabbix discovery, I just do not seem to understand it, I'm afraid.

Any hints greatly appreciated,
Sven

Unable to see anything in Zabbix

I have downloaded and installed the plugin into /etc/zabbix/scripts/rabbit folder. I have also created a .rab.auth file there in the same folder. ~/.rabbitmq-status.sh list_queues also gives me result as expected from a remote machine.

However I am not able to see anything in Zabbix for any of the 16 Templates. All I could see some tweaks was a 400 Bad Request. Do you have any pointers on how to troubleshoot this issue? Am I missing anything in the Templates that is causing this? If you have a more detailed guide on configuring the Templates that will also be helpful. I am presently trying to check-aliveness work.

Here is the /var/log/zabbix/zabbix-server.log

24616:20160516:174458.893` error reason for "192.168.5.222:vfs.fs.size[D:,used]" changed: Received value [HTTP/1.1 400 Bad RequestServer: MochiWeb/1.0 (Any of you quaids got a smint?)Date: Mon, 16 May 2016 12:14:59 GMTContent-Length: ] is not suitable for value type [Numeric (unsigned)] and data type [Decimal]

Switch from trapper to agent

Hello,

My Zabbix server is behing a firewall and not reachable from outside devices. I have to configure one right now with this plugin, so I'd like to be able to use "Zabbix Agent" instead of "Zabbix Trapper" for it. Is that possible?

I tried to switch everything to Agent but no data is retrieved on queues (it is working for aliveness, deliver rates, etc) :(

Please solve the problem (Integer value)

I got an error message from the script. api.py: error: option --port: invalid integer value : ' '
The port I user is 15672 and I haven't edited the api.py.

What should I do for next?

Thanks,

Override hostname

Hello,

I've attempted to override the rabbitmq server hostname by setting HOSTNAME= in .rab.auth but it seems to use it. Rather it's using the default environment variable. Would it be possible to have an override put in or is there a way to do it that I'm missing? I have multiple interfaces and the one that rabbit listens on is different than the one associated with the system hostname.

Thanks,
Erik

Authentication using guest user

Hi Jason,

First of all thanks for creating this - it's very useful.

Not sure this is really an issue but when configuring this today I was getting authentication refused. I then loudly told a co-worker that guest:guest only works on localhost (i.e. 127.0.0.1) and not any other interface and then spent half an hour like an idiot trying to figure out why I was getting a 401 response. Eventually I gave up and ran tcpdump and immediately saw the problem.

The change to disallow guest access except to localhost was introduced in RabbitMQ 3.3 which was released in 2014 - https://www.rabbitmq.com/blog/2014/04/02/breaking-things-with-rabbitmq-3-3/

So with that said would it make sense for the default hostname to be set to 127.0.0.1 or if not update the readme to reference that if you are using guest:guest and RabbitMQ >= 3.3 then the hostname must be set in .rab.auth as HOSTNAME=127.0.0.1 in order to authenticate correctly.

I'm happy to open an MR but just wanted to get your thoughts before I did so.

Thanks,
Trevor

rabbitmq[server,version] returning None

Version wasn't properly reported for me, the below makes it work (though this may be the case just for me, as I'm using an older version):

--- rabbitmq_api.py.old
+++ rabbitmq_api.py
@@ -125,6 +125,8 @@
        return self.call_api('overview').get('message_stats', {}).get('deliver_get',0)
         elif item == 'message_stats_publish':
        return self.call_api('overview').get('message_stats', {}).get('publish',0)
+        elif item == 'version':
+            return self.call_api('overview').get('rabbitmq_version',0)
         return self.call_api('nodes/{0}'.format(node_name.split(".")[0])).get(item)

urlopen error [Errno 111] Connection refused

What i'm doing wrong?

After update scripts i'm get an error:
root@zabbix:~# zabbix_get -s 136.x.x.135 -k rabbitmq.discovery_queue
or with manually run at client
w2:/etc/zabbix# sudo -u zabbix /etc/zabbix/scripts/rabbitmq/list_rabbit_queues.sh

Traceback (most recent call last):
  File "./api.py", line 209, in <module>
    main()
  File "./api.py", line 192, in main
    print json.dumps({'data': api.list_queues(filters)})
  File "./api.py", line 46, in list_queues
    for queue in self.call_api('queues'):
  File "./api.py", line 36, in call_api
    return json.loads(urllib2.build_opener(handler).open(url).read())
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1214, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 111] Connection refused>

Agent error Invalid Choice

Hello,
Sorry for my english, i'm french.
I've got an error in the zabbix agent version 3.3.4.

Requested [rabbitmq[{#NODENAME},/,queue_durable,Meter]]
In zbx_popen() command:'/opt/zabbix/scripts/rabbitmq/rabbitmq-status.sh {#NODENAME} / queue_durable Meter'
End of zbx_popen():6
zbx_popen(): executing script
Usage: api.py [options]
api.py: error: option --check: invalid choice: '{#NODENAME}' (choose from 'list_queues', 'list_nodes', 'queues', 'check_aliveness', 'server')

Activate UnsafeUserParameters=1 in zabbix_agentd.conf

I also modify zabbix-rabbitmq.conf wiht this parameters:
UserParameter=rabbitmq[*],/etc/zabbix/scripts/rabbitmq/rabbitmq-status.sh $1 $2 $3 $4
This change make some items work in the template.

Thanks a lot for all

Best regards.

Jean-Luc

Can't get queues to work

Hey guys, thanks for writing this plugin!

I'm having a few issues, been pulling my hair out all afternoon over this. For some reason the queues don't seem to be working. I've created a filter, which seems to be working according to the logs:

2016-02-16 16:25:30,983 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_memory,jumplead.illuminate_task]" 17512
2016-02-16 16:25:30,983 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_messages,jumplead.illuminate_task]" 0
2016-02-16 16:25:30,983 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_messages_unacknowledged,jumplead.illuminate_task]" 0
2016-02-16 16:25:30,983 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_consumers,jumplead.illuminate_task]" 0
2016-02-16 16:25:30,983 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_message_stats_deliver_get,jumplead.illuminate_task]" 4383
2016-02-16 16:25:30,983 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_message_stats_publish,jumplead.illuminate_task]" 4332

But unfortunately zabbix_sender seems to be rejecting them:

2016-02-16 16:25:31,003 WARNING: info from server: "processed: 0; failed: 6; total: 6; seconds spent: 0.000129"
sent: 6; skipped: 0; total: 6

Any idea whats wrong? I'm not sure if I've setup the Regular expressions correctly. I've created a regexp called rabbitmq vhosts for discovery with this exp ^/$ with result is true (I've tried a few combinations. Am I missing anything?

Also some of the server checks are failing, for example RabbitMQ Server Partitions is currently Not Found, but I'm not sure if this is due to the queues part failing?

Thanks guys!

installation problem

Hello,

Can you help me ?

screen shot 2016-12-15 at 09 31 52
screen shot 2016-12-15 at 08 42 00

Error Messages is;
RabbitMQ Message Deliver Rates
RabbitMQ Message Receive Rates
Received value [Traceback (most recent call last): File "./api.py", line 277, in main() File "./api.py", line 272, in main print api.check_server(options.metric, options.node) File "./api.py", line 199, in check_server return self.call_api('overview').get('message_stats', {}).get('deliver_get_details', {}).get('rate',0) File "./api.py", line 35, 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] is not suitable for value type [Numeric (float)]

RabbitMQ Refresh Rabbit Queue Status
RabbitMQ Server Memory Used
Received value [Traceback (most recent call last): File "./api.py", line 277, in main() File "./api.py", line 262, in main print api.check_queue(filters) File "./api.py", line 106, in check_queue for queue in self.call_api('queues'): File "./api.py", line 35, 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] is not suitable for value type [Numeric (unsigned)] and data type [Decimal]

RabbitMQ Refresh Rabbit Shovel Status
RabbitMQ Server File Desc Used
RabbitMQ Server Sockets Used
Received value [Traceback (most recent call last): File "./api.py", line 277, in main() File "./api.py", line 264, in main print api.check_shovel(filters) File "./api.py", line 131, in check_shovel for shovel in self.call_api('shovels'): File "./api.py", line 35, 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 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 404: Object Not Found] is not suitable for value type [Numeric (unsigned)] and data type [Decimal]

RabbitMQ Server File Desc Percent Used
RabbitMQ Server Memory Percent Used
RabbitMQ Server Sockets Percent Used
Cannot evaluate expression: "Cannot evaluate function "last()".".

I just did the following.

[root@rabbitmqtest01 /etc/zabbix]$python -V
Python 2.6.6

[root@rabbitmqtest01 /etc/zabbix]$rabbitmqadmin --version
rabbitmqadmin 3.6.5

[root@rabbitmqtest01 /etc/zabbix]$yum list installed |grep zabbix
zabbix-agent.x86_64 3.2.2-1.el6 @zabbix
zabbix-release.noarch 3.2-1.el6 @zabbix
zabbix-sender.x86_64 3.2.2-1.el6 @zabbix

[root@rabbitmqtest01 /etc/zabbix]$pwd
/etc/zabbix

[root@rabbitmqtest01 /etc/zabbix]$ls
scripts zabbix_agentd.conf zabbix_agentd.d

[root@rabbitmqtest01 /etc/zabbix]$cat zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=5
DebugLevel=3
EnableRemoteCommands=1
LogRemoteCommands=1
HostMetadataItem=system.uname
Hostname=rabbitmqtest01
Server=127.0.0.1,zabbixmaster
ServerActive=zabbixmaster
Include=/etc/zabbix/zabbix_agentd.d/

[root@rabbitmqtest01 /etc/zabbix]$cat zabbix_agentd.d/userparameter_rabbitmq.conf
UserParameter=rabbitmq.discovery_queues,/etc/zabbix/scripts/list_rabbit_queues.sh
UserParameter=rabbitmq.discovery_shovels,/etc/zabbix/scripts/list_rabbit_shovels.sh
UserParameter=rabbitmq.discovery_nodes,/etc/zabbix/scripts/list_rabbit_nodes.sh
UserParameter=rabbitmq[*],/etc/zabbix/scripts/rabbitmq-status.sh $1 $2 $3

[root@rabbitmqtest01 /etc/zabbix]$ls scripts/
api.py list_rabbit_nodes.sh list_rabbit_queues.sh list_rabbit_shovels.sh rabbitmq-status.sh

[root@rabbitmqtest01 /etc/zabbix]$cat scripts/.rab.auth
USERNAME=guest
PASSWORD=guest
CONF=/etc/zabbix/zabbix_agent.conf

Typo in the rabbitmq.template.xml

I believe there is a typo in the RabbitMQ template file.
Please do correct me if I'm wrong 😅.

Once I imported the template on the Zabbix server it starts to complaining about the fact that:
{Template App RabbitMQ v3:rabbitmq[queues].last()}<>0
is not supported.

Hence the fact that the .last() part is missing a parameter and the result does not check against =0.
I guess the correct expression should be:
{Template App RabbitMQ v3:rabbitmq[queues].last(0)}=0

I traced the problem back to the XML file which describes an incorrect trigger expression at line 1181.
The problem may have been caused by an earlier merge of the XML file as stated in the commit logs.
Fixing this problem could safe people, who use this template, some time (and zabbix trigger complaints) 😄.

Lastly I'd like to thank you for this great collection of templates and scripts to support Zabbix logging for the RabbitMQ broker.
It works like a charm without having to spent a huge amount of time on it.

How can i monitor a queue length?

In default userparameters of this template i don't see a item or similar userparam for getting queue messages count. I need a trigger for more than 2000 messages in all queues.

How can i do this with your module?

Cannot import template

I get errors when trying to import the template into Zabbix 2.2.7:

mb_strlen() expects parameter 1 to be string, array given [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → DB::checkValueTypes() → zbx_strlen() → mb_strlen() in /usr/share/zabbix/include/func.inc.php:955]
pg_escape_string() expects parameter 1 to be string, array given [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → DB::checkValueTypes() → zbx_dbstr() → pg_escape_string() in /usr/share/zabbix/include/db.inc.php:1242]
Array to string conversion [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → implode() in /usr/share/zabbix/include/classes/db/DB.php:450]
pg_query(): Query failed: ERROR: syntax error at or near ","
LINE 1: ...0','0','','0','','','','','0','','','','','',Array,'1','','r...
^ [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → DBexecute() → pg_query() in /usr/share/zabbix/include/db.inc.php:509]
Error in query [INSERT INTO items (name,type,snmp_community,snmp_oid,delay,status,snmpv3_contextname,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authprotocol,snmpv3_authpassphrase,snmpv3_privprotocol,snmpv3_privpassphrase,delay_flex,params,ipmi_sensor,authtype,username,password,publickey,privatekey,port,filter,lifetime,description,key
,trapper_hosts,hostid,flags,value_type,data_type,interfaceid,itemid) VALUES ('rabbitmq queues','7','','','360','0','','','0','0','','0','','','','','0','','','','','',Array,'1','','rabbitmq.discovery_queue','','10130','1','4','0',NULL,'24967')] [ERROR: syntax error at or near ","
LINE 1: ...0','0','','0','','','','','0','','','','','',Array,'1','','r...
^]
SQL statement execution has failed "INSERT INTO items (name,type,snmp_community,snmp_oid,delay,status,snmpv3_contextname,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authprotocol,snmpv3_authpassphrase,snmpv3_privprotocol,snmpv3_privpassphrase,delay_flex,params,ipmi_sensor,authtype,username,password,publickey,privatekey,port,filter,lifetime,description,key
,trapper_hosts,hostid,flags,value_type,data_type,interfaceid,itemid) VALUES ('rabbitmq queues','7','','','360','0','','','0','0','','0','','','','','0','','','','','',Array,'1','','rabbitmq.discovery_queue','','10130','1','4','0',NULL,'24967')".

Ability to set up Zabbix hostname for sender

My Zabbix agent configuration doesn't have the "Hostname" parameter, though agent relies on the system hostname. But Zabbix sender fails to work with such configuration and requires -s/--host command line option to be set.

Right now api.py doesn't allow to have such configuration without minor hacks here and there.

Template problem

Hi,
I believe there is a problem with your template. After importing it to Zabbix 2.4 all of the items where set to be type of active agent checks. In fact after reviewing your python script i realized only queues check use zabbix_sender to send data to zabbix. Only after switching all other items to passive agent checks (including discovery) it started working.

Zabbix agent (active) insted of Zabbix agent

Template contains items of type - Zabbix agent (active) - except of aliveness test which is just Zabbix Agent. I do not get values for them as long as they are 'active'.

After mass change to pure Zabbix agent type they give values back.

Is this a real issue, or I've made a mistake at the other point of configuration?

Zabbix 2.2 Monitoring RabbitMQ

Hi,

Could not find this detailed anywhere so I thought I should mention it for those who are still using an older Zabbix version.

The latest Template version do not work without editing so to make it easier for myself I used the archived 2.0.0 version of the template. This installed perfectly and everything worked except the discovered queues did not return any data.

tail -f /var/log/zabbix/rabbitmq_zabbix.log kept showing failed items
WARNING: info from server: "processed: 0; failed: 42; total: 42; seconds spent: 0.000486"

After setting the api.py to DEBUG instead of WARNING it showed me the key's sent to the zabbix_sender and I could replicate the problem manually and noticed the key in Zabbix and the key returned by the api were not the same.

This was resolved by adding .queues to the 6 x Template -> Discovery Rules -> Item Prototype -> Key
Example:
From
rabbitmq[{#VHOSTNAME},queue_message_stats_deliver_get,{#QUEUENAME}]
To
rabbitmq.queues[{#VHOSTNAME},queue_message_stats_deliver_get,{#QUEUENAME}]

Hope this helps someone :)
Alm

api.py output errors to Zabbix

Hey guys, sometimes api.py throws an error, which gets send to zabbix. For example:

Trigger: RabbitMQ Cluster partition detected
Trigger status: PROBLEM
Trigger severity: Average
Trigger URL:

Item values:

1. RabbitMQ Server Partitions (Jumplead - RabbitMQ:rabbitmq[server,partitions]): Traceback (most recent call last):
  File "./api.py", line 212, in <module>
    main()
  File "./api.py", line 207, in main
    print api.check_server(options.metric, options.node)
  File "./api.py", line 150, in check_server
    for nodeData in self.call
2. *UNKNOWN* (*UNKNOWN*:*UNKNOWN*): *UNKNOWN*
3. *UNKNOWN* (*UNKNOWN*:*UNKNOWN*): *UNKNOWN*

Unfortunately I know literally nothing about python. Is there some way this could be handed better? I'm guessing its some sort of timeout issue.

No data for dynamic items

All seems to be working, all other items (not dynamic) are working and receiving data, the host (rabbitmq) was populated with all queues available in the rabbitmq, but it didn't bring the item values for each queue. Actually, none of the dynamic itens was published in recent data. Do you have any ideias why it don't return the queue_message_stats_deliver_get and the queue_message_stats_publish?

Enable SSL

Hello,

I use SSL exclusively for my rabbitmq setup. Would it be possible to have an option to use SSL to perform API functions?

Thanks,
Erik

P.S. I've temporarily enabled HTTP for the admin to get around this and set it to listen on other interfaces to get around the other and it works fine that way. I would just like to be able to use it as I had it. Thanks for a great plugin and all your hard work!

Compatibility with rabbitmq 2.8?

Hi there,

I'm using rabbitmq-server 2.8.4 on debian. I can't seem to get queue-specific metrics to come through for the life of me; also the partition trigger does not work right. I'm thinking it's because of the (admittedly ancient) version of rabbitmq I'm using -- It seems like the management endpoints aren't doing what the script expects (although admittedly I haven't confirmed this).

Can anyone confirm that there are issues using this with 2.8 (and that I'm not doing something stupid)? If so maybe we could put a mention in the readme?

Thanks,
Colin

Template error

hello
my zabbix version is 2.4
when I imported the template, I got an error. please, help

mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:831]
mysql_real_escape_string() expects parameter 1 to be string, array given [include/db.inc.php:646]
Array to string conversion [include/classes/db/DB.php:408]
Error in query [INSERT INTO items (name,type,snmp_community,snmp_oid,delay,status,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,delay_flex,params,ipmi_sensor,authtype,username,password,publickey,privatekey,port,filter,lifetime,description,key_,trapper_hosts,hostid,flags,value_type,data_type,interfaceid,itemid) VALUES ('rabbitmq queues','7','','','360','0','','0','','','','','','0','','','','','',Array,'1','','rabbitmq.discovery_queues','','10210','1','4','0',NULL,'31802')] [Unknown column 'Array' in 'field list']
SQL statement execution has failed "INSERT INTO items (name,type,snmp_community,snmp_oid,delay,status,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,delay_flex,params,ipmi_sensor,authtype,username,password,publickey,privatekey,port,filter,lifetime,description,key_,trapper_hosts,hostid,flags,value_type,data_type,interfaceid,itemid) VALUES ('rabbitmq queues','7','','','360','0','','0','','','','','','0','','','','','',Array,'1','','rabbitmq.discovery_queues','','10210','1','4','0',NULL,'31802')".

Didn't see any graph info

Thanks for awesome template and solution for zabbix!
Have an issue - cannot see any data in graph when click on "Message rates on //".

Problem with item "RabbitMQ Check Aliveness"

Hi, thanks for this plugin - it saves a lot of my time. :)

All works fine, except item "RabbitMQ Check Aliveness"...
In some reason zabbix-agent returns traceback:

Traceback (most recent call last):
  File "./api.py", line 212, in <module>
    main()
  File "./api.py", line 201, in main
    print api.check_aliveness()
  File "./api.py", line 138, in check_aliveness
    return self.call_api('aliveness-test/%2f')['status']
  File "./api.py", line 37, 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

PS. I created .rab.auth with USERNAME and PASSWORD where set login and password of rabbitmq user.

Regular Expressions

Can you provide a sample regex (and how to name it)? I'd like to see ALL queues (we only have ~10 queues in total).

Thanks!

Count Deadlettter Messages

Hi

I would like to read data on the number open messages in the queues (to get notified if too many messages get into the deadletter queues), but I cannot find anything after importing the data. is there somehow to do it

when debugging the zabbix_sender (/rabbitmq-status.sh queues messages) I get:
zabbix_sender [12131]: DEBUG: answer [{"response":"success","info":"processed: 0; failed: 1; total: 1; seconds spent: 0.000030"}]

thx for your help

Can't import latest Zabbix template

Latest I can import is from #0f501d72fa3509103b5042a1d97f2c1ba94f7883.

Zabbix 2.2.10
PHP 5.6.16
PostgreSQL 9.4

Created: Item "RabbitMQ Server Sockets Used" on "Template App RabbitMQ v3".
Created: Item "RabbitMQ Server Version" on "Template App RabbitMQ v3".
mb_strlen() expects parameter 1 to be string, array given [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → DB::checkValueTypes() → zbx_strlen() → mb_strlen() in /usr/share/zabbix/include/func.inc.php:955]
pg_escape_string() expects parameter 1 to be string, array given [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → DB::checkValueTypes() → zbx_dbstr() → pg_escape_string() in /usr/share/zabbix/include/db.inc.php:1242]
Array to string conversion [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → implode() in /usr/share/zabbix/include/classes/db/DB.php:450]
pg_query(): Query failed: ERROR:  syntax error at or near ","
LINE 1: ...0','0','','0','','','','','0','','','','','',Array,'1','','r...
                                                             ^ [conf.import.php:130 → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CAPIObject->create() → CAPIObject->__call() → czbxrpc::call() → czbxrpc::callAPI() → call_user_func() → CDiscoveryRule->create() → CDiscoveryRule->createReal() → DB::insert() → DBexecute() → pg_query() in /usr/share/zabbix/include/db.inc.php:509]
Error in query [INSERT INTO items (name,type,snmp_community,snmp_oid,delay,status,snmpv3_contextname,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authprotocol,snmpv3_authpassphrase,snmpv3_privprotocol,snmpv3_privpassphrase,delay_flex,params,ipmi_sensor,authtype,username,password,publickey,privatekey,port,filter,lifetime,description,key_,trapper_hosts,hostid,flags,value_type,data_type,interfaceid,itemid) VALUES ('rabbitmq queues','7','','','360','0','','','0','0','','0','','','','','0','','','','','',Array,'1','','rabbitmq.discovery_queue','','10219','1','4','0',NULL,'35977')] [ERROR:  syntax error at or near ","
LINE 1: ...0','0','','0','','','','','0','','','','','',Array,'1','','r...
                                                             ^]
SQL statement execution has failed "INSERT INTO items (name,type,snmp_community,snmp_oid,delay,status,snmpv3_contextname,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authprotocol,snmpv3_authpassphrase,snmpv3_privprotocol,snmpv3_privpassphrase,delay_flex,params,ipmi_sensor,authtype,username,password,publickey,privatekey,port,filter,lifetime,description,key_,trapper_hosts,hostid,flags,value_type,data_type,interfaceid,itemid) VALUES ('rabbitmq queues','7','','','360','0','','','0','0','','0','','','','','0','','','','','',Array,'1','','rabbitmq.discovery_queue','','10219','1','4','0',NULL,'35977')".

fix node in config

TYPE_OF_CHECK=$1
METRIC=$2

if [[ $3 ]]; then
    NODE=$3
fi
if [[ -z "$HOSTNAME" ]]; then
    HOSTNAME=`hostname`
fi

part of items won't work

Hi, testing you template.
In /var/log/zabbix/rabbitmq_zabbix.log
2015-03-06 15:49:58,347 WARNING:
2015-03-06 15:50:22,478 WARNING: Sending failed. Use option -vv for more detailed output.

2015-03-06 15:50:22,478 WARNING:
2015-03-06 15:50:28,533 WARNING: Sending failed. Use option -vv for more detailed output.

2015-03-06 15:50:28,533 WARNING:
2015-03-06 15:50:28,849 WARNING: Sending failed. Use option -vv for more detailed output.

2015-03-06 15:50:28,849 WARNING:

and latest data for items such as:

rabbitmq[{#NODENAME},ab,queue_msg_unackd,[email protected]]
60 3 90 Zabbix agent - - - Graph

RabbitMQ queue_msg_unackd [email protected] {#NODENAME} (ab)
rabbitmq[{#NODENAME},ab,queue_msg_unackd,[email protected]]
60 3 90 Zabbix agent - - - Graph

RabbitMQ queue_msg_unackd [email protected] {#NODENAME} (ab)
rabbitmq[{#NODENAME},ab,queue_msg_unackd,[email protected]]
60 3 90 Zabbix agent - - - Graph

...not collected

rabbitmq-status.sh not working

First, Let me state that this is really good stuff. I believe that I have found a issue, but need to have someone else look at it for me.

I am having issues with getting the information about the queues out of the system. I have been tracing data all day, and here is what I can see. I am not sure if I have this right, but it applies to the discovery rules.

Currently, my system will query and get all the queues that are on the server.
both list_rabbit_nodes.sh and list_rabbit_queues.sh work just fine. They are reporting back to zabbix with no issues.

The issue is when it goes to pull the information from the server about the queues that are on the server.

I noticed that on one of the discovery trigger templates, rabbitmq[{#VHOSTNAME},queue_messages,{#QUEUENAME}] is used to get the messages on the queue.

This will call rabbitmq-status.sh in the directory. The issue I believe is the placing of the variables.
UserParameter=rabbitmq[*],/etc/zabbix/scripts/rabbitmq/rabbitmq-status.sh $1 $2 $3
That would put $1 = VHOST NAME, $2 = queue_messages, and $3 = the queue name.

This will then get passed to the api.py like the following:
/api.py --hostname=localhost.localdomain --username=admin --password=admin --check=vhost67.232.139.140 --metric=queue_messages --node=qi67.232.139.140radiodix --filters= --conf=/etc/zabbix/zabbix_agent.conf

Which will then return a error:

api.py: error: option --check: invalid choice: 'vhost67.232.139.140' (choose from 'list_queues', 'list_nodes', 'queues', 'check_aliveness', 'server')

First thing that I can see is that there is not check for just a vhost. Also, there is no matric for queue_messages...

Am I missing something here...

All I want to get is the number of messages in the queue and have a trigger on it when it goes over a number that we set.

"rabbitmq" dir within externalscripts

Is it possible to host the scripts in a rabbitmq (or similar) directory within Zabbix's external scripts directory? If not, could api.py be renamed? This seems likely to clash with other scripts.

template import issue

hi. i've tried to import template into zabbix-2.0 and got the error:

mb_strlen() expects parameter 1 to be string, array given [include/func.inc.php:831]
mysql_real_escape_string() expects parameter 1 to be string, array given [include/db.inc.php:646]
Array to string conversion [include/classes/db/DB.php:408]
Error in query [INSERT INTO items (name,type,snmp_community,snmp_oid,delay,status,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,delay_flex,params,ipmi_sensor,authtype,username,password,publickey,privatekey,port,filter,lifetime,description,key_,trapper_hosts,hostid,flags,value_type,data_type,interfaceid,itemid) VALUES ('rabbitmq queues','7','','','360','0','','0','','','','','','0','','','','','',Array,'1','','rabbitmq.discovery_queue','','10144','1','4','0',NULL,'27071')] [Unknown column 'Array' in 'field list']

did i do something wrong? could you please guess why it has happened?

Invalid generated items

Autodiscovery in the provided template generates items looking like rabbitmq[/,queue_messages,syslogq]

This translates to an invalid script call.

/etc/zabbix/scripts/rabbitmq/rabbitmq-status.sh / queue_messages syslogq
Usage: api.py [options]

api.py: error: option --check: invalid choice: '/' (choose from 'list_queues', 'list_nodes', 'queues', 'check_aliveness', 'server')

Add Vhost traffic monitoring

I'm getting the information from HTTP stats API /api/vhosts/ and using the recv_oct parameter for each vhost.
Sample JSON:

[
{"messages":0,
"messages_details":{"rate":0.0},
"messages_ready":0,
"messages_ready_details":{"rate":0.0},
"messages_unacknowledged":0,
"messages_unacknowledged_details":{"rate":0.0},
"recv_oct":541010,
"recv_oct_details":{"rate":0.0},
"send_oct":568580,
"send_oct_details":{"rate":0.0}
}
]

queue status not refreshing with filter set

Having set a filter in the .rab.auth file in order to specify only one queue to be monitored, the queue status is not refreshed in zabbix,
Removing the filter causes all the queues to be shown and to be updated in zabbix.
My filter is as follows :
FILTER='{"name":"mytestquename:Q"}'

Issues with RabbitMQ Refresh Rabbit Queue Status

Hey Jason,

We have previously used the older version of your scripts to monitor RabbiMQ Queues, and now we are trying to install it on a new machine with the latest version and are running into a few issues.

To start off with, here are some versions:

[Zabbix Server]
Zabbix Server: 3.0.4
OS: CentOS 7.2.1511

[Zabbix Host]
OS: CentOS 6.6 (Final)
Zabbix Agent: Zabbix Agent (daemon) v2.4.8 (revision 59539) (20 April 2016)
Zabbix Sender: Zabbix Sender v2.4.8 (revision 59539) (20 April 2016)
RabbitMQ: 3.3.5

The Refresh Rabbit Queue Status is returning code 2, and i am at a loss as to why. If i run the command directly from the agent i get a response code of 2, as well as executing the script also returning the code 2:

[user@hostname rabbitmq]$ sudo zabbix_agentd -t rabbitmq[queues]
rabbitmq[queues]                              [t|2]
[user@ hostname rabbitmq]$ sudo ./rabbitmq-status.sh queues
2

Both list_rabbit_queues.sh and rabbitmq-status.sh list_queues are returning the list of all the queues.
Zabbix is able to receive queues data and message rates. When viewing the logs however it looks like zabbix-sender is failing to send the data to the zabbix server:

[user@ hostname zabbix]$ tail -f rabbitmq_zabbix.log
2016-08-19 12:01:41,709 INFO: Found return code of 2
2016-08-19 12:01:41,710 WARNING: info from server: "processed: 0; failed: 78; total: 78; seconds spent: 0.000546"
sent: 78; skipped: 0; total: 78

When i switch the logging level to debug i can see that it is getting all the right data, but it is just not making it there:

2016-08-19 11:58:47,447 WARNING:
2016-08-19 11:58:47,485 DEBUG: Started trying to process data
2016-08-19 11:58:47,486 DEBUG: Issue a rabbit API call to get data on queues
2016-08-19 11:58:47,508 DEBUG: Filtering out by [{u'durable': True}]
2016-08-19 11:58:47,508 DEBUG: Filtering out by [{u'durable': True}]
2016-08-19 11:58:47,510 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_memory,queue_name]" 23608
2016-08-19 11:58:47,510 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_messages, queue_name]" 0
2016-08-19 11:58:47,512 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_messages_unacknowledged, queue_name]" 0
2016-08-19 11:58:47,513 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_consumers, queue_name]" 10
2016-08-19 11:58:47,513 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_message_stats_deliver_get, queue_name]" 2589422
2016-08-19 11:58:47,513 DEBUG: SENDER_DATA: - "rabbitmq.queues[/,queue_message_stats_publish, queue_name]" 1943898
***** Omitted *****
2016-08-19 11:58:47,925 DEBUG: Finished sending data
2016-08-19 11:58:47,925 INFO: Found return code of 2
2016-08-19 11:58:47,925 WARNING: info from server: "processed: 0; failed: 78; total: 78; seconds spent: 0.000545"
sent: 78; skipped: 0; total: 78

There may be something we have missed here, and if you need any further information please let me know. I would really appreciate some guidance when you have a spare moment!

Regards,

Leigh

Documentation on what an item/trigger means

Would it be possible to have a description of items and triggers in the template? There are several things I don't understand, especially the "RabbitMQ Refresh Rabbit Queue Status" which triggered the "Queue data status issue" trigger.

This was always 0 but went to 1 for a second, before switching back to 0. What does it mean when it is in 1?

check_aliveness check isn't passing

Hello Jason!

I wonder if I'm doing something wrong... Can't pass aliveness check however list queues passing well:

python api.py --username=admin --password=mypass --check=list_queues

{"data": []}

python api.py --username=admin --password=mypass --check=check_aliveness

Traceback (most recent call last):
File "rabbitmq-api.py", line 209, in
main()
File "api.py", line 198, in main
print api.check_aliveness()
File "api.py", line 137, in check_aliveness
return self.call_api('aliveness-test/%2f')['status']
File "api.py", line 36, in call_api
return json.loads(urllib2.build_opener(handler).open(url).read())
File "/usr/lib/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 442, in error
result = self._call_chain(_args)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(_args)
File "/usr/lib/python2.7/urllib2.py", line 897, in http_error_401
url, req, headers)
File "/usr/lib/python2.7/urllib2.py", line 872, in http_error_auth_reqed
response = self.retry_http_basic_auth(host, req, realm)
File "/usr/lib/python2.7/urllib2.py", line 885, in retry_http_basic_auth
return self.parent.open(req, timeout=req.timeout)
File "/usr/lib/python2.7/urllib2.py", line 410, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 523, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 448, in error
return self._call_chain(_args)
File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(_args)
File "/usr/lib/python2.7/urllib2.py", line 531, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 401: Unauthorized

P.S. I'm using last revision from master.

Update filters to allow "excludes" and not just "include only"

Right now the filters allow one to say "Only include X". I'd like to allow an "exclude anything matching X" - this would handle the aliveness-test case. I MIGHT be able to do this with 2.4 and a regular expression system though. Not sure yet which is the best place.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.