Zabbix integration - how to acknowledge
Asked by Fabian:

Hi,

I am pretty new to this an I hope someone can help me out here..

I have a new Zabbix 5.0 Server and get notifications from zabbix to opsgenie via the integrated webhook. I used this instructions: <https://www.zabbix.com/documentation/current/manual/config/notifications/media/webhook/opsgenie>

It works, but I don't know how to get the revese way working. I want the problem in zabbix to be acknowledged when I acknowledge it in opsgenie. In the activity log I don't see any action bringing this information back to the zabbix server.

Many thanks in advance

Fabian


Answers:
author: Chris Forkner
body: For those coming here from Google, the script from the RPM for Zabbix is missing a parameter for the acknowledge API command to Zabbix.

```
 post_params = {
  "jsonrpc": "2.0",
  "id": 1,
  "method": "event.acknowledge",
  "params": {
    "eventids": queue_message["alert"]["details"]["eventId"],
    "message": "Acknowledged by " + alert_response.json()['data']['report'][
        'acknowledgedBy'] + " via Opsgenie"
  }
}
```

<br />

Needs the "action": 6, line added

```
 post_params = {
  "jsonrpc": "2.0",
  "id": 1,
  "method": "event.acknowledge",
  "params": {
    "eventids": queue_message["alert"]["details"]["eventId"],
    "action": 6,
    "message": "Acknowledged by " + alert_response.json()['data']['report'][
        'acknowledgedBy'] + " via Opsgenie"
  }
}
```

Once we added this, the acknowledge worked as expected.


author: Samir
body: Hi [@Fabian](/t5/user/viewprofilepage/user-id/3921909) ,

This requires you to configure Opsgenie Edge Connector (OEC) in order to send actions back to Zabbix from Opsgenie. OEC is part of the plugin that you install from the [zabbix integration doc .](https://docs.opsgenie.com/docs/zabbix-plugin#opsgenie-plugin-configuration-in-zabbix-for-zabbix-version-32-and-above)

The Opsgenie -\> Zabbix communication is only available on Standard and Enterprise plans.

So you can follow the steps in [this section](https://docs.opsgenie.com/docs/zabbix-plugin#configure-opsgenie-to-zabbix-integration-optional)which covers how to setup the Opsgenie -\> Zabbix part via OEC.

Hope that helps!

Thanks,

Samir

comments: author: Fabian
body: Hi Samir,

thanks for the tip. We have the Standard plan and I did everything in the documentation. In the logs on the zabbix server I can see that something is happening when i acknowledge a problem in opsgenie.

Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: #033\[37mDEBUG#033\[0m\[2020-06-05T15:11:43.465693047+02:00\] Action\[Acknowledge\] execution of message\[ed50a287-50fc-4f25-b61a-a4d6bd574ee6\] with entityId\[65de72c7-69d6-46f7-9291-d1057e2aad33-1591362686944\] failed: exit status 1 Stderr: Traceback (most recent call last):  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: File "/home/opsgenie/oec/scripts/actionExecutorForZabbix4.py", line 138, in \<module\>  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: main()  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: File "/home/opsgenie/oec/scripts/actionExecutorForZabbix4.py", line 115, in main  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: auth = login_to_zabbix(username, password, url)  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: File "/home/opsgenie/oec/scripts/actionExecutorForZabbix4.py", line 55, in login_to_zabbix  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: logging.debug(LOG_PREFIX + " login response: " + str(login_result.status_code) + " " + str(login_result.json()))  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 898, in json  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: return complexjson.loads(self.text, \*\*kwargs)  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: return _default_decoder.decode(s)  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: obj, end = self.raw_decode(s, idx=_w(s, 0).end())  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: raise JSONDecodeError("Expecting value", s, err.value) from None  
Jun 5 15:11:43 zabbix OpsgenieEdgeConnector\[14059\]: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

My /home/opsgenie/oec/conf/config.json looks like this:

{  
"apiKey": "xxxxxx",  
"baseUrl": "<https://api.eu.opsgenie.com>",  
"logLevel": "DEBUG",  
"globalArgs": \[\],  
"globalFlags": {  
"command_url": "<https://mydomain.com/zabbix/api_jsonrpc.php>",  
"user": "opsgenie",  
"password": "xxxxx"  
},  
"actionMappings": {  
"Acknowledge": {  
"filepath": "/home/opsgenie/oec/scripts/actionExecutorForZabbix4.py",  
"sourceType": "local",  
"environmentVariables": \[\],  
"stdout": "/home/opsgenie/oec/output/output.txt"  
}  
},  
"pollerConf": {  
"pollingWaitIntervalInMillis": 100,  
"visibilityTimeoutInSec": 30,  
"maxNumberOfMessages": 10  
},  
"poolConf": {  
"maxNumberOfWorker": 12,  
"minNumberOfWorker": 4,  
"monitoringPeriodInMillis": 15000,  
"keepAliveTimeInMillis": 6000,  
"queueSize": 0  
}  
}

Can you help me? I have no clue what to do with the logs..


author: Samir
body: Hi [@Fabian](/t5/user/viewprofilepage/user-id/3921909) - Can you come into support via the in-app chat (blue bubble in bottom right of screen when logged into OG) or submitting a ticket through getsupport.atlassian.com and we'll be able to work with you.

Thanks,

Samir


Tags: zabbix