Hi Community,
I would like to retrieve in a script based on view id/name or service id/name the highest severity and the number of alarms according to this highest severity (For 3 critical alarms for view A, and 2 major alarm for view B).
Do you have a script example/template for this?
Thanks
Hello Yvan,
I don't have a template but using variations of the below call should work:
var activeAlarms = engine.SendSLNetSingleResponseMessage(new GetActiveAlarmsMessage([dataminer_id])) as AlarmEventMessage;
From here you can either request the alarms from a particular service, after you find it with call engine.FindService([service_name]") and then use the serviceId as elementId in the GetActiveAlarmsMessage constructor.
For view filtering you can get all the Active Alarms and then filter by the ViewImpactInfo object where it mentions the views that this alarm is part of.
Hope it helps! 🙂
Hello Yvan,
Maybe you can try the following approach:
IDms idms = engine.GetDms();
// Gets the specified view by the id
var view = idms.GetView(viewId);
// Find the highest alarm severity amongst the elements of that view
var highestAlarmLevel = view.Elements.Max(e => e.GetAlarmLevel());
// Get the number of alarms with the highest severity
int countOfHighestAlarms = elements.Count(e => e.GetAlarmLevel() == highestAlarmLevel);
You need to use Skyline.DataMiner.Core.DataMinerSystem.Automation
Hope it helps!
Also a nice way for the View case! 😉