Prototype-X / Zabbix-Network-Weathermap

Network weathermap for Zabbix
GNU General Public License v3.0
88 stars 38 forks source link

config issues on Create file with map configuration #9

Closed crazychengmm closed 1 year ago

crazychengmm commented 7 years ago

Hi i hava stucked on this,can you help me. Thanks

weathermap.py -s mapname1 mapnameN -z http://zabbix.example.com -l admin -p admin (has changed the parameta)

Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/pyzabbix/api.py", line 238, in do_request res_json = json.loads(res_str) File "/usr/lib/python3.4/json/init.py", line 318, in loads return _default_decoder.decode(s) File "/usr/lib/python3.4/json/decoder.py", line 343, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.4/json/decoder.py", line 361, in raw_decode raise ValueError(errmsg("Expecting value", s, err.value)) from None ValueError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

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 240, in do_request raise ZabbixAPIException("Unable to parse json: %s" % e.message) AttributeError: 'ValueError' object has no attribute 'message'

zabbix:3.2 os:debian 8.5 python:3.4

crazychengmm commented 7 years ago

check the source, found the url problem, thanks.

Prototype-X commented 7 years ago

Hi, make sure the zabbix API works, run this and show me output.

curl -i -X POST -H 'Content-Type: application/json-rpc' -d '{"jsonrpc": "2.0", "method": "apiinfo.version", "id": 1, "params": {}}' http://zabbix.example.com/api_jsonrpc.php

My output:

HTTP/1.1 200 OK Date: Thu, 17 Nov 2016 16:58:59 GMT Server: Apache/2.4.18 (Ubuntu) Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Content-Type Access-Control-Allow-Methods: POST Access-Control-Max-Age: 1000 Content-Length: 125 Content-Type: application/json

{"jsonrpc":"2.0","result":"3.0.5","id":1}

Zabbix API

crazychengmm commented 7 years ago

It's work for me. zabbix.ZbxException: map: example not found --->Have you created the map already?

2017-05-19 18:19 GMT+08:00 ash-of-time notifications@github.com:

Hi! I'm using Zabbix 3.2.4 and have a problem with creating map by weathermap.py.

[zabbix Zabbix-Network-Weathermap]# ./weathermap.py -s example -z http://zabbix.dmz -l -p 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 67, in _map_scan map_data = zbx.scan_map(map_n) File "/opt/Zabbix-Network-Weathermap/zabbix.py", line 76, in scan_map raise ZbxException('map: {} not found'.format(map_name)) zabbix.ZbxException: map: example not found

Is it working with version 3.2?

P.S. [zabbix Zabbix-Network-Weathermap]# curl -i -X POST -H 'Content-Type: application/json-rpc' -d '{"jsonrpc": "2.0", "method": "apiinfo.version", "id": 1, "params": {}}' http://zabbix.dmz/api_jsonrpc.php HTTP/1.1 200 OK Date: Fri, 19 May 2017 09:20:15 GMT Server: Apache/2.4.10 (Debian) Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Content-Type Access-Control-Allow-Methods: POST Access-Control-Max-Age: 1000 Content-Length: 41 Content-Type: application/json

{"jsonrpc":"2.0","result":"3.2.4","id":1}

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Prototype-X/Zabbix-Network-Weathermap/issues/9#issuecomment-302666237, or mute the thread https://github.com/notifications/unsubscribe-auth/AWbZZmrGQBxFv8WCzH37YUSDN3i8qyymks5r7WyfgaJpZM4K07OH .