Well, after some serious head scratching and reading, then re-reading of the Checkmk documentation on notifications (specifically the custom scripts/commands folder) I have an idea I want some help refining…
Basically I think that if I create 2 scripts in the ~/local/share/check_mk/notifications folder (one for host notifications, one for service, same as Nagios), and use the following scripts:
Hosts:
#!/bin/bash
# FreshService Host Notification
curl -X POST -H "Authorization: auth-key <key>" -H "Content-Type: application/json" --data "{\"metric_name\": \"Availability\", \"hostname\": \"$HOSTNAME$\", \"message\": \"$NOTIFICATIONTYPE$ - $HOSTNAME$ is $HOSTSTATE$\", \"ip_address\": \"$HOSTADDRESS$\", \"severity\": \"$HOSTSTATE$\", \"event_id\": \"$HOSTEVENTID$\", \"output\": \"$HOSTOUTPUT$\", \"perf_data\": \"$HOSTPERFDATA$\", \"action_url\": \"$HOSTACTIONURL$\", \"check_command\": \"$HOSTCHECKCOMMAND$\", \"problem_id\": \"$HOSTPROBLEMID$\" , \"long_datetime\": \"$LONGDATETIME$\", \"notification_comment\": \"$NOTIFICATIONCOMMENT$\", \"notification_type\": \"$NOTIFICATIONTYPE$\", \"contact_name\": \"$CONTACTNAME$\" }" <api-url>
Services:
#!/bin/bash
# FreshService Service Notification
curl -X POST -H "Authorization: auth-key <key>" -H "Content-Type: application/json" --data "{\"metric_name\": \"$SERVICEDESC$\", \"hostname\": \"$HOSTNAME$\", \"message\": \"$NOTIFICATIONTYPE$ - $HOSTNAME$ - $SERVICEDESC$\", \"description\": \"$SERVICEDESC$\", \"ip_address\": \"$HOSTADDRESS$\", \"severity\": \"$SERVICESTATE$\", \"event_id\": \"$SERVICEEVENTID$\", \"output\": \"$SERVICEOUTPUT$\", \"perf_data\": \"$SERVICEPERFDATA$\", \"action_url\": \"http://nagios/$SERVICEACTIONURL$\", \"check_command\": \"$SERVICECHECKCOMMAND$\", \"problem_id\": \"$SERVICEPROBLEMID$\" , \"long_datetime\": \"$LONGDATETIME$\", \"notification_comment\": \"$NOTIFICATIONCOMMENT$\", \"notification_type\": \"$NOTIFICATIONTYPE$\", \"notification_url\": \"http://nagios/adagios/status/detail?host_name=$HOSTNAME$&service_description=$SERVICEDESC$&backend=\", \"contact_name\": \"$CONTACTNAME$\" }" <api-url>
Will this work? The fields are already mapped in FreshService using the pre-built plugin, so as long as Checkmk is outputting the same JSON (assuming that it is, due to using OMD on Nagios too), then this should work. I can see these now appear on my notification method lists, and I’m thinking it will work if the JSON matches!
Thoughts/suggestions??