Nagios v1

Connect Nagios with Notify Events for quick integration and receiving notifications in a variety of messengers.

Configuration steps:

  1. Go to Nagios configurations folder (usually: `/usr/local/nagios/etc/objects`)
  2. Modify the `commands.cfg` and add the followings lines:
    # 'notify-events-host-notification' command definition
    define command {
        command_name notify-events-host-notification
        command_line /usr/bin/curl -X POST --data-urlencode "type=host" --data-urlencode "status=$NOTIFICATIONTYPE$" --data-urlencode "host_name=$HOSTNAME$" --data-urlencode "host_display_name=$HOSTDISPLAYNAME$" --data-urlencode "host_state=$HOSTSTATE$" --data-urlencode "host_address=$HOSTADDRESS$" --data-urlencode "host_output=$HOSTOUTPUT%" --data-urlencode "host_long_output=$LONGHOSTOUTPUT$" --data-urlencode "time=$LONGDATETIME$" "https://notify.events/api/v1/channel/source/$CONTACTPAGER$/execute"
    }
    
    # 'notify-events-service-notification' command definition
    define command {
        command_name notify-events-service-notification
        command_line /usr/bin/curl -X POST --data-urlencode "type=service" --data-urlencode "status=$NOTIFICATIONTYPE$" --data-urlencode "host_name=$HOSTNAME$" --data-urlencode "host_address=$HOSTADDRESS$" --data-urlencode "service_display_name=$SERVICEDISPLAYNAME$" --data-urlencode "service_desc=$SERVICEDESC$" --data-urlencode "service_state=$SERVICESTATE$" --data-urlencode "service_output=$SERVICEOUTPUT$" --data-urlencode "service_long_output=$LONGSERVICEOUTPUT$" --data-urlencode "time=$LONGDATETIME$" "https://notify.events/api/v1/channel/source/$CONTACTPAGER$/execute"
    }
  3. Modify the `contacts.cfg` and add the following lines:
    # `notify-events`
    define contact {
        contact_name notify-events
        alias Notify.Events
        service_notification_options w,u,c,r,f,s
        service_notification_period 24x7
        service_notification_commands notify-events-service-notification
        host_notification_options d,u,r,f,s
        host_notification_period 24x7
        host_notification_commands notify-events-host-notification
        pager <token>
    }
  4. Add the Notify.Events contact to your Nagios contact group
  5. Restart Nagios service