You may want to use an existing Nagios Core notification script in Opsview Monitor.
## Adding/Writing Your Own Notification Method
To add this a custom notification method:
Check the Notification script for any dependencies. This may require additional software to be installed on the Opsview Monitor Orchestrator server (and Collector).
Test the Notification script. Opsview Monitor provides a way of simulating the environment variables that Nagios Core will set at notification time. If you intend to run this notification on Collector, you should test on those servers too:
Put your script into /opt/opsview/monitoringscripts/notifications/ on the Opsview Orchestrator server, as the opsview user.
Go to Configuration > Notification Methods and click 'Add New' to set the appropriate configuration (see below):

Each User will then have to select this Notification Method to one of their Notification Profiles.
Go to Configuration > Apply Changes to make the new setup live.
Cause a failure to test that the notification is sent.
**Writing Your Own Notification Script** Your notification script should be written to expect any input regarding the notification alert from Nagios Core via environment variables - see the Macro Availability Chart at [http://nagios.sourceforge.net/docs/3_0/macros.html](🔗).
The only environment variables available for Notification Methods are:
NAGIOS_CONTACTALIAS
NAGIOS_CONTACTEMAIL
NAGIOS_CONTACTGROUPLIST
NAGIOS_CONTACTNAME
NAGIOS_CONTACTPAGER
NAGIOS_HOSTACKAUTHOR
NAGIOS_HOSTACKCOMMENT
NAGIOS_HOSTADDRESS
NAGIOS_HOSTALIAS
NAGIOS_HOSTATTEMPT
NAGIOS_HOSTDOWNTIME
NAGIOS_HOSTDURATION
NAGIOS_HOSTGROUPALIAS
NAGIOS_HOSTGROUPNAME
NAGIOS_HOSTNAME
NAGIOS_HOSTNOTIFICATIONNUMBER
NAGIOS_HOSTOUTPUT
NAGIOS_HOSTPROBLEMID
NAGIOS_HOSTSTATE
NAGIOS_HOSTSTATEID
NAGIOS_HOSTSTATETYPE
NAGIOS_LASTHOSTCHECK
NAGIOS_LASTHOSTDOWN
NAGIOS_LASTHOSTPROBLEMID
NAGIOS_LASTHOSTSTATE
NAGIOS_LASTHOSTSTATECHANGE
NAGIOS_LASTHOSTUNREACHABLE
NAGIOS_LASTHOSTUP
NAGIOS_LASTSERVICECHECK
NAGIOS_LASTSERVICECRITICAL
NAGIOS_LASTSERVICEOK
NAGIOS_LASTSERVICEPROBLEMID
NAGIOS_LASTSERVICESTATE
NAGIOS_LASTSERVICESTATECHANGE
NAGIOS_LASTSERVICEWARNING
NAGIOS_LASTSTATECHANGE
NAGIOS_LONGDATETIME
NAGIOS_LONGHOSTOUTPUT
NAGIOS_LONGSERVICEOUTPUT
NAGIOS_NOTIFICATIONAUTHOR
NAGIOS_NOTIFICATIONCOMMENT
NAGIOS_NOTIFICATIONNUMBER
NAGIOS_NOTIFICATIONTYPE
NAGIOS_SERVICEACKAUTHOR
NAGIOS_SERVICEACKCOMMENT
NAGIOS_SERVICEATTEMPT
NAGIOS_SERVICEDESC
NAGIOS_SERVICEDOWNTIME
NAGIOS_SERVICEDURATION
NAGIOS_SERVICENOTES
NAGIOS_SERVICENOTIFICATIONNUMBER
NAGIOS_SERVICEOUTPUT
NAGIOS_SERVICEPROBLEMID
NAGIOS_SERVICESTATE
NAGIOS_SERVICESTATEID
NAGIOS_SERVICESTATETYPE
NAGIOS_SHORTDATETIME
NAGIOS_TIMET
OPSVIEW_KEYWORDS
For example, in perl, reference the HOSTNAME variables using:
In bash, use:
A useful trick in bash to see all available environment variables is to add at the top of a Notification Method :
To distinguish between a service alert and a Host alert, do something like (in perl):
Global settings should be stored either in the script or via command arguments.
**OUTPUT**
The environment Variables SERVICEOUTPUT, HOSTOUTPUT, LONGSERVICEOUTPUT, LONGHOSTOUTPUT hold the output from a plugin. The first two hold only the first line of the output, while the remainder is in the LONG variables. Note that the left and right angle brackets (<>) are stripped from the output.
**CONTACTGROUPLIST**
This environment variable holds all the contact groups that this Host/service belongs to, in a comma-separated list. Contact groups will be of the form:
HostgroupX_servicegroupY
kZ_NAME
You can use this to get the list of keyword names that the Host/Service is related to by: @keywords = grep { s/k\d+_// } (split ",", $ENV{NAGIOS_CONTACTGROUPLIST})
## Testing Notification Scripts
As mentioned above, notification scripts can be tested on both the Orchestrator and Collectors by using:
Some scripts may require extra configuration to test them. For example, to test the VictorOps notification method, ensure the access key is set in the UI and then use the following:
This particular notification method logs to /var/log/opsview/opsview.log, but you need to check within each script where logging is sent (in many cases script output is captured in a file located in /tmp/).