- Notification Extensibility in NMIS
- Adding new Notification Types to NMIS
NMIS version 8.3.24G or greater.
Unix Shell access to the NMIS server and suitable Unix privileges to edit the NMIS configuration files, usually a member of the group "nmis" or the root user.
While working with customers who wanted to extend NMIS and use various methods for notifications, making it a highly extensible Network Management System. To better support notification methods, the logic to initiate a notification and the method for notification has been split, so that additional notification methods can be added without having the modify the core part of NMIS.
This article will briefly describe how this capability works and how it supports operational agility.
Notification Extensibility in NMIS
What are Notifications in NMIS
NMIS raises an event internally and then applies an escalation policy to the event, the result of this escalation policy is a notification. A notification method can be logging, email, SMS, netsend, any number of types. In the past you needed to modify the core NMIS code to add a notification method, but now you can write a notification method outside of NMIS core code and it will be used as required at runtime.
Adding new Notification Types to NMIS
Creating a New Notification Method Package
To add a new notification method, you will need to copy the example Perl code which is in the distribution, which should be at /usr/local/nmis8/lib/Notify/mylog.pm, this is a functional notification method. If you wanted to add something called NetSMS you would copy that tile to NetSMS.pm, so
Then you need to edit the file NetSMS.pm and change the following
To be the package name for NetSMS, e.g.
At this point you can run this at test it, you can do this by adding an escalation type, which will be NetSMS.
Add a New Notification to Escalations.nmis
Looking at Escalations.nmis which is in the conf directory at /usr/local/nmis8/conf/Escalations.nmis, look for the entry "default_default_default_default__"
Modify the line for "Level0" and add ",NetSMS:Contact1", you will now get notifications using the code in /usr/local/nmis8/lib/Notify/NetSMS.pm, the next time you get a notification look in /tmp/mylog for the file.
Creating Your Own Notification
Now you know its working you can modify the contents of the subroutine "sendNotification" to do what you want to do, in the example it is just logging to a file, but you can put anything here Perl can do (which is alot).
You have access to the following data.
Sample Contact Details
|The contact ID or name|
|The on duty string for this contact|
|The email address for this contact|
|The location of this contact|
|Mobile number can be used for SMS alerting|
|Pager value (does anyone still have these?)|
|The phone number|
|Timezone offset from GMT|
Sample NMIS Event Details
Depending on your system and what features you have enabled, there may be more values, but at a minimum you will have the following
|Has the event been acknowledged or not?|
|The details associated with the event|
|element||The element associated with the event, e.g. interface name|
|escalate||What level is the escalation at|
|level||Criticality of the event|
|node||The node the event is related to.|
|time||The time the event was generated|
|notify||Who was notified about the event.|
We would love you get your feedback, please let us know if you had any problems or would like more information at firstname.lastname@example.org