Hi Dojo,
This question was asked a year ago: Take ownership of a correlated alarm - DataMiner Dojo
However, the proposed solution - shift-select the top alarm and its base alarms, right-click and acknowledge - is not quite elegant and prone to human error.
From that answer I understand that the desired behavior - Acknowledge all base alarms when the correlation alarm is acknowledged - is not implemented in the software.
My question then is:
Is it possible to achieve the desired behavior using Automation? For example, build a script that takes the alarm ID of the correlation alarm, finds all base alarms of that correlation alarm and acknowledges them all?Can I find a script somewhere that processes alarms in a similar way?
Thanks!
Hi Alexander,
In the correlation rule, you can pass info to an automation script.
See https://docs.dataminer.services/user-guide/Advanced_Modules/Automation_module/FAQ/How_do_I_parse_Correlation_Alarm_Info_data.html.
In the script, you can get the info with this code snippet.
public CorrelationAlarmInfo(ScriptParam paramCorrelationAlarmInfo)
{
string alarmInfo = paramCorrelationAlarmInfo.Value;
string[] parts = alarmInfo.Split('|');alarmID = Tools.ToInt32(parts[0]);
dmaID = Tools.ToInt32(parts[1]);
elementID = Tools.ToInt32(parts[2]);
parameterID = Tools.ToInt32(parts[3]);
parameterIdx = parts[4];
rootAlarmID = Tools.ToInt32(parts[5]);
prevAlarmID = Tools.ToInt32(parts[6]);
severity = Tools.ToInt32(parts[7]);
type = Tools.ToInt32(parts[8]);
status = Tools.ToInt32(parts[9]);
alarmValue = parts[10];
alarmTime = DateTime.Parse(parts[11]);
serviceRCA = Tools.ToInt32(parts[12]);
elementRCA = Tools.ToInt32(parts[13]);
parameterRCA = Tools.ToInt32(parts[14]);
severityRange = Tools.ToInt32(parts[15]);
sourceID = Tools.ToInt32(parts[16]);
userStatus = Tools.ToInt32(parts[17]);
owner = parts[18];
impactedServices = parts[19];properties = new Dictionary<string, string>();
int amountProperties = Tools.ToInt32(parts[20]);
for (int i = 0; i < amountProperties; i++)
{
string propertyName = parts[21 + i * 2];
string propertyValue = parts[21 + i * 2 + 1];if (!properties.ContainsKey(propertyName))
{
properties.Add(propertyName, propertyValue);
}
}
}
With the alarm id, you can further get the base alarms with this snippet and acknowledge it with https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Automation.Engine.AcknowledgeAlarm.html.
/// <summary>
/// Returns a list with all the basealarms of a correlated alarm
/// </summary>
private AlarmTreeEventMessage[] GetBaseAlarms(int dmaId, int correlationAlarmId)
{GetCorrelationBaseAlarmDetailsMessage msg = new GetCorrelationBaseAlarmDetailsMessage()
{
AlarmID = correlationAlarmId,
DataMinerID = dmaId,
EntireTree = false
};DMSMessage[] responses = _engine.SendSLNetMessage(msg) ?? new DMSMessage[0];
List<AlarmTreeEventMessage> alarms = new List<AlarmTreeEventMessage>();
foreach(CorrelationDetailsEventMessage resp in responses)
{
alarms.AddRange(resp.BaseAlarmTrees.Cast<AlarmTreeEventMessage>().ToList());
}return alarms.ToArray();
}Note that I didn't test this flow fully(those are snippets from our regression tests) but this will give you some idea on how to achieve this, hope that this helps.
The SLNetClientTest_tool can also help on how to test this, see https://docs.dataminer.services/user-guide/Reference/DataMiner_Tools/SLNetClientTest_tool.html.Moderator note:
SLNet calls: These is an internals 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.
SLNetClientTest_tool: Always be extremely careful when using this tool, as it can have far-reaching consequences on the functionality of your DataMiner System.
Regards,