How to configure notifications

Notification rules essentially define the who, what, where, when, why, and how of alert notifications.

Rules contain various directives including contacts and contact groups defining who is to receive notifications, what monitored hosts and services should be included or excluded in the notifying, where and when notifications should be sent, which event states to notify upon, and how the notification will be distributed. Notification rules can be enabled (active) and disabled, and rules can be set to escalate after a specified number of notifications is reached. The image below illustrates the notification rule screen, and points out the tabs where the components are defined and where they are incorporated into a rule.

notifications setup

Creating a notification rule

  1. Go to Configuration > Notifications.
  2. You should be in the Notifications tab.
  3. Click Create.

    creating a notification
  4. Enter the notification rule directives, starting with the top section Notification Information:
    • Name - Identifies the notification
    • Description - (optional) Describes the notification
    • Activated - If checked, enables the notification rule
    • Owner - Identifies the owner of a rule for editing, administrators can edit all rules

      notification information
  5. Next, in the Hosts and Services section, you will need to indicate which hostshost groupsservicesservice groups and recipients to be included or excluded in the notification:
    • Includes - An applied include constraint will only allow the notification rule to pass if the host or service belongs to at least one of the listed hostgroups or servicegroups. 
    • Excludes - Conversely, an applied exclude constraint will only allow the notification rule to pass if the host or service does not belong to any of the listed hostgroups or servicegroups. See How to use notification includes excludes.
    • Notes:
      • The " * " wildcard character indicates "all" possibilities, (e.g., all hosts). Any include fields that are empty are assigned an implicit " * " and will automatically match all possibilities.
      • In specifying comma-separated lists of hosts, hostgroups, services, servicegroups, or recipients for inclusion or exclusion filtering, '*' can be used as a multi-character wildcard and '?' can be used as a single-character wildcard, within any particular item in such a list.
      • For Hosts and Services fields, typing a host name and pressing Tab will display a list of valid hosts and services.
      • For Recipients: This field in NoMa is unimplemented and should not be used.

        notification hosts and services
  6. In the Contacts and methods to notify section:

    • Select the Contact(s) and or Group(s) to be notified, and select the Method to be used to send the notification.

      When selecting elements in each of the ContactsGroups, and Methods, it is only associated with the present notification rule if its background is grayed indicating it has been selected. To select a single element click on the element, to select more than one element use the ControlCommand, or Shift keys while making a selection.

  7. Next, select a Timeframe to be used for the notification, and a Timeframe indicating the hours allowed for notifications to be sent.

    notification contacts and methods
  8. Under the Which events to notify section:
    • Check (or uncheck) the filter options for the recovery, problem, state transitions, and other states of change for which to send notifications.
  9. In the Numbers and more section, set the notify after number to indicate when notifications should start being sent, (e.g., 1 sends a first notification, 2-6 sends second through sixth notifications).
    • If the box for Rollover if the last rule is reached is checked, NoMa will start notifications again from number 1 after the last notification (or escalation) has been reached.
    • If the box for Let notifier handle escalations is checked, NoMa is enabled to simulate the reception of notifications from Nagios, this is useful for one-off alerts.
  10. Select Create/Save.

    notification events
  11. If you wish to continue notifications after the specified notify after directive, you can add escalations.
    Note: The escalation option is only displayed for previously defined notification rules so the notification rule would need to be saved first.
    • Go to Configuration > Notifications and select the pencil icon corresponding to the rule to update.

      editing notfications
  12. Then, select add Escalation toward the bottom of the screen, along with:
    • Selecting the Contacts and or Groups to be notified, and the Methods of communication for the escalation.

      An element in each of the ContactsGroups, and Methods is only associated with the present notification rule if its background is grayed indicating it has been selected. To select a single element click on the element, to select more than one element use the ControlCommand, or Shift keys while making a selection.

    • As in the first notification, in an escalation the Notify after number indicates when this notification should be escalated.

    • Click Create, adding additional escalations or click Save again to save the notification rule.

      Deleting Contacts Groups associated with Escalations

      If you need to delete a contact group and it is associated with an escalation, you need to first delete the escalation, then delete the contact group. If you deleted a contact group that is associated with an escalation, this will cause a crash of the NoMa daemon and an error in the debug log.


      notification escalations

Configuring Nagios to use the notification manager

Nagios monitored elements provide alert notifications through Nagios, and non-Nagios elements provide alert notifications through NoMa. However, you can use NoMa to provide alert notifications for both Nagios and non-Nagios monitored elements. A script is provided for inclusion with Nagios Monitoring as the notification command (host-notify-by-noma, service-notify-by-noma), that will be triggered for every host or service you desire to be controlled 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 notify conditions and time periods. Nagios monitored elements are set up by default with the contact group named nagiosadmin which contains contact named nagiosadmin. So, to set up Nagios elements to use NoMa as the notification manager, 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 filter setup.  host-notify-by-noma    service-notify-by-noma   

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.
    • Scroll down and verify nagiosadmin is the assigned contact group.
  4. Click Save.

Enabling and receiving notifications

  1. Go to Configuration > Nagios MonitoringControl:
    • Expand Nagios main configuration, and select Notification.
    • Check the box for Enable notifications.
    • Scrolling to the bottom, click Save and Next >> 3 times, and Save and Done.
    • From the left side navigation select Commit and follow the process to commit the configuration change. 
  2. Then, go to Configuration > Notifications.
    • From the Notifications tab, verify the notification rule is enabled, (toggle the check mark icon to be green (activate). 
  3. 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: http://docs.groundwork.groundworkopensource.com/portal-statusviewer/urlmap?host=d-exchange-2010.sales-demo.local
      Info: CRITICAL - ###.##.###.##: Host unreachable @ ###.##.###.##. rta nan, lost 100% Date/Time: Tue Dec 12 11:44:56 2018
    • Logs in NoMa:
      The Logs tab displays NoMa associated notifications in a list which is accessible during runtime, and displays alerts with status information in the order they are generated. To filter content use the boxes at the top of the list.

Related articles