Zabbix-Network-Weathermap icon indicating copy to clipboard operation
Zabbix-Network-Weathermap copied to clipboard

Does it work with Zabbix 3.2?

Open mcules opened this issue 8 years ago • 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

mcules avatar Jun 18 '17 12:06 mcules

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

Prototype-X avatar Jun 18 '17 15:06 Prototype-X

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

mcules avatar Jun 18 '17 15:06 mcules

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

Prototype-X avatar Jun 18 '17 17:06 Prototype-X

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

mcules avatar Jun 18 '17 17:06 mcules

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

Prototype-X avatar Jun 18 '17 17:06 Prototype-X

Done but same behaivor

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

mcules avatar Jun 18 '17 17:06 mcules

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

Prototype-X avatar Jun 18 '17 18:06 Prototype-X

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

mcules avatar Jun 18 '17 18:06 mcules

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

Prototype-X avatar Jun 18 '17 18:06 Prototype-X

No, nothing like that.

mcules avatar Jun 18 '17 18:06 mcules

Can you have access to this page http://your-zabbix-server/api_jsonrpc.php? https://www.zabbix.com/documentation/3.2/manual/api

Prototype-X avatar Jun 18 '17 19:06 Prototype-X

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}

mcules avatar Jun 18 '17 19:06 mcules

Zabbix server hosted on cloudfare? https://stackoverflow.com/questions/28396036/python-3-4-urllib-request-error-http-403

Prototype-X avatar Jun 18 '17 19:06 Prototype-X

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

mcules avatar Jun 18 '17 20:06 mcules

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

mcules avatar Jun 18 '17 20:06 mcules

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

Prototype-X avatar Jun 18 '17 20:06 Prototype-X