How to use Nagios to send notifications to NoMa

In most cases, you can use the default forwarding of all Nagios™ events to GroundWork Foundation, which uses NoMa to notify contacts. See Notifications and Downtime for an explanation of how this works. 

In some cases, however, it may be useful to forward the Nagios notifications directly to NoMa. This will bypass the GroundWork Foundation status filters and any threshold overrides for services, so please only use this method if you are sure it is what you want to do. When in doubt, you can always ask GroundWork Support for help.

A script is provided with Nagios Monitoring for the notification command (host-notify-by-noma, service-notify-by-noma), that will be triggered for every host or service you desire notifications to be sent via NoMa. 

In Nagios Monitoring, you will need to associate NoMa commands with a contact, that contact with a contact group, and that contact group with every object that will be using NoMa to alert, along with the appropriate notification conditions and time periods.

Nagios monitored resources are set up by default with the contact group named nagiosadmin, which contains a single contact named nagiosadmin. So, to set up Nagios elements to use NoMa as the notification manager for the default setup, you only need to change the Nagios contact host and service notification commands directives to use NoMa scripts. On the occasion of a state change, this notification transmits the specifics to the NoMa daemon by calling the script; the daemon uses the specifics passed in the script compared to the stored filters in the NoMa database and on a match sends out a NoMa type message to the contacts named in that matching filter. NoMa sends the message using a different script, one of several available for choice in the NoMa notification definition. 

Host script:

/usr/local/groundwork/noma/notifier/alert_via_noma.pl -c h -s "$HOSTSTATE$" -H "$HOSTNAME$" -G "$HOSTGROUPNAMES$" -n "$NOTIFICATIONTYPE$" -i "$HOSTADDRESS$" -o "$HOSTOUTPUT$" -t "$TIMET$" -u "$$(( $HOSTPROBLEMID$ ? $HOSTPROBLEMID$ : $LASTHOSTPROBLEMID$ ))" -A "$$([ -n "$NOTIFICATIONAUTHORALIAS$" ] && echo "$NOTIFICATIONAUTHORALIAS$" || echo "$NOTIFICATIONAUTHOR$")" -C "$NOTIFICATIONCOMMENT$" -R "$NOTIFICATIONRECIPIENTS$"

Service script:

/usr/local/groundwork/noma/notifier/alert_via_noma.pl -c s -s "$SERVICESTATE$" -H "$HOSTNAME$" -G "$HOSTGROUPNAMES$" -E "$SERVICEGROUPNAMES$" -S "$SERVICEDESC$" -o "$SERVICEOUTPUT$" -n "$NOTIFICATIONTYPE$" -a "$HOSTALIAS$" -i "$HOSTADDRESS$" -t "$TIMET$" -u "$$(( $SERVICEPROBLEMID$ ? $SERVICEPROBLEMID$ : $LASTSERVICEPROBLEMID$ ))" -A "$$([ -n "$NOTIFICATIONAUTHORALIAS$" ] && echo "$NOTIFICATIONAUTHORALIAS$" || echo "$NOTIFICATIONAUTHOR$")" -C "$NOTIFICATIONCOMMENT$" -R "$NOTIFICATIONRECIPIENTS$"

Set contact(s) in Nagios to forward alerting to NoMa

  1. Go to Configuration > Nagios Monitoring > Contacts > Contacts.
  2. Expand Modify and select the nagiosadmin contact.
  3. Assign host and service notifications commands to the NoMa script (you may need to uncheck the inherit box to do so):
    • For the Host notification commands directive, select host-notify-by-noma.
    • For the Service notification commands directive, select service-notify-by-noma.
  4. Scroll down and verify nagiosadmin is the assigned contact group.
  5. Click Save.

Enable notifications

  1. Go to Configuration > Nagios MonitoringControl.
  2. Expand Nagios main configuration, and select Notification.
  3. Check the box for Enable notifications.
  4. Scrolling to the bottom, click Save and Next >> 3 times, and Save and Done.
  5. From the left side navigation select Commit and follow the process to commit the configuration change. 
  6. Then, go to Configuration > Notifications.
  7. From the Notifications tab, verify the notification rule is enabled, (toggle the check mark icon to be green (activate). 
  8. Notifications will then be distributed based on the directives set in the notification rule.

    Email notification example:
    ***** NoMa *****
    ID: 1Notification
    Type: PROBLEM 
    Host: d-exchange-2010.sales-demo.local 
    Host Alias: sales-demo 
    State: DOWN 
    Address: ###.##.###.## 
    Link: 
    Info: CRITICAL - ###.##.###.##: Host unreachable @ ###.##.###.##. rta nan, lost 100% Date/Time: Tue Jan 12 11:44:56 2020
  9. You can view the notification logs in Configuration > Notifications > NoMa to display a runtime list of alerts with status information in the order they are generated. To filter content use the boxes at the top of the list.

Related articles