Closed darksmoke closed 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.
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
./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
Protocol is http or https, not the data you're trying to get.
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