Hello Dojo Community !
I have been working on an automation script with additional logic to clear out week old Correlated warning alarms that have their 'auto-clear' functionality disabled. The original script was kindly provided by Joachim from Dojo community :
SLC-AS-ClearNoticeAlarmsOlderThanAWeek/Clear Notice Alarms Older Than A Week_1/Clear Notice Alarms Older Than A Week_1.cs at master · SkylineCommunications/SLC-AS-ClearNoticeAlarmsOlderThanAWeek (github.com)
previous question : Method of Clearing Alarms from the alarm console using an Automation script - DataMiner Dojo
I’ve managed to select and filter the necessary alarm properties (AlarmID, Element ID, Hosting ID, Source, Value) using the SLNet Client tool. However, after executing the provided script in Visual Studio and testing in Cube AS validation, I encountered errors.
It appears that one of the arguments I’m passing isn’t correct. I receive an error stating the constructor takes 4 arguments in the format (int, int, int, string)
. Given that our DM version is 10.3.0.0-13184, I suspect that some .NET methods might behave differently. Also the Alarm is not getting cleared as expected (manually we do this by right click on the alarm and selecting the option 'clear alarm')
Could anyone kindly help me identify which argument might be incorrect and suggest how to adapt the script for my environment? I’d appreciate any guidance on fixing the issue so that the script clears the alarms as expected.
Thank you for your continued support!
Hi, version 10.4.9 of the Skyline.DataMiner.Dev.Automation NuGet package is referenced in the C# project on this line. Since you are using an older DataMiner version, it would be better if version 10.3.0.21 is referenced instead. This can also be changed using the package manager in Visual Studio.
After changing the version, you should see that an error is shown in Visual Studio if something doesn't exist yet in the older NuGet package.
The problem seems to be that the "TreeID" property is missing on the alarms. I think this can be solved as follows (untested):
var clearingMessage = $"Cleared the alarm with TreeID '{alarm.DataMinerID}/{alarm.RootAlarmID}' from Automation.";
SetAlarmStateMessage setAlarmStateMessage = new SetAlarmStateMessage(alarm.DataMinerID, alarm.RootAlarmID, (int)Skyline.DataMiner.Net.Enums.AlarmUserStatus.Clear, clearingMessage);
engine.SendSLNetMessage(setAlarmStateMessage);
Hi, could you please try using value ‘7’ instead of the enum as value for the third argument? But that should be the same, and according to what I can find in other examples it should work.
Hi Tom ,
Thank you for your help , using ‘7’ instead of enum , SLNET is able to create the message . Out of curiosity is there a way / method to directly clear the alarm from the alarm console ( as we do manually by right clicking on an alarm and select ‘clear alarm”) rather then SLNET client tool as I realized some of our servers /DMA we work on are not owned by us but still have admin privilege’s to utilize Cube but may not have the ability to run SLNET client tool, so might face issue on that.
Hi, SLNet client test tool uses the same type of connection of Cube, with the same previleges. So you should be able to perform the actions on those DMAs as well. Please always be careful when doing things with the test tool though.
Hi Tom,
I have been trying to troubleshoot it but we are still receiving the same error :
” Failed to clear alarm with RootAlarmID ‘127510621’. Error: You don’t have permission to perform this action.
(Script ‘Clear Notice Alarms Older Than A Week’)”
“2024/10/07 08:16:20.086|SLAutomation.exe 10.3.2243.12260|16140|25728|CSharp|DBG|5|(Script Clear Notice Alarms Older Than A Week/2) Extended Error Info:
(Code: 0x80131500) Skyline.DataMiner.Automation.ScriptAbortException: RunSafe|Something went wrong.
at Skyline.DataMiner.Automation.Engine.ExitFail(String reason)
at ClearNoticeAlarmsOlderThanAWeek_1.Script.RunSafe(IEngine engine)
at ClearNoticeAlarmsOlderThanAWeek_1.Script.Run(IEngine engine)
2024/10/07 08:16:20.086|SLAutomation.exe 10.3.2243.12260|16140|25728|CScriptLoader::ExitNow|DBG|-1|[ABM Siddique] (Script Clear Notice Alarms Older Than A Week) EXIT: “RunSafe|Something went wrong.”
2024/10/07 08:16:20.087|SLAutomation.exe 10.3.2243.12260|16140|25728|CScriptLoader::FinalActions|DBG|3|[ABM Siddique] (Script Clear Notice Alarms Older Than A Week) Script execution FAILED
2024/10/07 08:16:20.087|SLAutomation.exe 10.3.2243.12260|16140|25728|CAutomation::Execute|INF|0|[ABM Siddique] Finished executing script: ‘Clear Notice Alarms Older Than A Week’ (ID: 174) – FAILED – Execution took 00.394s.”
I believe it is because of the DMA server restrictions we have that is not allowing to go through with the script action (have DM admin privileges’). Thank you
Thank you Tom for your advice and i have downgraded the Nuget package to 10.3.0.2. I just wanted to know , if the (int)Skyline.DataMiner.Net.Enums.AlarmUserStatus.Clear, // Clear Status
Would this argument work to the version to clear the alarm or should I use something else ? execution is successful with no error but the alarm is not clearing