D
D
Denis2012-02-21 11:58:12
API
Denis, 2012-02-21 11:58:12

Zabbix API returns empty?

Hello. I'm trying to reach Zabbix API from python. And in response from the server I get ... emptiness.
I'm trying to work through python modules for zabbix API. Used both https://github.com/gescheit/scripts/tree/master/zabbix and https://github.com/lukecyca/pyzabbix/wiki/ . The result is the same. In response to any request, I get an empty list. At the same time, if I intentionally “make a mistake” in the registration data of a user with access to the API, I get an error. If I log in as a valid user without access to the API, I get an error about the unavailability of the API.
I show on the example of the module from my second link, but on the first one everything is the same, you have to take my word for it.
Here is an example:
>>> from pyzabbix import ZabbixAPI
>>> zapi = ZabbixAPI("zabbix.lo/zabbix ")
>>> zapi.login("zapi", "zapipass")
>>> print "Connected to Zabbix API Version %s" % zapi.api_version()
Connected to Zabbix API Version 1.3
>>> for h in zapi.host.get(extendoutput=True):
... print h['host']
...
>>> zapi.host.get(extendoutput=True)
[]
>>> zapi.login("na", " npass")
>>> print "Connected to Zabbix API Version %s" % zapi.api_version()
Traceback (most recent call last):
BLA-BLA-BLA
pyzabbix.ZabbixAPIException: ('Error -32602: Invalid params., No API access while sending {"params": {}, "jsonrpc": "2.0", "method": "APIInfo.version", "auth":"5322d682ab6c1b415fb064a77320f67f", "id": 6}', -32602)
Zabbix 1.8.10
WHAT?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladislav Ross, 2012-02-22
@gag_fenix

I myself worked with Zabbix API from PHP, but maybe the fact is that you want to get a list of hosts and do not specify a filter?
Try enabling filter by name and get one host to start with.

P
p1nger, 2012-11-12
@p1nger

I think it is no longer relevant, but just in case I will answer: The user under which you are trying to log in does not have rights to use the API. Check the box in user settings.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question