Hi,
Is there a way to Set/Remove alarm templates of a list of elements/services from a protocol? I know it's possible with Automation script but ideally I would like to achieve this in protocol level.
If not possible, then can someone please advise on how to trigger an automation script with passing parameters from a protocol?
Thanks
Hi Paul,
You should be able to adapt from the answer to this other question How to use the InterApp Class to make bulk alarm template changes - DataMiner Dojo
If you skip the InterApp part, you should be able to use IDmsElement and IDmsProtocol to achieve what you are after either from an automation script or a QAction.
For completeness of your questions, to launch a script from a QAction you can have a loop into the method ExecuteScript | DataMiner Docs and more details on the configurations of the input parameter here Class ExecuteScriptMessage | DataMiner Docs
Hi Paul,
You could use something like
var dms = protocol.GetDms();
var protocol = dms.GetProtocol(“MyProtocolName”, “1.0.0.1”);
var template = protocol.GetAlarmTemplate(“MyTemplateName”);
var element = dms.GetElement(“MyElementName”);
element.AlarmTemplate = template;
element.Update();
Or as another option
var dms = protocol.GetDms();
var element = dms.GetElement(“MyElementName”);
var template = element.Protocol.GetAlarmTemplate(“MyTemplateName”);
element.AlarmTemplate = template;
element.Update();
To remove the alarm template you should be able to pass null value to the property.
Hi Joao, thanks for your reply which works perfect on elements. However, I am also working on services as well as elements. I have got below but it does not seem to assign or remove the alarm template. Could you please let me know whether this is correct approach? Or is there any other way to do this? I have also tried obtaining the underlying element to assign/remove alarm templates but it doesn’t seem to always work. Thanks for your help, really appreciate it.
IDms dms = protocol.GetDms();
var dmsService = dms.GetService(new DmsServiceId(dmaId, serviceId));
IDmsAlarmTemplate template = dmsService.AdvancedSettings.ServiceElementAlarmTemplate.Protocol.GetAlarmTemplate(strAlarmTemplateName);
dmsService.AdvancedSettings.ServiceElementAlarmTemplate = template;
dmsService.Update();
Hi Paul,
I am not too familiar with the implementation of services but I would expect it to be similar.
I would wait to see if someone provides some more input, otherwise, I would reach out to your Skyline contact to verify if we are in the presence of an issue or not.
Hi Joao, thanks for your help. This is really useful. Just one further question from me. In the other thread, you mentioned assign alarm template with below property but I’m wondering if you have an example for this as I find it hard to understand how to use that property. I tried below but it seems I need iAlarmTemplate type rather than a string.
IDms dms = protocol.GetDms();
IDmsElement element = dms.GetElement(new DmsElementId(dmaId, elementId));
element.AlarmTemplate = “”;
https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Core.DataMinerSystem.Common.IDmsElement.AlarmTemplate.html#Skyline_DataMiner_Core_DataMinerSystem_Common_IDmsElement_AlarmTemplate