I am trying to get past alarms from a DMA. For example, alarms between the dates 11/07/2020 - 11/12/2020. I was looking at the list of SLNet calls and saw a "GetHistoryAlarmsMessage". I am not sure if this is the correct call to use, but I did use it in the client test tool, however, I was not able to see earlier alarms from that day. Any suggestions on how I can retrieve older alarms or how to correctly use the "GetHistoryAlarmsMessage" would be greatly appreciated.
Hello, In QA we use the GetAlarmDetailsFromDbMessage to retrieve history alarms or information events. If you don't need any filter, you need to use new Skyline.DataMiner.Net.Filters.AlarmFilterTrue() as filter in the message.
public List<AlarmEventMessage> checkHistoryAlarm(QAElement e, DateTime dtStart, DateTime dtStop) { AlarmFilter AF = new AlarmFilter(); AlarmFilterItem AFIelement = new AlarmFilterItemString(AlarmFilterField.ElementID, AlarmFilterCompareType.WildcardEquality, new string[] { e.GetElementName() }); AF.FilterItems = new AlarmFilterItem[] { AFIelement }; GetAlarmDetailsFromDbMessage GADFMDB2 = new GetAlarmDetailsFromDbMessage(e.HostingDMAID, AF, dtStart, dtStop, true, false); DMSMessage[] DMSarr = Engine.SLNet.SendMessage(GADFMDB2); List<AlarmEventMessage> AlarmList = new List<AlarmEventMessage>(); foreach (AlarmEventMessage AEM in DMSarr) { AlarmList.Add(AEM); } return AlarmList; }
Regards,
Moderator note: This is an internal call and we do not recommend using this, as it is not officially supported and we cannot guarantee that it will still work in the future. As a rule, you should avoid using SLNet calls, as these are subject to change without notice.
Hi Julian
I'm just making an Automation Script that needs to retrieve all the alarms from the last day. The call I use for this is the GetAlarmDetailsFromDbMessage.
var message = new GetAlarmDetailsFromDbMessage
{
StartTime = start,
EndTime = end,
Filter = new Skyline.DataMiner.Net.Filters.AlarmFilter(),
AlarmTable = true,
};var responses = engine.SendSLNetMessage(message);
These responses will be of the AlarmEventMessage type.
Note that this is an internal call and we do not recommend using this, as it is not officially supported and we cannot guarantee that it will still work in the future. As a rule, you should avoid using SLNet calls, as these are subject to change without notice.
Hello,
As the other answers mentioned, the GetAlarmDetailsFromDBMessage is a good start.
As Michiel Oda mentioned, this could be subject to change. As it so happens, since internal RN26019 this has happend and this request is marked as "obsolete". It will still work, but it might be behaving diffrently due to CassandraCluster.
A better approach, since 10.1.0 main release would be to use the Repository API for Alarms.
//FetchRepository code here
var alarmRepository = repositoryRegistry.Get<IAlarmRepository>();
alarmsFromDb = alarmRepository.Read(alarmFilter, startTime, endTime, squashed)
.Cast<AlarmEventMessage>()
.ToList();
Would be the correct new way to do this. This is just for future reference