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

Alarm severity from view in automation script

Solved1.69K views12th January 2024alarm Automation view
2
André Kaiser [DevOps Advocate]532 4th July 2023 0 Comments

Hi Dojo,

I have a question, that derives from this thread.

I would like to use the alarm state of a view (respective the highest severity of alarms in all views below that view) as variable in an automation script. Is there a method to retrieve that value from a view? This should then finally used to set a value of a property for this view.

My scripts looks like this and is working well with a fixed value instead of the alarm severity variable and includes some exception handling already.


public class Script

{

    public void Run(Engine engine)
    {
        ViewInfoEventMessage[] allViews = GetViews();
        
        if(allViews == null)
        {
            engine.ExitFail(“No views were found”);
        }
    
        foreach(ViewInfoEventMessage view in allViews)
        {
            // do the filtering of views you want to update
            if(view.Name.Equals(“ABC”))
                {    
                    UpdateViewProperty(view,”ABC”,“12345”,engine);
                }
        }
    }

    public void UpdateViewProperty(ViewInfoEventMessage view, string propertyName, string propertyValue, Engine engine)
    {
        SetDataMinerInfoMessage request = new SetDataMinerInfoMessage();
        request.bInfo1 = Int32.MaxValue;
        request.bInfo2 = Int32.MaxValue;
        request.DataMinerID = -1;
        request.ElementID = -1;
        request.HostingDataMinerID = -1;
        request.IInfo1 = Int32.MaxValue;
        request.IInfo2 = Int32.MaxValue;

        SA sa = new SA();
        sa.Sa = new String[] { propertyName, “read-write”, propertyValue };
        PSA psa = new PSA();
        psa.Psa = new SA[] { sa };
        request.Psa2 = psa;

        request.StrInfo1 = $”view:{view.ID}”;
        request.What = 62;
        SetDataMinerInfoResponseMessage response = engine.SendSLNetSingleResponseMessage(request) as SetDataMinerInfoResponseMessage;
        
        if (response.iRet != 0)
        {
            engine.GenerateInformation($”Update of property {propertyName} on View {view.Name} was not OK”);
        }
    }

    public ViewInfoEventMessage[] GetViews()
    {
        var getViewsList = new GetInfoMessage
    {
            
    DataMinerID = -1,
    Type = InfoType.ViewInfo
};

DMSMessage[] dmsma = Engine.SLNet.SendMessage(getViewsList);

if (dmsma == null)
{
    return null;
    }

        return Array.ConvertAll(dmsma, input => (ViewInfoEventMessage)input);
    }
}

Could you enlighten me?

Many thanks in advance and best regards

André

André Kaiser [DevOps Advocate] Answered question 12th January 2024

5 Answers

  • Active
  • Voted
  • Newest
  • Oldest
3
Stacey Van Colen [SLC] [DevOps Advocate]2.54K Posted 5th July 2023 0 Comments

Hi André,

The following script should allow you to get the state of the view. You only need to provide the viewID, and then you’ll get an information event with the State of the view.

namespace getviewstate_1
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Skyline.DataMiner.Automation;

/// <summary>
/// Represents a DataMiner Automation script.
/// </summary>
public class Script
{
/// <summary>
/// The script entry point.
/// </summary>
/// <param name=”engine”>Link with SLAutomation process.</param>
public void Run(IEngine engine)
{
int iView = 4;
Skyline.DataMiner.Net.Messages.GetViewStateMessage getview = new Skyline.DataMiner.Net.Messages.GetViewStateMessage();
getview.ViewID = iView;
getview.IncludeChildViews = false;

Skyline.DataMiner.Net.Messages.GetViewStateResponse mess = (Skyline.DataMiner.Net.Messages.GetViewStateResponse)Engine.SLNet.SendMessage(getview)[0];
  engine.GenerateInformation(“View Level : ” + mess.States[0].Level.ToString());  
}
}
}

I took the liberty of putting this script already on the staging system with the name ‘GetViewLevel’.

Hope this gives you the information you were looking for.

Kind regards,

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 10th July 2023
2
Leander Druwel [SLC] [DevOps Member]2.02K Posted 5th July 2023 0 Comments

Hey Andre, any chance that you could further elaborate on the specific use case you’re trying to cover? As Stacey indicates, it is surely possible to get the alarm state from an automation script, but it might be good to understand the eventual purpose of it.

I notice that you’re also setting a property on the view according to the highest severity.

Just to see if there are other ways to achieve the end goal. 🙂

Thx

Leander Druwel [SLC] [DevOps Member] Answered question 5th July 2023
0
André Kaiser [DevOps Advocate]532 Posted 12th January 2024 0 Comments

I studied the script condition documentation on https://docs.dataminer.services/user-guide/Advanced_Modules/Correlation/Correlation_rule_syntax/Script_condition_functions.html

The script created via the help given above sets the a value for the property “BC_RP21 Alarm” on the view “RP21”. So to achieve what I asked in my last comment it might be good to use a script condition to compare, if the highest alarm, that enters the correlation rule (through a filter) is not equal to the actual property value. This would allow us to limit the execution of the script only when the highest alarm severity is above or below the actual severity of the view ( = property value).

Is it possible to compare to values to achieve the following condition:
“highest severity in filtered active alarms” not equal to “property value”

A script condition then might look like this:
max(field(severity)) != property(view.BC_RP21 Alarm)

… or must there be a integer/string value on the right side of the logic equation?

Many thanks and best regards

André Kaiser [DevOps Advocate] Answered question 12th January 2024
0
André Kaiser [DevOps Advocate]532 Posted 10th July 2023 1 Comment

Hello again,
looks like the script is doing, what it should do, but the trigger by a correlation rule is very sensitive and triggers the script N times depending on the number of active alarms in that view. I played a bit with various configurations of the correlation rule, but I did not find the right configuration to trigger the correlation only upon change of the alarm level of the view. I thought this might work via alarm grouping, but it doesn’t. My current configuration filters for alarm changes (New, escalated, dropped, masked, unmasked), which reduces the sensitive, but this does not resolve the root cause.
In an ideal scenario the correlation rule would only trigger the script when the severity of the view changes. In the recent configuration the correlation rule evaluates all active alarms in the view and triggers the script once per active alarm, that matches the filter / conditions. Thisworks, but is not pretty elegant and unnecessarily consumes processing resources.

André Kaiser [DevOps Advocate] Posted new comment 14th November 2023
André Kaiser [DevOps Advocate] commented 14th November 2023

In an ideal scenario the correlation rule would only trigger the script when the severity of the view changes. In the recent configuration the correlation rule evaluates all active alarms in the view and triggers the script once per active alarm, that matches the filter / conditions.

Would there be someone who could imagine of a script condition, to filter out only changes on the highest severity in the view?

0
André Kaiser [DevOps Advocate]532 Posted 7th July 2023 0 Comments

Hello and many thanks!
I merged the GetViewLevel function into the script and got it working now. The property updates according to the current alarm level of the view. I just have to tweak my correlation rule to only be triggered on a change of the alarm level and not on any change on an alarm on the elements below.

The purpose behind is, that an external system. reads the properties of this view and shows a traffic light summary alarm in its UI. It uses the GetViewProperty method on the DM WebService already for other purposes and we want to avoid to implement another method in the driver just to get one single value from DataMiner. Otherwise there would be suitable WebService methods available out of the box.

André Kaiser [DevOps Advocate] Answered question 7th July 2023
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