Prototype-X/Zabbix-Network-Weathermap

Does it work with Zabbix 3.2?

mcules opened this issue · 16 comments

When i try to install with Zabbix 3.2 i get an error:

Traceback (most recent call last):
File "./weathermap.py", line 121, in
main()
File "./weathermap.py", line 118, in main
WeathermapCLI()
File "./weathermap.py", line 55, in init
self._map_scan()
File "./weathermap.py", line 66, in _map_scan
zbx = ZabbixAgent(self.args.zabbix, self.args.login, self.args.pwd)
File "/opt/Zabbix-Network-Weathermap/zabbix.py", line 23, in init
self.zbx_api = ZabbixAPI(url=url, use_authenticate=False, user=login, password=password)
File "/usr/local/lib/python3.4/dist-packages/pyzabbix/api.py", line 156, in init
self._login(user, password)
File "/usr/local/lib/python3.4/dist-packages/pyzabbix/api.py", line 186, in _login
self.auth = self.user.login(user=user, password=password)
File "/usr/local/lib/python3.4/dist-packages/pyzabbix/api.py", line 83, in fn
)['result']
File "/usr/local/lib/python3.4/dist-packages/pyzabbix/api.py", line 236, in do_request
res = urlopen(req)
File "/usr/local/lib/python3.4/dist-packages/pyzabbix/api.py", line 109, in inner
res = func(req)
File "/usr/local/lib/python3.4/dist-packages/pyzabbix/api.py", line 118, in urlopen
return urllib2.urlopen(*args, **kwargs)
File "/usr/lib/python3.4/urllib/request.py", line 153, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.4/urllib/request.py", line 461, in open
response = meth(req, response)
File "/usr/lib/python3.4/urllib/request.py", line 571, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.4/urllib/request.py", line 499, in error
return self._call_chain(*args)
File "/usr/lib/python3.4/urllib/request.py", line 433, in _call_chain
result = func(*args)
File "/usr/lib/python3.4/urllib/request.py", line 579, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

Yes it work.
HTTP Error 403.
Check login, password.

The credentials are correct. Was my first thought.
Thought its related to the api maybe?

show me output:
pip3 show py-zabbix
pip3 show urllib3
python3 -V

pip3 show py-zabbix
Name: py-zabbix
Version: 1.1.3
Location: /usr/local/lib/python3.4/dist-packages
Requires:

pip3 show urllib3
Name: urllib3
Version: 1.9.1
Location: /usr/lib/python3/dist-packages
Requires:

python3 -V
Python 3.4.2

Update urllib3 and try again.
sudo pip3 install urllib3==1.21.1

Done but same behaivor

Name: urllib3
Version: 1.21.1
Location: /usr/local/lib/python3.4/dist-packages
Requires:

Can you login into web interface of zabbix with login and password for weathermap?

Yes, i tried with my normal user.
Thats working fine.

Do you use auth_basic or .htpasswd to access the web interface?

No, nothing like that.

Tested via curl:

HTTP/1.1 200 OK
Date: Sun, 18 Jun 2017 19:49:23 GMT
Content-Type: application/json
Content-Length: 68
Connection: keep-alive
Set-Cookie: __cfduid=d83774017b1cbceec47f1041fd8a1b1497815363; expires=Mon, 18-Jun-18 19:49:23 GMT; path=/; domain=.itstall.de; HttpOnly
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type
Access-Control-Allow-Methods: POST
Access-Control-Max-Age: 1000
Server: cloudflare-nginx
CF-RAY: 3710c587aa876367-FRA

{"jsonrpc":"2.0","result":"6bff60845e59114b1fa0a552e93ea","id":1}

Youre right, that depends on Cloudflare.
The server is not hosted there but the ip is rewriten there and ssl terminated.

i cant find the urllib.request in your'e Project, where i have to change it?

I use py-zabbix library.

  1. You can write author about your trouble.
  2. Fix library and install it: python3 setup.py install

https://github.com/blacked/py-zabbix - project
https://github.com/blacked/py-zabbix/blob/master/pyzabbix/api.py - file where urllib.request at line: 119, 239