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
  • Blog
  • Questions
  • Learning
    • E-learning Courses
    • 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
    • Tutorials
    • 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
    • DataMiner Insights
      • Security
      • Integration Studio
      • System Architecture
      • DataMiner Releases & Updates
      • DataMiner Apps
    • 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
  • Downloads
  • More
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
      • General Inquiries
      • DataMiner DevOps Support
      • Commercial Requests
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

Create Monitors and Presets with an Automation Script

258 views4th February 2025measurement points preset spectrum spectrum monitor
3
Sebastián Cuéllar [SLC] [DevOps Advocate]132 31st January 2025 0 Comments

Hello community,

I am working with an automation script to create Measurement Points, Monitors and Presets for elements running an specific connector with the Spectrum Analyzer feature.

Right now, I am able to create the Measurement Points using this method Method SetMeasurementPoints | DataMiner Docs (this old question was also really helpful to achieve it Can you edit a measurement point of a spectrum analyzer through an automation script? - DataMiner Dojo).

However, I have not been able to continue with the Monitors and Presets creation because I do not know exactly what are the classes/methods that I should use. I have got to these classes Interface IDmsSpectrumAnalyzerMonitors | DataMiner Docs & Interface IDmsSpectrumAnalyzerPresets | DataMiner Docs, specifically to the AddMonitor() and SavePreset() methods, but there is no information how to build the input parameters with the required information. If you know what is the format of these parameters to be used, or any other method to create a Monitor and Present through an Automation Script, do not hesitate contact me.

Wouter Demuynck [SLC] [DevOps Advocate] Answered question 4th February 2025

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
0
Wouter Demuynck [SLC] [DevOps Advocate]5.91K Posted 4th February 2025 2 Comments

Hi Sebastián,

Hope this helps to create monitors/preset and to interpret the data coming out of GetMonitor/GetPreset:

AddMonitor

string[] monitorDetails = new string[]

{
"7", // script ID
"123", // DataMiner ID
"456", // element ID
"300", // interval (seconds)
"My Monitor", // monitor name
"", // monitor description
"false", // disabled (true) or enabled (false)
"10:5", // amount of traces pre/post to save in alarm recordings
"", // measpts to execute upon (comma separated ids)
"false", // auto group parameters (UI setting)
"0", // amount alarm parameters
// if amount alarm parameters is more than zero, entries for each
// alarm parameter are added here
"0", // amount CSV exports
// if amount CSV exports is more than zero, entries for each
// export are added here
};

/*

Alarm Parameter String Info:

Alarm Parameter entries look like this: a number of values separated by “:#:”. There are three formats, depending on whether the final parameter will be a double (analog) or a boolean (true/false discreet) or a saved trace

8:#:pid:#:variablename:#:Description:#:bDisplayed:#:bMonitored:#:bTrended:#:templateType:#:valCH:#:valMaH:#:valMiH:#:valWaH:#:valNormal:#:valWaL:#:valMiL:#:valMaL:#:valCL:#:measPtId:#:presetName:#:bCustomPos:#:iRow:#:iCol:#:BOOL:#:TrueDisplay:#:FalseDisplay
8:#:pid:#:variablename:#:Description:#:bDisplayed:#:bMonitored:#:bTrended:#:templateType:#:valCH:#:valMaH:#:valMiH:#:valWaH:#:valNormal:#:valWaL:#:valMiL:#:valMaL:#:valCL:#:measPtId:#:presetName:#:bCustomPos:#:iRow:#:iCol:#:DOUBLE:#:bUsesCustomRange:#:rangelow:#:rangehigh:#:decimals:#:units
8:#:pid:#:variable name:#:Description:#::#::#::#::#::#::#::#::#::#::#::#::#::#:measPtId:#:presetName:#::#::#::#:TRACE:#:

• “8” => version number. MUST be “8”
• pid => parameter ID (for updates of existing parameters). 2100000000 when a new parameter needs to be created
• variablename => variabele name from script
• Description => parameter description (for use on data display)
• bDisplayed => when “TRUE”, the parameter will be displayed on data display
• bTrended => when “TRUE”, trending will be activated
• templateType => alarm template type: “ABSOLUTE”, “RELATIVE” or “” (empty string; normal).
• valCH/valMaH/…/valMaL/valCL => alarm template boundaries (C, Ma, Mi, Wa = critical, major, minor, warning; L, H = low/high). For normalized parameters (absolute/relative), the valNormal field should contain the normalised value
• measptId => measurement point ID (-1 when not used). This ID is used to add the parameter to the measpt service when this service exists

• presetName => input preset name (if any -- empty when not used)

• bCustomPos => when “TRUE”, the iRow/iCol positions below will be used as a custom page position on datadisplay
• iRow, iCol => custom positions (when bCustomPos == true)
• BOOL/DOUBLE/TRACE => parameter type
• TrueDisplay/FalseDisplay => display values for True/False discreets
• bUseCustomRange => “TRUE” = use custom range (see below)
• rangelow,rangehigh,decimals,units: custom range details

No fields can be omitted from the string.

*/

SavePreset

                object presetData = new object[]                 {
                    // 0. version info
                    new string[]                     {
                        "33" // preset data format version number
                    },

                    // 1. settings
                    new string[]                     {
                        "-100", // reference level (dbm)
                        "10", // reference scale
                        "100000000", // freq center (Hz)
                        "50000000", // freq span
                        "25000000", // freq start
                        "75000000", // freq stop
                        "-1", // VBW
                        "-1", // RBW
                        "-1", // sweeptime
                        "", // description
                        "-1", // SPA_PARAM_INPUT_ATTEN
                        "", // measurement points
                        "0", // SPA_PARAM_PRE_AMPLIFIER
                        "0", // SPA_PARAM_FIRST_MIXER_INPUT
                        "0", // SPA_PARAM_DETECTION_MODE
                        "0", // SPA_PARAM_SCALE_TYPE
                        "", // (not used)
                        "-1",  // SPA_PARAM_AMOUNTPTS (-1 = take from protocol)
"", SPA_PARAM_FACTOR_AUTO_RBW
"", SPA_PARAM_FACTOR_AUTO_VBW
                    },

                    // 2. display settings
                    new string[]                     {
                        "0", // delta mode
                        "1", // show markers?
                        "1", // show reference lines?
                        "3", // frequency display unit? (SSU_HZ = 1, SSU_KHZ = 2, SSU_MHZ = 3, SSU_GHZ = 4)
                        "5", // ampliture display unit? <---------------------------------------------------------------------------
                             // (SSU_DBM = 5, SSU_DBMV = 6, SSU_DBUV = 7, SSU_V = 12, SSU_MV = 13, SSU_UV = 14, SSU_NV = 15)
                        "12632256", // color gridlines (CLR_DEFAULT = -16777216)
                        "16777215", // color grid background
                        "2631720", // text color
                        "0", // marker color
                        "0", // marker text color
                        "0", // selected marker color
                        "9109524", // reflines color
                        "9109504", // reflines text color
                        "8421631", // color max hold
                        "16744576", // color min hold
                        "33023", // color threshold
                        "11842740", // color ref trace
                        "7451392", // color trace
                        "14477030", // color grid shade
                        "255", // color upper mask
                        "16711680", // color lower mask
                        "230", // color mask fail shade
                        "1", // color avg mode
                        "5", // avg mode window size
                        "0", // link markers?
                        "0", // show min hold?
                        "0", // show max hold?
                        "1", // show freq mask?
                        "1", // show threshold?
                        "1", // show grid?
                        "1", // show grid labels?
                        "1", // fit to screen?
                        "0", // hide controls?
                        "1", // show grid arrows?
                        "1", // show moving arrows?
                        "1", // show both avg trace + current?
                        "1", // show info panel?
                        "16761024", // color arrows
                        "385016", // color avg trace
                        "5", // lock to peak range
                        "1", // auto standby?
                        "5", // standy mode time (minutes)
                        "domain\username", // preset author   <-----------------------------------
                        "2008-05-07 10:03:52", // last modified time <-----------------------------
                        "0", // is protected preset?
                        "592", // load preset option flags
                        "1", // playback mode option flags
                        "0", // is full mode?
                        "1", // manual script option flags
                        "0", // show labels outside of graph?
                        "0", // show marker labels?
                        "0", // show refline labels?
                        "33", // noise marker avg points count
                        "16", // sweep time display unit (SSU_S = 16, SSU_MS = 17, SSU_NS = 18)
                        "0", // show noise markers on trace?
                        "0", // show measpt traces as layers?
"", // min hold window size
"", // max hold window size
"false", // single measpt selection mode
"", // freq decimals
"false", // use frequency offset
"false", // single trace mode
"false", // show play controls
"false", // initially frozen
"0", // number of history settings (for each, an entry with the count + a series of key/value pairs is present)
"false", // show current
"false", // show avg
                    },

                    // 3. markers: 9 fields per marker
                    new string[]                     {
/* example:
                        "42.716942", // marker 1: position (Hz)
                        "-16777216", // marker 1: color
                        "0", // marker 1: is reference marker?
                        "0", // marker 1: (not used)
                        "0", // marker 1: lock to peak?
                        "0", // marker 1: is noise marker?
                        "Carrier", // marker 1: name
                        "0", // marker 1: marker trace type (0=normal; 1=max; 2=in; 3=avg hold)
"1|2|3", // marker 1: measpts, |-separated
                        "64.247723", // marker 2: position (Hz)
                        "-16777216", // marker 2: color
                        "0", // marker 2: is reference marker?
                        "0", // marker 2: (not used)
                        "0", // marker 2: lock to peak?
                        "0", // marker 2: is noise marker?
                        "", // marker 2: name
                        "0" // marker 2: marker trace type
"", // marker 2: measpts, |-separated
                        // etc.. (9 fields per marker)
*/
                    },

                    // 4. reference lines (5 fields per refline)
                    new string[]                     {
/*
    example:
                        "", // refline 1: position (Hz or dBm)
                        "", // refline 1: color
                        "", // refline 1: type (0=AMP, 1=FREQ)
                        "",  // refline 1: name
"", // refline 1: measpts
                        // etc: 5 fields per refline
 */
                    },

                    // 5. threshold objects
                    new string[]                     {
                        // none
                    },

                    // 6. reference trace
                    new string[]                     {
                        "", // type ("string", "doublestring" or empty)
                        "", // trace data
                        "", // color
                    },

                    // 7. frequency mask
                    new string[]                     {
                        // ...
                    }
                };

Wouter Demuynck [SLC] [DevOps Advocate] Posted new comment 5th February 2025
Sebastián Cuéllar [SLC] [DevOps Advocate] commented 4th February 2025

Hello Wouter,

First of all, thanks a lot for your explanation!

Now, focusing on the Add Monitor method, I built this string array according to your example:

string[] monitor = new[]
{
"1", // Script ID
dmaId, // DMA id
elementId, // Element id
$"600", // Time interval (seconds)
$"{elementName}_{port}", // Monitor Name
$"Element: {elementName}<CR>US Port: {port}", // Description
"true", // Disable monitor (Opposite to check box in UI)
"0", // Amount of traces pre/post to save in alarm recordings
itemStringId, // Measurement Points IDs to execute (comma separated)
"true", // Group parameters
"0", // Amount of alarm parameters
"0", // Amount of CSV exports
};

And then, tried to use the method to create the monitor and verify the ID of the new monitor:

int newMonitorId = element.SpectrumAnalyzer.Monitors.AddMonitor(monitor);
engine.Log($"newMonitorId = {newMonitorId}");

But, I'm getting the following error in the Automation log file:
"Run|Something went wrong: System.InvalidCastException: Unable to cast object of type 'Skyline.DataMiner.Net.Apps.SpectrumManager.SpectrumResponseMessage' to type 'Skyline.DataMiner.Net.Messages.SetSpectrumInfoResponseMessage'.

Which is making me think that there is a problem within the method itself that I can't control, but I could be missing something.

Have you ever seen this error? Am I doing something wrong? I hope you can help me with it.

Wouter Demuynck [SLC] [DevOps Advocate] commented 5th February 2025

Was the monitor created?

My first guess would be that the request failed and that DataMinerSystem library is not dealing with errors properly.

My suggestion would be to temporarily increase logging levels for SLSpectrum to "Log Everything" and have a look at the SLSpectrum.txt logfile when you're trying to make the request.

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

Recent questions

Correlation Engine: “Test rule” doesn’t result in a hit, despite functional rule 1 Answer | 3 Votes
When using the Setter = true attribute, will the copy action always be executed first? 1 Answer | 3 Votes
Multiple Set on Table parameters for DVE’s 1 Answer | 2 Votes

Question Tags

adl2099 (115) alarm (62) Alarm Console (82) alarms (100) alarm template (83) Automation (223) automation scipt (111) Automation script (167) backup (71) Cassandra (180) Connector (109) Correlation (69) Correlation rule (52) Cube (150) Dashboard (194) Dashboards (188) database (83) DataMiner Cube (57) DIS (81) DMS (71) DOM (140) driver (65) DVE (56) Elastic (83) Elasticsearch (115) elements (80) Failover (104) GQI (159) HTTP (76) IDP (74) LCA (152) low code app (166) low code apps (93) lowcodeapps (75) MySQL (53) protocol (203) QAction (83) security (88) SNMP (86) SRM (337) table (54) trending (87) upgrade (62) Visio (539) Visual Overview (345)
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