jasonmcintosh / rabbitmq-zabbix

Zabbix RabbitMQ Configuration
Apache License 2.0
251 stars 168 forks source link

Received value [Traceback (most recent call last) #90

Closed darksmoke closed 6 years ago

darksmoke commented 6 years ago

good afternoon I get an error in Zabbix

Received value [Traceback (most recent call last): File "./api.py", line 285, in <module> main() File "./api.py", line 280, in main print api.check_server(options.metric, options.node) File "./api.py", line 217, in check_server nodeInfo = self.call_api('nodes') File "./api.py", line 37, 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 401: Unauthorized] is not suitable for value type [Numeric (unsigned)] and data type [Decimal]

but

curl -u user:pass http://localhost:15672/api/aliveness-test/%2F {"status":"ok"}

python -V Python 2.7.5

jasonmcintosh commented 6 years ago

You're getting a HTTP Error 401: Unauthorized Which means you don't have authentication setup in the configuration files for the api calls. OR the user you're using doesn't have access. Also caution - guest users can only access from localhost, not remote or over the external interfaces of the host machine.

darksmoke commented 6 years ago

The user has administrator rights to all virtual hosts.

I found all the queues. But the data on the queues does not show.

USERNAME=user PASSWORD=pass CONF=/opt/zabbix/etc/zabbix_agentd.conf LOGLEVEL=INFO LOGFILE=/opt/zabbix/log/rabbitmq_zabbix.log PORT=15672

in log: INFO: Found return code of 127

darksmoke commented 6 years ago

./api.py --username=user --password=pass --check=list_queues --filter= --conf=/opt/zabbix/etc/zabbix_agentd.conf --hostname=hostname --node=node --loglevel=DEBUG --logfile=/opt/zabbix/log/rabbitmq_zabbix.log --port=15672 --protocol={"data": [{"{#VHOSTNAME}": "/", "{#QUEUENAME}": "Acc", "{#NODENAME}": "rabbit@node"}, {"{#VHOSTNAME}": "/", "{#QUEUENAME}": "Balance", "{#NODENAME}": "rabbit@node"}, {"{#VHOSTNAME}": "/", "{#QUEUENAME}": "queue", "{#NODENAME}": "rabbit@node"}, {"{#VHOSTNAME}": "/", "{#QUEUENAME}": "queue", "{#NODENAME}": "rabbit@node"}, {"{#VHOSTNAME}": "/", "{#QUEUENAME}": "queue"}]} Traceback (most recent call last): File "./api.py", line 285, in main() File "./api.py", line 264, in main print json.dumps({'data': api.list_queues(filters)}) File "./api.py", line 47, in list_queues for queue in self.call_api('queues'): File "./api.py", line 37, in call_api return json.loads(urllib2.build_opener(handler).open(url).read()) File "/usr/lib64/python2.7/urllib2.py", line 431, in open response = self._open(req, data) File "/usr/lib64/python2.7/urllib2.py", line 454, in _open 'unknown_open', req) File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain result = func(*args) File "/usr/lib64/python2.7/urllib2.py", line 1283, in unknown_open raise URLError('unknown url type: %s' % type) urllib2.URLError: <urlopen error unknown url type: {data>

jasonmcintosh commented 6 years ago

Protocol is http or https, not the data you're trying to get.