Hi, I'm looking for a method in automation of getting alarms for Elements. Is there a way of getting a table of alarms over a historical time period from the system? I need this to be in a script rather than a dashboard or LCA because based on the data I'll be carrying out further automation and config of Elements. Correlation is probably an option but I'd rather full control if it's possible. I think I've searched through docs but nothing is standing out to me at the moment. Thanks.
Hi Ross,
To get Historic alarms in an automation script there are 2 ways:
- Using the AlarmRepository, see this example for a GQI DataSource, but it can be used in a very similar way in automation scripts.
- Using the GetAlarmDetailsFromDbMessage:
var message = new GetAlarmDetailsFromDbMessage
{
StartTime = start,
EndTime = end,
Filter = new Skyline.DataMiner.Net.Filters.AlarmFilter(),
AlarmTable = true,
};var responses = engine.SendSLNetMessage(message);
This will return an array of AlarmEventMessages.
It's not super user friendly, but this is the way to make custom Alarm filters:
AlarmFilter customFilter = new AlarmFilter()
{
FilterItems = new AlarmFilterItem[]
{
new AlarmFilterItemInt(AlarmFilterField.ViewName, new int[] { 123 }),
new AlarmFilterItemOperator(AlarmFilterOperator.And),
new AlarmFilterItemInt(AlarmFilterField.Protocol, new int[] { 456, 789 })
}
};
The AlarmFilterField Enum has options for Protocol and View.
Hi, thanks for the response it's really helpful. How do I use the filter? I can see the new AlarmFilter() has a Key and a Name, what do they refer to? How can I for example, filter by Severity, Protocol or View etc?