Set up Notification Methods
Sometimes it may be necessary to create and run custom notification methods depending on your environment and requirements in accordance with custom SLAs, and contracts. In Opsview Monitor this is very simple to do.
The notification scripts are located in the
/opt/opsview/monitoringscripts/notifications directory. This directory contains scripts that are included with Opsview Monitor, as well as any custom notification scripts that are already created (sourced from the
To install a new custom notification script, follow the steps at Importing a Notification Script.
In this example, we are going to assume that notify_by_email is the name of our new notification script. In a fresh installation of Opsview Monitor, an e-mail notification method is already provided.
After logging into the Opsview Monitor User Interface, we will first need to create the new Notification Methods.
To do this, we will need to navigate to Configuration > Notification Methods.
In the top corner, click Add New to load the new New notification method window. As per the image below, you must populate this box with the appropriate information:
As you can see, the name of the module we created should be added to the command field, as this is the script that will be executed when the Notification Method is called. Click Submit Changes, and the new Notification Method Opsview Demo Notification is now created.
Next, create a Notification Profiles for a User, so that they will be notified using this method. To do this, navigate to Settings > Users And Roles and click on the User you wish to modify. In the User’s profile, click the Notification Profiles > Add New button.
Once loaded, you can now edit which notifications are sent to that User and using which Notification Method.
The drop-down menu in the Host Groups section, and in this section, you can see the new notification Opsview Demo Notification. Simply select this option, and the new notification is added to this user. This can be done for all applicable users. You can also configure further information on this page, such as for which Host Groups you want this notification to be sent for.
Additionally, you can also configure when the notifications will be sent, and for what alerts. You may only want to know when a critical alert occurs or when a Host is down, but not when a service is flapping. A common use case for this sort of configuration is when defining an on-call engineer notification profile.
As described above, it has been configured only to alert you on warning or critical alerts on services, and for only on Hosts which are down or unreachable. The notifications will only be engaged during “nonwork hours”, as specified in Configuration > Time Periods (so the notification will only do the action during 6:00PM - 8:00 AM, for example).
Finally, submit the changes and go to Configuration > Apply Changes to apply the new notification settings.