Setup Instructions:

  • Log in to your Freshservice console, navigate to Admin -> Alert Management -> Nagios and copy the <auth.key>

  • Ensure you create a contact file for your alert management. In the command prompt, navigate to the root directory of your nagios config folder and create a freshservice_alertmanagement.cfg file in /etc/nagios path and paste the following:


define contact {

     contact_name                             freshservice_alertmanagement

     alias                                    freshservice_alertmanagement

     service_notification_period              24x7

     host_notification_period                 24x7

     service_notification_options             w,u,c,r

     host_notification_options                d,r

     service_notification_commands            alert-service-notification-to-freshservice_alertmanagement

     host_notification_commands               alert-host-notification-to-freshservice_alertmanagement

}

  • Paste the following command syntax in the same  freshservice_alertmanagement.cfg file 


define command {

                              command_name                         alert-service-notification-to-freshservice_alertmanagement

                command_line                 curl -X POST -H "Authorization: auth-key [auth_key_of_customer]" -H "Content-Type: application/json" --data "{ \"hostname\": \"$HOSTNAME$\", \“resource\”:|“$SERVICEDISPLAYNAME$\”,\"message\": \"$NOTIFICATIONTYPE$ - $SERVICEDESC$\",\"tags\": \"$NOTIFICATIONTYPE$\", \"description\": \"$SERVICEDESC$\", \"ip_address\": \"$HOSTADDRESS$\", \"severity\": \"$SERVICESTATE$\",\"value\":\"$SERVICEPERFDATA$\"}" https://subdomain.alerts.freshservice.com/alerts

                }



define command {

                command_name        alert-host-notification-to-freshservice_alertmanagement

                command_line        curl -X POST  -H "Authorization: auth-key [auth_key_of_customer]" -H "Content-Type: application/json" --data "{ \"hostname\": \"$HOSTNAME$\",\“resource\”:|“Availability|”, \"message\": \"$NOTIFICATIONTYPE$ - $HOSTNAME$ is $HOSTSTATE$\", \"ip_address\": \"$HOSTADDRESS$\", \"severity\": \"$HOSTSTATE$\” }" https://subdomain.alerts.freshservice.com/alerts


Note: Change the ownership for the nagios:root freshservice_alertmanagement.cfg file.

 

Note: Change the ownership for 775 freshservice_alertmanagement.cfg


  • In contactgroup.cfg file, add the contact created for alert management (freshservice_alertmanagement) and paste the following in the contact group:


define contact group {

     contact_name                             freshservice_alertmanagement

     alias                                    freshservice_alertmanagement

     service_notification_period              24x7

     host_notification_period                 24x7

     service_notification_options             w,u,c,r

     host_notification_options                d,r


  • Restart Nagios and receive alerts in Freshservice.