Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. same threshold on multiple dci

same threshold on multiple dci

Scheduled Pinned Locked Moved Support
5 Posts 2 Posters 43.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    M
    MarcusH
    wrote on last edited by
    #1

    Hi,

    Is there any way to mass update thresholds like with templates?
    I have alot of DCI that uses same threshold but each time this threshold needs to be tweaked i need to update each DCI one by one.

    1 Reply Last reply
    0
    • M
      M
      MarcusH
      wrote on last edited by
      #2

      Solved my problem with script, though i have one problem i can't seem to figure out

      28 DCI with name starting with IntQ that collects data every 5 sec
      1 DCI that runs the script every minute

      What this script does is that it will trigger event and set alarm if any of the DCI values do not go down under 15 min (900sec)
      and if values goes down and alarm exists trigger event to terminate alarm

      MAIL_ALL event has create alarm with key ALARM-%1
      MAIL_ALL_RESET event has terminate alarm with key ALARM-%1

      The logic works it will trigger the events and create alarm correctly but the termination of the alarm in MAIL_ALL_RESET does not work and the alarm will remain, i can not see why this should not work.

      Any help in this would be very appreciated.

      foreach(adci : FindAllDCIs($node,"IntQ*"))
      {
      	eventtrigger = 1;
      	oldval=0;
      
      	// Check DCI values if they are going down within time period.
      	foreach(dcivalue : GetDCIValues($node, adci->id, time() - 900, time()))
      	{
      		if((oldval > dcivalue) || (dcivalue == 0)){eventtrigger = 0;}
      		oldval = dcivalue;
      	}
      
      	alarm = FindAlarmByKey("ALARM-".adci->name);
      
      	// Trigger event, and set alarm so mail action is only triggered once.
      	if(eventtrigger == 1)
      	{
      		if(alarm == null)
      		{
      			PostEvent($node, "MAIL_ALL", null, adci->name, adci->description, null, GetDCIValue($node, adci->id));
      		}
      	}
      
      	// Reset event alarm
      	if(eventtrigger == 0)
      	{
      		if(alarm != null)
      		{
      			PostEvent($node, "MAIL_ALL_RESET", adci->name, adci->description, null, GetDCIValue($node, adci->id));
      		}
      	}
      }
      

      Edit: Even tried terminating alarm via method terminate still nothing.

      1 Reply Last reply
      0
      • V
        V
        Victor Kirhenshtein
        wrote on last edited by
        #3

        Hi,

        in second PostEvent you pass DCI name as tag, not as first event parameter. You have to insert null there (as in first PostEvent call).

        Best regards,
        Victor

        1 Reply Last reply
        0
        • M
          M
          MarcusH
          wrote on last edited by
          #4

          oh my god that's just... i stared hours on that and was 110% sure i copy pasted everything and just changed event name.

          Many thanks  😄

          1 Reply Last reply
          0
          • M
            M
            MarcusH
            wrote on last edited by
            #5

            Found another problem in that it is loops newest value first so the check from oldvalue is wrong.
            Is there any method for reversing arrays?

            Experimenting with for loop with array size, though just reversing array using foreach would be nice

            1 Reply Last reply
            0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            Powered by NodeBB Contributors
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups