Zabbix API returns nothing?

Hello. Try to reach the Zabbix API from python. And the response from the server get... nothing.


Trying to work through Python modules for zabbix API. Used 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 you get an empty list. Thus, if you intentionally make a mistake in the registration data of the user with access to the API, I get this error. If you log in as a valid user without API access, I receive an error about the unavailability of the API.


Show the example module from the second of my links, but at first all the same, will have to take on trust.


Here's 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


CANT?
October 8th 19 at 03:06
2 answers
October 8th 19 at 03:08
I am from PHP worked with Zabbix API, but it may be the case that you want to get a list of hosts and do not specify a filter?
Try to include the filter name to get one host to start with.
October 8th 19 at 03:10
I think it is not true, but just in case answer: the user under which you are trying to login has no rights to use the APIs. In the settings users need to put a tick.

Find more questions by tags APIZabbix