Opsgenie CheckMK integration is not working

CMK version: Enterprise Checkmk 1.6.0p13
OS version:
Error message: No error messages received. But alerts are not received in Opsgenie
Output of “cmk --debug -vvn hostname”: (If it is a problem with checks or plugins)

Relevant lines from /var/log/notify.log

2022-05-26 08:36:36 Got raw notification (xxxxxxxxxxxx) context with 71 variables
2022-05-26 08:36:36 Global rule 'Opsgenie'...
2022-05-26 08:36:36  -> matches!
2022-05-26 08:36:36    - adding notification of <xxxxxxx> via opsgenie
Executing 2 notifications:
2022-05-26 08:36:36   * notifying <xxxxxxx>  via opsgenie, parameters: https://api.eu.opsgenie.com/v1/json/checkmk?apiKey=<xxxxxxxxxxxxxx>, bulk: no
2022-05-26 08:36:36 Creating spoolfile: /omd/sites/xxxxxx/var/check_mk/notify/spool/6aa3bdef-xxxxxxxxxxxxxxxxxx

2022-05-26 08:36:40 Got spool file 6aa3bdef (xxxxxxxxxxxxxxxxxxx) for local delivery via opsgenie
2022-05-26 08:36:40  executing /omd/sites/xxxxxx/local/share/check_mk/notifications/opsgenie

I followed the below document

/omd/sites/xxxxxx/local/share/check_mk/notifications/opsgenie

~/local ? Have you modified this? Ideally, the official ones from Checkmk are under ~/share/check_mk/

BTW, you can follow this Notifications via Opsgenie

I didn’t modify anything on ~/share/check_mk/ instead I put the plugin under /omd/sites/xxxxxx/local/share/check_mk/notifications/. From notify logs it shows that the script executed but not receiving alerts in opsgenie

Try using the official plugin from Checkmk which should be under ```
/omd/sites/xxxxxx/share/check_mk/notifications/opsgenie

I put the plugin under /omd/sites/xxxxxx/share/check_mk/notifications/ same result. It is not working. Can someone share with me a working plugin?

we replaced that script by the same version in powershell (2.1) and it works just fine, so if you install powershell on your checkmk server, I can share the script.

The rest of the setup is the same, just replace the content of the script

I modified the script and got the below error

requests.exceptions.SSLError: HTTPSConnectionPool(host='api.eu.opsgenie.com', port=443): Max retries exceeded with url: /v1/json/checkmk?apiKey=xxxxxxxxxxxxxxxxxxx(Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)'),)) 

Does anyone know which certificate I need to provide? I can’t use solutions like verify=False

@robin.gierse I have opened a thread here. When I run the script in the server with dummy data it is working fine.While putting the script under /omd/sites/xxxxxx/local/share/check_mk/notifications/ it is not working and throws the error

#!/usr/bin/env python3
# OpsGenie_integration

import json
import os
import requests

context= dict([(var[7:], value)
            for (var, value) in os.environ.items()
            if var.startswith("NOTIFY_")])

if "PARAMETER_1" in context:
    opsgenie_api_url = context["PARAMETER_1"]

    if "PARAMETER_1" in context.keys():
        del context["PARAMETER_1"]
    if "PARAMETERS" in context.keys():
        del context["PARAMETERS"]
else:
    print( "No API Key Specified.")
print("requesting")

newheader={"Content-Type": "application/json"}
response = requests.post(opsgenie_api_url, data=json.dumps(context), headers=newheader)
print(response.status_code)

I am concerned about two things:

  1. Are you still on Checkmk 1.6? If so: Upgrade!
  2. Why are you avoiding the official integration?

The issue got resolved. The URL was not whitelisted in the network firewall which caused the error.
Thanks