qk4l / zabbix-cachet

Python script which sync Zabbix IT Services with Cachet
MIT License
80 stars 32 forks source link

Acknowledged not working :( #36

Closed romainsi closed 6 years ago

romainsi commented 6 years ago

Hi,

First of all, thanks for this script.

So, synchronization works correctly, error triggers generate the event in Cachet, but when it's automatically acknowledged in the trigger ("Event Generation OK" by expression) I've the following error :

Exception in thread Trigger Watcher: Traceback (most recent call last): File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner self.run() File "/usr/lib/python3.4/threading.py", line 868, in run self._target(*self._args, self._kwargs) File "/usr/bin/zabbix-cachet", line 595, in triggers_watcher_worker triggers_watcher(service_map) File "/usr/bin/zabbix-cachet", line 511, in triggers_watcher message=inc_msg) File "/usr/bin/zabbix-cachet", line 454, in upd_incident data = self._http_put(url, params) File "/usr/bin/zabbix-cachet", line 251, in _http_put r = requests.put(url=url, json=params, headers=self.headers, verify=self.verify) File "/usr/lib/python3/dist-packages/requests/api.py", line 99, in put return request('put', url, data=data, kwargs) File "/usr/lib/python3/dist-packages/requests/api.py", line 44, in request return session.request(method=method, url=url, **kwargs) TypeError: request() got an unexpected keyword argument 'json'

With log in debug I see the trigger in resolve :

} 2018-05-22 15:27:48 CEST DEBUG: (Trigger Watcher) Sending to http://0.0.0.0/api/v1/incidents/7: { "component_id": 91, "message": "Resolved - May 22, 15:27\n\n__\nLIAISONS Si\u00e8ges | TESTPING check failed - May 22, 15:15\n\nN'est pas disponible par ICMP", "status": 4, "component_status": 1 }

I tested creating a new trigger that is not acknowledged automatically and when I manually acknowledged (with a message) in Zabbix, I get the same error. I modified the trigger associated with the service and restart a synchronization before my tests.

Cachet v2.3.14 Zabbix v3.4.9 (Maybe that's where the problem is)

Thanks in advance.

qk4l commented 6 years ago

Hi, Could you please provide version of your request library?

json argument is supported since request 2.4.2 https://github.com/requests/requests/commit/8f17741849edb5e7eba0356f90cb17e43c938a2f

File "/usr/lib/python3/dist-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, **kwargs)
TypeError: request() got an unexpected keyword argument 'json'
romainsi commented 6 years ago

Hi,

Thank you, It's works !

I post the info for others who might have the problem :

On Ubuntu 14.04 Zabbix Appliance (where I launch the script) :

apt-get install python-pip pip3 install requests --upgrade