Custom Integration

Oooh what does that end up looking like on the payload?

The scripts I’m using (actually just a bash one-liner) are as follows:

#!/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-post-url>
#!/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-post-url>

So basically I’m trying to get it to use the variables that come from the alert, but it needs to be JSON. These get mapped in Fresh. But I think these commands dont actually export any data, or its not in JSON.