Unsolved
This post is more than 5 years old
1 Rookie
•
4 Posts
0
166773
March 23rd, 2012 14:00
Alarm Escalation
I would like to set up escalation in our alarms. For example: If alarm "a" isn't acknowledges within 30 minutes, escalate the alarm to the next person.
Anyone done this before? It's a pretty common setup on monitoring tools. I wouldn't think it would be too hard to do.


DELL-Thomas B
171 Posts
0
March 23rd, 2012 17:00
I've not done one for a specific alarm, but it certainly can be done. Below is the sample rule code that could be used to drive all rules of fatal/critical after a period of time. It relies on several registry variables (registrySrvc items) but you could just hard code those as well.
import com.quest.nitro.service.sl.interfaces.email.EmailRequest;
currentTime = new Date().getTime();
currentAlarms = server ['AlarmService']. getCurrentAlarms();
registrySrvc = server ['RegistryService'];
expirationPeriodMinutes = 30; // registrySrvc. lookupDefault ("escalation.experiationPeriodMinutes");
expirationPeriodMSecs = expirationPeriodMinutes * 60 * 1000;
minSeverityToCheck = 4; // registrySrvc. lookupDefault ("escalation.minSeverity");
rulePattern = '.'; // registrySrvc. lookupDefault ("escalation.rulePattern");
mailTo = registrySrvc. lookupDefault ("mail.recipient"); // registrySrvc. lookupDefault ("escalation.mail.recipient");
subject = "Foglight Alert Escalation";
body = "";
totalAlarmsNotAck = 0;
for (currentAlarm in currentAlarms)
{
// check if the alarm has not been acknowledged - cleared alarms aren't in the service anymore
// and make sure the alarm has been around for at least the expiration period
// and make sure it has the correct level of severity
// and make sure it matches the rule pattern
if (
(!currentAlarm. getIsAcknowledged()) &&
(currentAlarm. getSeverity() >= minSeverityToCheck) &&
((currentTime - currentAlarm. getCreatedTime(). getTime()) > expirationPeriodMSecs) &&
((currentAlarm. getSourceName() =~ rulePattern). find())
)
{
totalAlarmsNotAck++;
singleAlarmMessage = "Alarm Message --> " + currentAlarm. getMessage() + "\n";
singleAlarmMessage += "Severity --> " ;
switch (currentAlarm. getSeverity())
{
case 2: singleAlarmMessage += "Warning";
break;
case 3: singleAlarmMessage += "Critical";
break;
case 4: singleAlarmMessage += "Fatal";
}
singleAlarmMessage += "\n";
singleAlarmMessage += "\n";
body += singleAlarmMessage;
}
}
if (totalAlarmsNotAck > 0)
{
completeBody = "Total Alarms not acknowledged in the last " + expirationPeriodMinutes + " Minutes: " + totalAlarmsNotAck;
completeBody += "\n";
completeBody += "\n";
completeBody += body;
// Output to the foglight log file
// System.out.println (completeBody);
EmailRequest email= new EmailRequest();
email. setRecipients (mailTo);
email. setSubject (subject);
email. setBody (completeBody);
server ['EmailService']. sendMail (email);
}
return false;
DELL-Thomas B
171 Posts
0
March 23rd, 2012 20:00
When you create a new rule, select simple rule and not have a scopy query and set it to fire every X minutes or such. Then this would be the rule text, making changes to the rule variables and bits to fit your environment. I could probably walk you through it on a short phone call next week.
smrshl1
1 Rookie
•
4 Posts
0
March 23rd, 2012 20:00
Thanks Thomas! Can you tell me where I would plug this in at?
smrshl1
1 Rookie
•
4 Posts
0
March 26th, 2012 14:00
Thomas - if you could do that, it would be awesome. Send me an email and I'll reply with my telephone number. steven.marshall at viaero.com