Unsolved
This post is more than 5 years old
79 Posts
0
4545
escalation policy
Has anyone has done this
I want to include in our escalation policies a notification that lets me know when an alarm becomes cleared by email or SMS.
I want to include in our escalation policies a notification that lets me know when an alarm becomes cleared by email or SMS.
dele1
79 Posts
0
January 29th, 2008 05:00
We have an escalation policy that notifies when a router is down but not cleared as there is no field for event cleared only EVENT is inactive
The notifier reply is something i am not sure of as what we want to achieve is different from your note i need your help again.
AdaDie
54 Posts
0
January 29th, 2008 05:00
We made something similar. We are using the notifier adapter which is included in SAM.
You can find the default conf file in /conf/notifier directory.
The notifier is listening to a notification list.
We have different adapters for different kind of notifications and departments.
The System itself can monitor the adapters if they are running or not.
The adapters are installed as a service with the sm_service --install command.
For example:
sm_service install --force --unmanaged --startmode=manual \
'--name=SC-SMS-EOD' \
'--description=Mail adapter for NM EOD Notifications (SMS)' \
'/opt/nme/incharge7/SAM/smarts/bin/sm_notify' \
'--name=SC-SMS-EOD' \
'--output=SC-SMS-EOD' \
'--conf=/opt/nme/incharge7/SAM/smarts/local/conf/notifier/SC-SMS-EOD.conf' \
'mail'
So it's easy to start and stop an adapter with sm_service stop/start
We are using escalation policies as well, but we don't send email or sms anymore.
If you would like to do it, you can create a automatedTool which is starting a script that is sending an email or sms.
If you need more information, please let me know.
dele1
79 Posts
0
January 29th, 2008 06:00
I am not very used to asl script but if you can help me with what to do with both files.
/* mail-filter.asl - Filter script for the mail notification adapter.
*
* Copyright (C) 1999-2000, System Management ARTS (SMARTS)
* All Rights Reserved
*
* RCS $Id: mail-filter.asl,v 1.3 2002/01/30 23:27:26 boaz Exp $
*/
/*
* No word delimiter needed.
*/
delim = "";
/*
* Required variables.
*/
default debug = FALSE;
default NotifierName = " ";
notifier = self->object("GNA_Notifier", NotifierName) ? LOG,STOP;
currentEvent = notifier->CurrentEvent ? LOG,STOP;
/*
* Rules.
*/
/*
* Filter cleared events.
*/
START() {
OMIT_CLEAR_EVENTS
}
OMIT_CLEAR_EVENTS() filter {
(currentEvent->icType == "CLEAR" || currentEvent->icType == "NL_CLEAR")
} do {
currentEvent->filterMe = TRUE;
}
/*
* Local Variables:
* mode: C++
* End:
mail-notify
oot@iky-smarts-sec # more mail-notify.asl
/* mail-notify.asl - Main script for the mail notification adapter.
*
* Copyright (C) 1999-2000, System Management ARTS (SMARTS)
* All Rights Reserved
*
* RCS $Id: mail-notify.asl,v 1.6 2002/01/30 23:27:26 boaz Exp $
*/
/*
* No word delimiter needed.
*/
delim = "";
/*
* Required variables.
*/
default debug = FALSE;
default test = FALSE;
default NotifierName = " ";
notifier = self->object("GNA_Notifier", NotifierName) ? LOG,STOP;
currentEvent = notifier->CurrentEvent ? LOG,STOP;
mailer = self->object("ACT_Mail", "ACT-Mail") ? LOG,STOP;
mailer->test = test;
mailer->trace = debug;
serverName = notifier->serverName;
/*
* User-provided parameters.
*/
sender = notifier->ConfiguredBy->SenderId;
recipients = notifier->ConfiguredBy->Recipients;
/*
* Rules.
*/
START() {
local subject = "";
local body = "";
} filter {
/*
* Only send here if sentByCustom is FALSE.
*/
(!currentEvent->sentByCustom)
} do {
subject = currentEvent->icType." ".
currentEvent->icDisplayName." ".currentEvent->icEventName;
body = ( " InCharge Server " . serverName . ":\n " .
currentEvent->icType . " " .
currentEvent->icDisplayClassName . " " .
currentEvent->icDisplayName . " ".
currentEvent->icEventName );
if (currentEvent->icType != "CLEAR") {
body = body . " (" . currentEvent->icCertainty . "%)";
}
body = body . ":\n " . currentEvent->icEventDescription . "\n";
mailer->sendmail(sender, recipients, subject, body) ? LOG, STOP;
}
/*
* Local Variables:
* mode: C++
* End:
*/
Dinand1
89 Posts
0
January 29th, 2008 06:00
just send an email when the notification gets cleared? ... for all devices in your network?
Do you want the standard email or a customized one?
cheers
F.
AdaDie
54 Posts
0
January 29th, 2008 06:00
/* mail-custom.asl - Custom script for the mail notification adapter.
*
* Copyright (C) 1999-2000, System Management ARTS (SMARTS)
* All Rights Reserved
*
* RCS $Id: SC-SMS-EOD-custom.asl,v 1.3 2007/09/14 07:44:28 icadm Exp $
*/
/*
* No word delimiter needed.
*/
delim = "";
/*
* Required variables.
*/
default debug = FALSE;
default test = FALSE;
default NotifierName = " ";
notifier = self->object("GNA_Notifier", NotifierName) ? LOG,STOP;
currentEvent = notifier->CurrentEvent ? LOG,STOP;
mailer = self->object("ACT_Mail", "ACT-Mail") ? LOG,STOP;
mailer->test = test;
mailer->trace = debug;
serverName = notifier->serverName;
/*
* User-provided parameters.
*/
sender = notifier->ConfiguredBy->SenderId;
recipients = notifier->ConfiguredBy->Recipients;
/*
* Rules.
*/
START() {
local subject = "";
local body = "";
local time_v = "";
local title = "";
} filter {
/*
* Only send here if sentByCustom is TRUE.
*/
(currentEvent->sentByCustom)
} do {
/*
* This is how the adapter constructs the default message.
* Edit to suit your tastes.
*/
title = "NEW: ";
time_v = ("--> NEW EVENT <--\n".
"LastNotifiedAt: ".time(currentEvent->icLastNotifiedAt)."\n");
if (currentEvent->icType == "CLEAR" || currentEvent->icType == "NL_CLEAR") {
title = "CLEARED: ";
time_v = ("--> EVENT CLEARED <--\n".
"LastClearedAt: ".time(currentEvent->icLastClearedAt)."\n");
}
subject = "InCharge Notification " .title;
body = ("time: ".time(currentEvent->icLastNotifiedAt)."\n" .
"Class: ".currentEvent->icDisplayClassName."\n".
"Name: ".currentEvent->icDisplayName."\n".
"Event: ".currentEvent->icEventName);
mailer->sendmail(sender, recipients, subject, body) ? LOG, STOP;
}
/*
* Local Variables:
* mode: C++
* End:
*/
************************************************************************
/* mail-filter.asl - Filter script for the mail notification adapter.
*
* Copyright (C) 1999-2000, System Management ARTS (SMARTS)
* All Rights Reserved
*
* RCS $Id: SC-SMS-EOD-filter.asl,v 1.1 2007/04/18 06:54:53 icadm Exp $
*/
/*
* No word delimiter needed.
*/
delim = "";
/*
* Required variables.
*/
default debug = TRUE;
default NotifierName = " ";
notifier = self->object("GNA_Notifier", NotifierName) ? LOG,STOP;
currentEvent = notifier->CurrentEvent ? LOG,STOP;
mailer = self->object("ACT_Mail","ACT-Mail") ? LOG, STOP;
serverName = notifier->serverName;
sender = notifier->ConfiguredBy->SenderId;
recipients = notifier->ConfiguredBy->Recipients;
/*
* Rules.
*/
/*
* Filter cleared events.
*/
START() {
local subject = "";
local body = "";
} do {
old_event = FALSE;
/*
*OMIT_CLEAR_EVENTS();
*/
OMIT_OLD_EVENTS();
currentEvent->sentByCustom = TRUE; //suppress the generic process
body = ("*** InCharge Notification ***\n\n".
"LastNotifiedAt: ".time(currentEvent->icLastNotifiedAt)."\n" .
"DisplayName: ".currentEvent->icDisplayName."\n".
"EventName: ".currentEvent->icEventName."\n".
"*** END OF INFO ***\n");
if (!old_event) {
print("#######################################################");
print("Time: ".time());
print("SMS sent to: ".recipients);
print(body);
print("#######################################################");
}
}
OMIT_CLEAR_EVENTS() filter {
(currentEvent->icType == "CLEAR" || currentEvent->icType == "NL_CLEAR")
} do {
currentEvent->filterMe = TRUE;
}
OMIT_OLD_EVENTS() filter {
(time() - time(currentEvent->icLastNotifiedAt) > 600 ) // Don't send Notification, if Notif is older than 10 minutes
} do {
old_event = TRUE;
currentEvent->filterMe = TRUE;
print(time().": old Event notified@ ".time(currentEvent->icLastNotifiedAt)." ".currentEvent->icDisplayName." not sent to " .recipients);
}
/*
* Local Variables:
* mode: C++
* End:
*/
AdaDie
54 Posts
0
January 29th, 2008 06:00
With the notifier you can do exactly the same thing. Send a message if devices goes down and send again a message if device is up. You need only 1 mail adapter to do that.
One other solution would be the following: http://screencast.com/t/a0FbnB0SC
Dinand1
89 Posts
0
January 29th, 2008 06:00
you can configure the events you want to receive and you can configure if you want to receive the when the event it's 'CLEARED'
just check the files under SAM\smarts\rules\notifier\mail
mail-filter.asl indicates which events you want to receive emails from
mail-notify.asl - you can configure the appareance of your email
and under SAM\smarts\local\conf\notifier
you can find mail-notify.conf
this file which tell the notifier if it should use a Notification list to send emails or just all the events which are from a class or from some other symptoms
if you want to use escalation policies you can use the 'event state' field when the value is inactive to trigger a script that will send a sms or email.
But the problem is that you the escalation policies trigger actions in time. So i dont see how you will be able to check when the notification changes state to clear.
As ada stated the mail-notifier just do whta you need ... unless you plan to send sms
cheers
F.
dele1
79 Posts
0
January 29th, 2008 06:00
it just send an email when all devices in the network that are down are cleared
my scripting skills are minimal.
dele1
79 Posts
0
January 29th, 2008 07:00
AdaDie
54 Posts
0
January 29th, 2008 07:00
adapt the files:
..local/conf/notifier/mail-notify.asl
..local/rules/notifier/mail/mail-custom.asl
..local/rules/notifier/mail/mail-filter.asl
Then create a Notification list over the Global Manager Adminsitration Console.
In the file ..local/conf/notifier/mail-notify.asl you have to point to the created Notification List.
The files I posted will send you an email if an event is matching the created notification list. And it will send an email if an event is cleared.
create a service with the command I posted sm_service...
Then you can start and stop the service. Note in my example, the old events won't be sent if they are older than 10 minutes (it checks the LastNotified time).
dele1
79 Posts
0
January 29th, 2008 07:00
I will have a thorough look at the adjusted script and if there is any questions i will ask tommorrow.
Dinand1
89 Posts
0
January 29th, 2008 07:00
so the script should work just the other way around ... if i am right?
I definetely advise you to use a notification list to filter the alarms:
Use the Active, the event and the class fields if you want to send cleared events of type device down ...
Active = No
Event = Down
Class = Switch|Router|Node
then configure the mail-notify.conf as follows
------------------------------------------------------- check the section where says NLName = "Elles_Notification_list"
# mail-notify.conf - Configuration for the mail notification adapter
#
# Copyright (C) 1999-2000 System Management ARTS (SMARTS)
# All Rights Reserved
#
# $Id: mail-notify.conf,v 1.6 2003/06/25 21:08:49 katkin Exp $
#
GNA_Notifier::mail-Notifier
{
#
# Name of the SAM Server from which to receive notifications.
#
serverName = "INCHARGE-SA"
ConfiguredBy = MailConfiguration::Mail-Configuration
{
#
# Name of mail server host.
#
# MailServer = "localhost"
MailServer="MAIL05a.correos.es"
#
# Sender identity.
# Must be a valid email address, recognized by the mail server.
#
# SenderId = "daemon@localhost"
SenderId = "alertas.smarts@correos.es"
#
# Comma-separated list of users to whom notifications should
# be sent to.
#
# Recipients = "root@localhost"
# Recipients = "alertas.smarts@correos.es"
Recipients = "fernando.ansorena@correos.es,maria.castillo@correos.es"
}
ReadsInputFrom = GA_SubscriberFE::mail-Subscriber-FrontEnd
{
#
# How long, in seconds, an event must remain active before the
# adapter sends a notification.
#
eventSmoothingInterval = 0
#
# Notification threshold; discard notifications with a certainty
# below this value, which should be between 0.0 and 1.0.
#
minimumCertainty = 0.01
#
# Subscriptions.
#
SubscribesTo =
{
#
# Choice subscription.
#
# GA_ChoiceSubscription::mail-All-Problems-Subscriptions
# {
# className = ".*"
# instanceName = ".*"
# eventName = ".*"
# problems = TRUE
# aggregates = FALSE
# symptoms = FALSE
# }
#
# NL subscription.
#
GA_NLSubscription::mail-Default-NL-Subscriptions
{
NLName = "Elles_Notification_list" ## your notification list
}
# #
# # Profile subscription.
# #
# GA_ProfileSubscription::mail-Default-Profile-Subscriptions
# {
# profileName = "default"
# }
}
}
#
# How long, in seconds, to ignore notifications from the server after it
# connects. Use this parameter to avoid receiving the initial flood of
# notifications when the server (re)connects.
#
initialEventDelay = 0
filterRuleSet = "notifier/mail/mail-filter.asl"
customRuleSet ="notifier/mail/mail-custom.asl"
}
#
# Local Variables:
# mode: Makefile
# comment-column: 32
# fill-column: 79
# End:
---------------------------------------------------------
and then configure the files sent by ADA just the opposite, so to send Clear events but not raised ones ...
Message was edited by:
nandomad
AdaDie
54 Posts
0
January 29th, 2008 08:00
it's called mail-notify.conf
In our environment we copied the file and created for each different mail and sms adapter a new file. In the example it's the file MAIL-SERVICE.conf
It's the file you specify in the sm_service command.
sm_service install --force --unmanaged --startmode=manual \
'--name=MAIL-SERVICE' \
'--description=Mail adapter for down and up events' \
'/opt/nme/incharge7/SAM/smarts/bin/sm_notify' \
'--name=MAIL-SERVICE' \
'--output=MAIL-SERVICE' \
'--conf=/opt/nme/incharge7/SAM/smarts/local/conf/notifier/MAIL-SERVICE.conf' \
'mail'
The other files are need to customize the message and to filter events. The 2 files are listed in the mail-notify.conf (in the example MAIL-SERVICE.conf) file:
filterRuleSet = "notifier/mail/MAIL-SERVICE-filter.asl"
customRuleSet = "notifier/mail/MAIL-SERVICE-custom.asl"
As you can see we copied as well the mail-filter.asl to MAIL-SERVICE-filter.asl
and the mail-custom.asl to MAIL-SERVICE-custom.asl
You don't need to change the file mail-notify.asl
AdaDie
54 Posts
0
January 30th, 2008 00:00
You don't need to change the filterRuleSet and the customTuleSet files.
It depense what kind of information you would like to send by email.
Try it first as you descibed without changing if you get the mail adapter to run.
After that we can go further in customizing the 2 files.
dele1
79 Posts
0
January 30th, 2008 00:00
thanks
that is fine which means i will create a notification list by creating a filter and giving it a name and then modifying the mail-notify.conf file(copied to another name) with this notification list and then run the sm_service command with the long argument.
But do i need to change this piece
filterRuleSet = "notifier/mail/MAIL-SERVICE-filter.asl"
customRuleSet = "notifier/mail/MAIL-SERVICE-custom.asl"