N
N
Nikolay Baranenko2017-09-03 13:14:59
Monitoring
Nikolay Baranenko, 2017-09-03 13:14:59

Why can't connect to zabbix api?

Hello.
Installed Zabbix 3.4 a few days ago
Decided to use Zabbix API via python
installed python module

C:\Windows\system32>pip install zabbix_api
Collecting zabbix_api
  Downloading zabbix-api-0.4.tar.gz
Installing collected packages: zabbix-api
  Running setup.py install for zabbix-api ... done
Successfully installed zabbix-api-0.4

C:\Windows\system32>pip install py-zabbix
Collecting py-zabbix
  Downloading py_zabbix-1.1.3-py2.py3-none-any.whl
Installing collected packages: py-zabbix
Successfully installed py-zabbix-1.1.3

C:\Windows\system32>pip install zabbix-api
Requirement already satisfied: zabbix-api in c:\python36\lib\site-packages

wrote this code
from zabbix_api import ZabbixAPI
zapi = ZabbixAPI(server="http://192.168.0.50/zabbix")
zapi.login("Admin", "zabbix")
zapi.trigger.get({"expandExpression": "extend", "triggerids": range(0, 100)})

an error is returned that the URL cannot be found
File "C:\Python36\lib\urllib\request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

tried other url options
http://192.168.0.50
http://192.168.0.50/zabbix/api_jsonrpc.php

The user is the same admin.
the same error is returned,
How can this problem be solved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Talik, 2017-09-05
@Talik0507

1. URL for connection should be like
" http://IP(or DNS name)/zabbix/api_jsonrpc.php";
2. The error explicitly indicates that the requested resource is not available.
what OS is zabbix on? check access rules (firewalld or firewall (windows)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question