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

Automation – Check which services an element is part of

Solved57 views1 day agoAutomation script
2
Jeroen Geldhof [SLC] [DevOps Enabler]5.16K 1 day ago 0 Comments

I would like to check if a list of elements are part of services before I would remove them from the system.
I tried checking if there are any flags on the element that would indicate it's part of a service, but I don't see any.
Is there an easy way to check if an element is part of a service in an automation script?

Jeroen Geldhof [SLC] [DevOps Enabler] Selected answer as best 1 day ago

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
1
Miguel Obregon [SLC] [DevOps Catalyst]19.65K Posted 1 day ago 2 Comments

Hi Jeroen,

Not a direct answer to your question. There is an ad-hoc data source that provides this information: SLC-GQIDS-GetAllElementsInService. From here you could:

  • Reuse the code available in the ad-hoc data source in your automation script.
  • Use the ad-hoc data source in a dashboard/LCA to retrieve this information.

Hope it helps.

Jeroen Geldhof [SLC] [DevOps Enabler] Posted new comment 1 day ago
Jeroen Geldhof [SLC] [DevOps Enabler] commented 1 day ago

Hi Miguel. Unfortunately it seems to do the opposite and returns the elements in a given service.
I'm looking for a way to check which services a given element is part of.

At the moment I think the only way is to go over all services to build a map of the elements they contain and then to cross-check that against the list of elements I'd like to check.

Jeroen Geldhof [SLC] [DevOps Enabler] commented 1 day ago

below is the code that works best for my use-case.

public static string[] hcoConnectors = new string[]
{
"Evertz 7800R2x2-ACS-3G",
"Snell Wilcox HCO51 RollCall",
"Snell Wilcox IQHCO3193-1A"
};

private void RunSafe(IEngine engine)
{
IDms thisDms = engine.GetDms();

//This gets all the services in the DMS
ICollection<IDmsService> allServices = thisDms.GetServices();

List<IDmsElement> allStandaloneElementsForHCOs = new List<IDmsElement>();

// Collect all HCO elements
foreach (string connector in hcoConnectors)
{
Element[] elementsForConnector = engine.FindElementsByProtocol(connector);
foreach (Element element in elementsForConnector)
{
IDmsElement myElement = thisDms.GetElement(element.ElementName);
if (myElement != null)
{
allStandaloneElementsForHCOs.Add(myElement);
}
}
}

// Collect all element IDs associated with services
HashSet<(int DataMinerId, int ElementId)> serviceElementIds = new HashSet<(int, int)>();
foreach (IDmsService service in allServices)
{
ServiceParamSettings[] parameters = service.ParameterSettings.IncludedParameters;
foreach (ServiceParamSettings parameter in parameters)
{
int dataMinerId = parameter.DataMinerID;
int elementId = parameter.ElementID;
serviceElementIds.Add((dataMinerId, elementId));
}
}

// Build email content for unused HCO elements
StringBuilder emailBody = new StringBuilder();
emailBody.AppendLine("Overview of Unused HCO Elements:");
emailBody.AppendLine("——————————–");
bool hasUnusedElements = false;

foreach (IDmsElement hcoElement in allStandaloneElementsForHCOs)
{
if (!serviceElementIds.Contains((hcoElement.AgentId, hcoElement.Id)))
{
hasUnusedElements = true;
emailBody.AppendLine($"Element: {hcoElement.Name} (DataMinerId: {hcoElement.AgentId}, ElementId: {hcoElement.Id})");
}
}

// Send email if there are unused elements
if (hasUnusedElements)
{
string subject = "Unused HCO Elements Report – " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
string body = emailBody.ToString();
string to = "jeroen.geldhof@skyline.be";

engine.SendEmail(body, subject, to);
engine.GenerateInformation("Email sent with overview of unused HCO elements.");
}
else
{
engine.GenerateInformation("No unused HCO elements found.");
}
}

You are viewing 1 out of 2 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