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
    • 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
    • YouTube Videos
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Agility
      • Learn more about 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)
      • Book your Agile Fundamentals training
      • Book your Kanban workshop
    • >> Go to DataMiner Docs
  • DevOps
    • About the DevOps Program
    • Sign up for the DevOps Program
    • DataMiner DevOps Support
    • Feature Suggestions
  • Downloads
  • Swag Shop
  • PARTNERS
    • Business Partners
    • Technology Partners
  • Contact
    • Sales, Training & Certification
    • DataMiner Support
    • Global Feedback Survey
  • >> Go to dataminer.services

update service by automation with core library

73 views32 minutes ago
2
Juan Falcon348 23 hours ago 2 Comments

Hello Dojo

Im creating service with automation core library and works well, im want to add a logic to update the service if existe but i cant find the funciton to remove elements and add the news

if (dms.ServiceExists(grupoCunico.Key))
{
var serviceExist = dms.GetService(grupoCunico.Key);

}

This is my code working in 10.5.0.0-16294-CU6

ServiceConfiguration serviceConfig = new ServiceConfiguration(dms, grupoCunico.Key);
serviceConfig.Views.Add(dms.GetView(63));
serviceConfig.AdvancedSettings.Protocol = dmsProtocol;
serviceConfig.AdvancedSettings.AlarmTemplate = alarmTemplate;

var gruposTroncales = grupoCunico
.GroupBy(x => new
{
// x.Troncal,
x.HostName,
});
int i = 0;
foreach (var grupo in gruposTroncales)
{
i++;
if (dms.ElementExists(grupo.Key.HostName) )
{
engine.GenerateInformation("=======================================");
//engine.GenerateInformation($"Troncal: {grupo.Key.Troncal}");
engine.GenerateInformation($"Host: {grupo.Key.HostName}");
engine.GenerateInformation("---- Registros del grupo ----");

var filters1 = new List<ElementParamFilterConfiguration>();
var filters2 = new List<ElementParamFilterConfiguration>();
foreach (var item in grupo)
{
engine.GenerateInformation(
$"{item.Itm} | {item.IE_Name} | {item.MAC_IE_Local} | {item.MAC_CajaRemota}"
);
filters1.Add(new ElementParamFilterConfiguration(5003, "*", true));
filters1.Add(new ElementParamFilterConfiguration(5004, "*", true));
filters1.Add(new ElementParamFilterConfiguration(5005, "*", true));
filters1.Add(new ElementParamFilterConfiguration(1407, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1419, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1420, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1407, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1405, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1408, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1427, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1412, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1413, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1417, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1418, "*" + item.IE_Name + " * ", true));
filters1.Add(new ElementParamFilterConfiguration(1431, "*" + item.IE_Name + " * ", true));

}
var element1 = dms.GetElement(grupo.Key.HostName);

serviceConfig.AddElement(element1.DmsElementId, filters1);
var includedElements = serviceConfig.IncludedElements;
int j = 1;
foreach (var includedElement in includedElements)
{
//includedElement.Alias = "device" + j;
includedElement.IncludedCapped = Skyline.DataMiner.Core.DataMinerSystem.Common.AlarmLevel.Normal;
j++;
}

}
}
agent.CreateService(serviceConfig);

Thanks

Juan Falcon Posted new comment 32 minutes ago
Tom Waterbley [SLC] [DevOps Enabler] commented 7 hours ago

Hi Juan, I believe that creating a service with the same name overwrites the existing one. But not completely sure.

Juan Falcon commented 32 minutes ago

correct, creating again the service gets error for existing.

0 Answers

  • Active
  • Voted
  • Newest
  • Oldest
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

© 2026 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