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

How to use the community of the element in Automation Scripts

18 views9 hours agoAutomation script solution automatization scripts
0
Romain Dabe [DevOps Advocate]259 10 hours ago 0 Comments

Hello,

We would like to use several parameters of an element in an Automation script.

More specifically, we would like to retrieve the Polling IP and the SNMP Read community string, in order to trigger device-related actions directly on the device.

Below is what we have tried so far. However, the Read Community and Write Community values are always empty. We also tried setting/checking EnableSNMP = false, but this did not change the result.

<code class="language-csharp">using Skyline.DataMiner.Automation;

public class Script
{
    public void Run(Engine engine)
    {
        ScriptDummy dummy = engine.GetDummy("dummy1");

        engine.ShowUI(
            "Element: " + dummy.ElementName + "\n" +
            "IP: " + dummy.PollingIP + "\n" +
            "EnableSNMP: " + dummy.ElementInfo.EnableSNMP + "\n" +
            "Read Community: [" + dummy.ElementInfo.SnmpReadCommunityString + "]\n" +
            "Write Community: [" + dummy.ElementInfo.SnmpWriteCommunityString + "]"
        );
    }
}</code>

Could you please confirm whether it is possible to retrieve these values from an Automation script?
If so, could you provide an example of how this should be done in C#?

Many thanks,
Romain

Paulo Henriques [SLC] [DevOps Advocate] Answered question 9 hours ago

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
1
Paulo Henriques [SLC] [DevOps Advocate]1.59K Posted 9 hours ago 0 Comments

Hi Romain,

Yes, this is possible, but not via dummy.ElementInfo.SnmpReadCommunityString / SnmpWriteCommunityString (those often come back empty).

For Automation scripts, the reliable approach is to read the SNMP credentials from the element port configuration (ElementPortInfo) using  GetLiteElementInfo and LiteElementInfoEvent:

<code class="font-mono whitespace-pre text-body-small leading-body-small">using Skyline.DataMiner.Automation;
using Skyline.DataMiner.Net.Messages;
using System.Linq;
using System.Text;

public class Script
{
    public void Run(Engine engine)
    {
        ScriptDummy dummy = engine.GetDummy("dummy1");
        Element element = engine.FindElement(dummy.ElementName);

        var request = new GetLiteElementInfo
        {
            DataMinerID = element.DmaId,
            ElementID = element.ElementId
        };

        var lite = (LiteElementInfoEvent)Engine.SLNet.SendSingleResponseMessage(request);

        var sb = new StringBuilder();
        sb.AppendLine("Element: " + dummy.ElementName);
        sb.AppendLine("Polling IP (dummy): " + dummy.PollingIP);

        foreach (ElementPortInfo port in lite.PortInfo.Where(p => p.ProtocolType.ToString().StartsWith("Snmp")))
        {
            sb.AppendLine($"Port {port.PortID} ({port.ProtocolType})");
            sb.AppendLine($"  Get community: [{port.GetCommunity}]");
            sb.AppendLine($"  Set community: [{port.SetCommunity}]");
        }

        engine.ShowUI(sb.ToString());
    }
}
</code>

If you also need to update the credentials, you can modify port.GetCommunity / port.SetCommunity in lite.PortInfo and send them back with AddElementMessage (same pattern as above).

Kind regards.

Paulo Henriques [SLC] [DevOps Advocate] Answered question 9 hours ago
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

© 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