Re: Configure Email Notifications in NNMi 9.0 (1821 Views)
Reply
Advisor
dharm123
Posts: 38
Registered: ‎10-27-2010
Message 1 of 10 (1,823 Views)

Configure Email Notifications in NNMi 9.0

Hi All,

 

I have installed NNMi version 9.0 on RHEL 5.2. I want to configure email notifications for snmp incidents.

 

Can anyone please help me configuring the same?

 

Regards,

Dharmesh Shah.

Valued Contributor
ARUNPRAKASH
Posts: 120
Registered: ‎01-27-2011
Message 2 of 10 (1,821 Views)

Re: Configure Email Notifications in NNMi 9.0

Hi Dharmesh Shah,

 

   In Configuration workspace, select incident configuration->Management event configuration, And open the event. In Action tab you need to mention the script file which is going to send a mail.

 

Cheers...!

Arun..

Valued Contributor
ARUNPRAKASH
Posts: 120
Registered: ‎01-27-2011
Message 3 of 10 (1,817 Views)

Re: Configure Email Notifications in NNMi 9.0

Hii ..

 

You can use Perl or Bash script for sending mail.

 

Cheers,

 

Arun..

Advisor
dharm123
Posts: 38
Registered: ‎10-27-2010
Message 4 of 10 (1,813 Views)

Re: Configure Email Notifications in NNMi 9.0

I'll appreciate if you can share this script??
Valued Contributor
ARUNPRAKASH
Posts: 120
Registered: ‎01-27-2011
Message 5 of 10 (1,808 Views)

Re: Configure Email Notifications in NNMi 9.0

Hii,

 

Sorry, I don't have any script for that.

 

I think Some examples may available on net. You can check and modify that for your own.

 

Cheers..!

Arun..

Valued Contributor
Ionut Mosoiu
Posts: 89
Registered: ‎02-10-2010
Message 6 of 10 (1,805 Views)

Re: Configure Email Notifications in NNMi 9.0

Hi ,

 

an example of node down :

 

 

use Net::SMTP;
use strict;

my $firstOccorrenceTime=$ARGV[0];
my $sourceNodeName=$ARGV[1];
my $severity=$ARGV[2];
my $originOccurrenceTime=$ARGV[3];
my $managementAddress=$ARGV[4];
my $sourceObjectName=$ARGV[5];

my $DISABLE = '0'; # set this to 1 to disable this script (for maintenance) and 0 to enable.

exit if ($DISABLE);

# Configure the mail server IP/name here
my $MAILHOST = 'xxx.xxx.xxx.xxx';

# Configure the email address of the receivers here.
# format for multiple entries : my @EMAIL_TO = ( 'what.ever_1@comain.com', 'what.ever_2@comain.com'', 'nnm@domain.com');
my @EMAIL_TO = ( 'user@domain.ro');

# Configure a name to appear in the 'From' field of the email msg here
my $FROM = 'nnmi9.1_linux@domain.com';

###################################################
# Don't change anything below here !!!
###################################################

my ($sourceNodeName, $severity, $managementAddress, $originOccurrenceTime, @email_addresses) = @ARGV;

# check that we have the miminum fields which we require
if (! ($sourceNodeName&& $severity&& $managementAddress&& $originOccurrenceTime ) ) {
die "You must supply the values for :\nNode_Name = $sourceNodeName\nSeverity = $severity\nManagementAddress = $managementAddress\nOccurrenceTime = $originOccurrenceTime\n";
}

my $msg = ("Email generated by NNMi when an incident like : Node Down it's triggerd.\n \n Node Information\n ===============================\n \n Node Name : $sourceNodeName\n Severity : $severity\n Manageme
ntAddress = $managementAddress\n OccurrenceTime : $originOccurrenceTime\n");

# connect to the smtp server
my $smtp = Net::SMTP->new($MAILHOST, Timeout => 10) or die "Unable to connect to mail host : $MAILHOST  - $!\n";

# add email addresses configured in @EMAIL_TO to any email addresses
# passed in args from command line
@email_addresses = (@email_addresses, @EMAIL_TO);

foreach my $address (@email_addresses) {

$smtp->mail($address);
$smtp->to($address);
$smtp->data();
$smtp->datasend("From: $FROM\n");
$smtp->datasend("To: $address\n");
$smtp->datasend("Subject: Node Down - Node Name : $sourceNodeName\n");
$smtp->datasend("\n$msg \n\n");
$smtp->datasend;
$smtp->dataend();
}
$smtp->quit;

 

 

Best Regards,

 

Daniel

Valued Contributor
Ionut Mosoiu
Posts: 89
Registered: ‎02-10-2010
Message 7 of 10 (1,799 Views)

Re: Configure Email Notifications in NNMi 9.0

Hi,

 

i forgot to specify how i am declare the scrip to run on actions tab of the incident :

 



Yes I am declare the entire path to the script even if in the adman guide it's written that you need to specify only the script name followed by variables.For me did not work until I specified the entire path to the script.

 

Best Regards,

 

Daniel

Frequent Advisor
Solari
Posts: 62
Registered: ‎01-08-2010
Message 8 of 10 (1,791 Views)

Re: Configure Email Notifications in NNMi 9.0

Bear in mind that you may want to send emails to different people dependent on node group, therefore you may want to consider using the Node Settings tab to cater for this (Action by node group).

 

I also created a group called "Disable_Email_Alerts" to use here which is order 1 and has no action defined, so that I can easily put nodes into this group to stop spamming when something is misbehaving or flapping a lot (eg: OSPF or BGP alerts)

 

the simplest method if you don't want to use a script on a UNIX system is to just call something like:

 

/bin/mailx -s "$SourceNodeName - Alert message... $1 $2 $3" </dev/null

 

or for custom poller I use commands like this:

 

(Closed State)

/bin/echo "$cia.custompoller.policy/$cia.custompoller.collection for variable $cia.custompoller.variable.name ($cia.custompoller.variable.expression) is in the Normal state. MIB instance: $cia.custompoller.mibInstance - Incident Closed." | /bin/mailx -s "$sourceNodeName - Custom Poller ($cia.custompoller.variable.expression) in NORMAL state" operations@mycompany.com

 

 

 

Regular Advisor
Ad1t1a99
Posts: 154
Registered: ‎12-05-2012
Message 9 of 10 (1,068 Views)

Re: Configure Email Notifications in NNMi 9.0

Hi,

 

I run the script through CLI by passing on the parameters , just to check if I am getting the mails. The script is throwing no errors but I am not receiving the mail too.

 

What is going wrong?

 

Regards,

Aditi

Respected Contributor
mostafa_hassan
Posts: 287
Registered: ‎12-11-2011
Message 10 of 10 (1,055 Views)

Re: Configure Email Notifications in NNMi 9.0

Hello ,

 

 

i faced all of this issues regarding sending Mail from REDHAT 5.4 using Sendmail which call Mailx binary ,

 

can you try this command

echo "Node $snn is down at $fot  HIA NMS Team" | mailx -s "Node $snn is down at $lot" yourmail@company.com,

 

in the mean while open another shell session for checking the logs , and identify if the mail sent or not .and which relay it will use to reach the concerned SMTP server .

 

u can read the logs from tail -f /var/log/maillog

and check the logs there u can know what is the problem after that .

 

let me know

All the best .
Saying Thanks by hitting Kudos :)

Regards
Mostafa Hassan
HP AIS NNM-NA-OO
CCNA-CCNP-ITIL-VCA-Cloud-VCA DataCenter
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.