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. AutoAdd node if last value is X

AutoAdd node if last value is X

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 12.6k 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.
  • B
    B
    Borgso
    wrote on last edited by
    #1

    Is it possible to autoadd a node if i have a Generic template gathering a value i want to decide where the node should be put?

    Ex i have template that check for program version "Templates->Generic->AppVersion"

    If AppVersion >=1.0 add to node to "Templates->Generiv_v1"
    If AppVersion >=2.0 add to node to "Templates->Generiv_v2"

    1 Reply Last reply
    0
    • K
      K
      KjellO
      wrote on last edited by
      #2

      It is possible to check DCI values in template autoapply scripts.

      In the generic template, create a DCI that collects the application version.
      In the autoapply script of the version-specific template use something like this. (Not tested, may contain errors)

      sub main() {
         ver = GetDCIValue($node, FindDCIByName($node, "AppVersion(theApp)"));
         // nxsl finally uses short-circuit evaluation :-)
         return (ver != NULL && $node->name ~= "node-name-regexp" && real(ver) > 1.2 && real(ver) < 2.0);
      }
      
      1 Reply Last reply
      0
      • B
        B
        Borgso
        wrote on last edited by
        #3

        Thanks for the help.

        I ended up with this AutomaticApplyRules that worked:

        sub main() {
           $ver = GetDCIValue($node, FindDCIByDescription($node, "AppVersionDescription"));
           return ($ver != NULL &&
                   $node->name ~= "node-name-regexp" &&
                   real($ver) > 2);
        }
        
        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