Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Empower Replay: Limited Edition
    • Tutorials
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
      • About the DevOps Program
      • DataMiner DevOps Support
  • Downloads
  • More
    • DataMiner Releases & Updates
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

Set alarm template of a service

Solved603 views5th June 2024alarm template Automation script
1
Paul Lee [DevOps Member]595 22nd March 2024 0 Comments

I have built a protocol that can remotely set/remove alarm template for selected elements/services. It works fine with elements but for some reason it does not always work with services although I used the underlying element Id instead of the service Id. I am getting "Value does not fall within the expected range" error when running IDmsElement.Update() when IDmsElement being an underlying element of a service.

I even tried building a automation script like below but it's still giving parameter is incorrect error when it tries to set alarm templates for the service. Again, it works fine with elements.

Could someone please advise on how to resolve this problem or if it's not possible to set an alarm template for a service remotely in a reliable fashion. Thanks.

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 5th June 2024

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
0
Michiel Oda [SLC] [DevOps Enabler]3.61K Posted 22nd March 2024 9 Comments

Hi Paul

Instead of IDmsElement, you can use IDmsService when working with services (dms.GetService(serviceName)). That has it's own property for setting the alarm template.

Property ServiceElementAlarmTemplate | DataMiner Docs

EDIT:

A fix has been released in version 1.1.1.7 of the Skyline.DataMiner.Core.DataMinerSystem NuGet package. By following below code you can assign an alarm template to an enhanced service:

// Get service
IDmsService dmsService = dms.GetService("MyService");

// Get template from the protocol from the service
IDmsAlarmTemplate dmsAlarmTemplate = dmsService.AdvancedSettings.ServiceElementProtocol.GetAlarmTemplate("MyTemplate");

// Update the template property with the new template
dmsService.AdvancedSettings.ServiceElementAlarmTemplate = dmsAlarmTemplate;

// Update the service
dmsService.Update();

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 5th June 2024
Paul Lee [DevOps Member] commented 22nd March 2024

Hi Michiel, thanks for your reply. I also have tried below code but it did not work either. Could you please tell me if I’m using it in a correct way?
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();

Michiel Oda [SLC] [DevOps Enabler] commented 22nd March 2024

At first glance, this seems ok. Are you getting any exceptions or errors?

Paul Lee [DevOps Member] commented 22nd March 2024

Yes I’m getting Object reference not set to an instance of an object. exception

Michiel Oda [SLC] [DevOps Enabler] commented 22nd March 2024

I don’t have a service on my system, so I can’t quickly test, but NullReferenceExceptions are doable to debug.
I would maybe try changing the line of retrieving the alarm template to this:
IDmsAlarmTemplate template = dmsService.AdvancedSettings.ServiceElementProtocol.GetAlarmTemplate(

If this doesn’t work, then I’ll try to see if I can test locally next week (unless someone can figure it out beforehand)

Paul Lee [DevOps Member] commented 22nd March 2024

Thanks for the suggestion Oda, I have tried the line and it did not give any exceptions. However, it did not actually assign the template to the service unfortunately. Also, assigning null value to the template did not remove the template from the service either. Thanks in advance for testing this next week. Much appreciated.

Show 4 more comments
You are viewing 1 out of 1 answers, click here to view all answers.
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin