Wikis - Page

How to use mailx client to send an email notification for an Incident from NNMi hosted on Linux OS

2 Likes

TOPIC:

 

This article assumes, that there is an active and configured SMTP server in the network and outlines the basics of email notification configuration for NNMi.

 

How to configure NNMi to send out email notifications, when deployed on RHEL Linux, or other Unix distribution.

 

HOW TO STEPS:

 

As a pre-requisite, software package for email notifications must be installed. Usually shipped with standard, RHEL distribution, but if not available, can be installed via yum:

$ yum install mailx

When defining the incident action in NNMi, use type ScriptOrExecutable and define it's parameters.

action.PNG

Example command for Node Down event:

echo -e "$mga \n $sln \n $name \n@ \n $lot \n NNMi auto message" | mailx -v -s "Incident" -S smtp=<SMTP server> <recepient email address>
 
In the above command, the text between the quotes, could be customized as needed.
Additionally, it uses NNMi-defined variables, explained below:
 
$mga - Value from the Management Address attribute of the incident's source Node's form or SNMP Agent form.
$sln -  The fully-qualified DNS name as displayed in the Hostname attribute of the incident's source Node's form.
$name - Value of the Name attribute from the incident configuration.
$lot - Value from the Last Occurrence Time attribute in the incident form.
 
\n - prints each variable on a new line, it is not mandatory. It is a formatting choice.

Full list of variables, could be found in the NNMi documentation portal, chapter: Configure an action for an incident

The mailx arguments are also customizable: 

-v  Verbose mode. The details of delivery are displayed on the user's terminal. (optional, if more debug info is needed)

-s subject Specify subject on command line (only the first argument after the -s flag is used as a subject; be careful to quote subjects containing spaces).

-S variable[=value] Sets the internal option variable and, in case of a string option, assigns value to it. 
 
Note, that when  setting  from  variable, domain name of host is automatically added if value does not contain any.  
If you want to enter from address with owner's name, you can use, for example, following format:
-S "from=System User <DoNotReply>"
 
The actual email received by the above example will look like this: 
 
 
Subject: Incident
 

172.10.0.6

 adsl-172-10-0-6.global.net

 NodeDown

@

 Mon Apr 13 15:04:05 IST 2020

 NNMi auto message

Labels:

Education-Training
How To-Best Practice
Support Tips/Knowledge Docs
Support Tip
Comment List
Related
Recommended