Sometimes it may be necessary to create and run custom notification methods depending on your environment and requirements in accordance with custom SLAs, contracts, etc. In Opsview Monitor this is very simple to do.
The directory location for the notification scripts is /opt/opsview/monitoringscripts/notifications. In here you will see the scripts already in Opsview Monitor, plus any other additional notifications already created:
In this example, we are going to assume that notify_by_email is the name of our new notification script. Note that 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 Method. To do this, we will need to navigate to Configuration > Notification Methods.
In the top corner, there will be the Add New Button. Click this to load the new New notification method window. As per the image below, we will need to 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 our new Notification Method Opsview Demo Notification is now created.
Now we need to create a Notification Profile 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. Once on the User profile, click the button Notification Profiles then Add New.
Once loaded, we can now edit which notifications are sent to that User and using which Notification Method.
As you can see, we have a drop-down menu in the Host Groups section, and in this section, we can see our new notification Opsview Demo Notification. Simply select this option, and our new notification is added to this user. This can be done for all applicable users. We can also configure further information on this page, such as for which Host Groups we want this notification to be sent for.
We can also configure when we want notifications to be sent, and for what alerts. We 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.
So as above, we have configured it only to alert us on warning/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 6pm-8am, for example).
Finally, submit the changes and go to CONFIGURATION > APPLY CHANGES to apply the new notification settings.
Updated about 3 years ago