Prototype-X / Zabbix-Network-Weathermap

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

Error after changing zabbix frontend to https #33

Open psmartins opened 6 years ago

psmartins commented 6 years ago

Hello Prototype-X.

After I change the frontend from my zabbix to https the map stopped working and in the items in the Template Weathermap the following errors appear:

Value "Traceback (most recent call last): File "/opt/zabbix/mapas_wheatermap_zabbix/weathermap.py", line 121, in main () File "/opt/zabbix/mapas_wheatermap_zabbix/weathermap.py", line 118, in main WeathermapCLI () File "/opt/zabbix/mapas_wheatermap_zabbix/weathermap.py", line 55, in init self._map_scan () File "/opt/zabbix/mapas_wheatermap_zabbix/weathermap.py", line 70, in _map_scan scan_map.check_map (self.cfg_path) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 341, in check_map self._compare (old_cfg_path_fn) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 345, in _compare self.cfg_loader_obj = ConfigLoader (old_cfg_path_file) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 52, in init self.load (path_cfg) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 63, in load self.cfg_dict ['zabbix'] ['password']) File "/opt/zabbix/mapas_wheatermap_zabbix/zabbix.py", line 23, in init self.zbx_api = ZabbixAPI (url = url, use_authenticate = False, user = login, password = password) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 156, in init self._login (user, password) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 186, in _login self.auth = self.user.login (user = user, password = password) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 82, in fn args or kwargs File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 236, in do_request res = urlopen (req) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 107, in inner res = func (req, context = ctx) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 118, in urlopen return urllib2.urlopen (* args, ** kwargs) File "/usr/lib64/python3.4/urllib/request.py", line 161, in urlopen return opener.open (url, date, timeout) File "/usr/lib64/python3.4/urllib/request.py", line 470, in open response = meth (req, response) File "/usr/lib64/python3.4/urllib/request.py", line 5

Would you help me ?

Thank you

psmartins commented 6 years ago

Note,

A self-signed certificate is being used on https

Prototype-X commented 6 years ago

Hi, I dont see error in output. This is full output? https://letsencrypt.org - issues free ssl certificates.

psmartins commented 6 years ago

See below:

server:/opt/zabbix/mapas_wheatermap_zabbix/mapcfgs # ../weathermap.py -s Panorama_do_Trafico -z https://127.0.0.1 -l user -p password Traceback (most recent call last): File "/usr/lib64/python3.4/urllib/request.py", line 1183, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/usr/lib64/python3.4/http/client.py", line 1137, in request self._send_request(method, url, body, headers) File "/usr/lib64/python3.4/http/client.py", line 1182, in _send_request self.endheaders(body) File "/usr/lib64/python3.4/http/client.py", line 1133, in endheaders self._send_output(message_body) File "/usr/lib64/python3.4/http/client.py", line 963, in _send_output self.send(msg) File "/usr/lib64/python3.4/http/client.py", line 898, in send self.connect() File "/usr/lib64/python3.4/http/client.py", line 1279, in connect super().connect() File "/usr/lib64/python3.4/http/client.py", line 871, in connect self.timeout, self.source_address) File "/usr/lib64/python3.4/socket.py", line 498, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File "/usr/lib64/python3.4/socket.py", line 537, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Name or service not known

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 70, in _map_scan scan_map.check_map(self.cfg_path) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 341, in check_map self._compare(old_cfg_path_fn) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 345, in _compare self.cfg_loader_obj = ConfigLoader(old_cfg_path_file) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 52, in init self.load(path_cfg) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 63, in load self.cfg_dict['zabbix']['password']) File "/opt/zabbix/mapas_wheatermap_zabbix/zabbix.py", line 23, in init self.zbx_api = ZabbixAPI(url=url, use_authenticate=False, user=login, password=password) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 156, in init self._login(user, password) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 186, in _login self.auth = self.user.login(user=user, password=password) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 82, in fn args or kwargs File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 236, in do_request res = urlopen(req) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 107, in inner res = func(req, context=ctx) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 118, in urlopen return urllib2.urlopen(*args, *kwargs) File "/usr/lib64/python3.4/urllib/request.py", line 161, in urlopen return opener.open(url, data, timeout) File "/usr/lib64/python3.4/urllib/request.py", line 470, in open response = meth(req, response) File "/usr/lib64/python3.4/urllib/request.py", line 580, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib64/python3.4/urllib/request.py", line 502, in error result = self._call_chain(args) File "/usr/lib64/python3.4/urllib/request.py", line 442, in _call_chain result = func(args) File "/usr/lib64/python3.4/urllib/request.py", line 685, in http_error_302 return self.parent.open(new, timeout=req.timeout) File "/usr/lib64/python3.4/urllib/request.py", line 464, in open response = self._open(req, data) File "/usr/lib64/python3.4/urllib/request.py", line 482, in _open '_open', req) File "/usr/lib64/python3.4/urllib/request.py", line 442, in _call_chain result = func(args) File "/usr/lib64/python3.4/urllib/request.py", line 1226, in https_open context=self._context, check_hostname=self._check_hostname) File "/usr/lib64/python3.4/urllib/request.py", line 1185, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>

Prototype-X commented 6 years ago

Try wget https://127.0.0.1 It works? Try replace 127.0.0.1 by localhost

Prototype-X commented 6 years ago

https://stackoverflow.com/questions/30771975/python-urllib2-error-name-or-server-not-known

psmartins commented 6 years ago

Hello Prototype-X

I still have the problem on my map. Do you have any idea what might be happening? See the error below:

muttley:/opt/zabbix/mapas_wheatermap_zabbix/mapcfgs # ../weathermap.py -s Panorama_do_Trafico_UFU -z https://localhost -l user -p password 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 70, in _map_scan scan_map.check_map(self.cfg_path) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 341, in check_map self._compare(old_cfg_path_fn) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 345, in _compare self.cfg_loader_obj = ConfigLoader(old_cfg_path_file) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 52, in init self.load(path_cfg) File "/opt/zabbix/mapas_wheatermap_zabbix/config.py", line 63, in load self.cfg_dict['zabbix']['password']) File "/opt/zabbix/mapas_wheatermap_zabbix/zabbix.py", line 23, in init self.zbx_api = ZabbixAPI(url=url, use_authenticate=False, user=login, password=password) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 156, in init self._login(user, password) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 186, in _login self.auth = self.user.login(user=user, password=password) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 82, in fn args or kwargs File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 236, in do_request res = urlopen(req) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 107, in inner res = func(req, context=ctx) File "/usr/lib/python3.4/site-packages/pyzabbix/api.py", line 118, in urlopen return urllib2.urlopen(*args, *kwargs) File "/usr/lib64/python3.4/urllib/request.py", line 161, in urlopen return opener.open(url, data, timeout) File "/usr/lib64/python3.4/urllib/request.py", line 470, in open response = meth(req, response) File "/usr/lib64/python3.4/urllib/request.py", line 580, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib64/python3.4/urllib/request.py", line 502, in error result = self._call_chain(args) File "/usr/lib64/python3.4/urllib/request.py", line 442, in _call_chain result = func(args) File "/usr/lib64/python3.4/urllib/request.py", line 685, in http_error_302 return self.parent.open(new, timeout=req.timeout) File "/usr/lib64/python3.4/urllib/request.py", line 470, in open response = meth(req, response) File "/usr/lib64/python3.4/urllib/request.py", line 580, in http_response 'http', request, response, code, msg, hdrs) File "/usr/lib64/python3.4/urllib/request.py", line 508, in error return self._call_chain(args) File "/usr/lib64/python3.4/urllib/request.py", line 442, in _call_chain result = func(*args) File "/usr/lib64/python3.4/urllib/request.py", line 588, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 412: Precondition Failed

Prototype-X commented 6 years ago

Google.com http error 412 precondition failed

psmartins commented 6 years ago

Thank you