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. Feature Requests
  3. Suggestion - Apply template to containers

Suggestion - Apply template to containers

Scheduled Pinned Locked Moved Feature Requests
13 Posts 5 Posters 63.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.
  • J
    J
    jhuliagraziella
    wrote on last edited by
    #1

    I'm starting to use NetXMS and when I populated the network I decided to put each node in containers corresponding to its physical location's neighborhood. The problem was: when I tried to apply templates to the nodes I couldn't just select the containers which had the nodes, I had to open every container and select each node manually.
    This sure isn't a big deal, but this kind of work can be time-consuming, monotonous and tiring when dealing with large networks. I mean, imagine selecting 2000 nodes manualy without being able to just select first, hold Shift and select last?
    So my suggestion would be to add the possibility to apply a template to all the nodes that are children of a container by selecting the container itself.
    For example, if I have the following directory subtree:

    Infrastructure Services

    _Container A
    _Container B
    _node 1
    _node 2
    _node 3
    _Container C
    _node 4
    _node 5

    |
    Templates

    _Template T

    And tried to apply template T to directory A, T would be applied to all nodes from node1 to node5.
    What do you think?

    Thank you,

    Jhúlia Graziella

    1 Reply Last reply
    0
    • B
      B
      bikeprata
      wrote on last edited by
      #2

      That would be great, Jhuliagraziella! I support your idea and would love to see some feature like that!

      May the force be with you!

      1 Reply Last reply
      0
      • T
        T
        tomaskir
        wrote on last edited by
        #3

        This is already entirely possible.

        Simply use auto-bind scripts...
        Here is an example:

        parents = GetNodeParents($node);
        
        foreach(p : parents) {
          // if the node has a parent with this name
          if (p->name == "Something") {
            // auto-bind node
            return true;
          }
        }
        
        // otherwise do not auto-bind the node
        return false;
        
        1 Reply Last reply
        0
        • J
          J
          jhuliagraziella
          wrote on last edited by
          #4

          @tomaskir said in Suggestion - Apply template to containers:

          This is already entirely possible.

          Simply use auto-bind scripts...
          Here is an example:

          parents = GetNodeParents($node);
          
          foreach(p : parents)
          {
            // if the node has a parent with this name
            if (p->name == "Something")
            {
          	// auto-bind node
          	return true;
          }
          
          // otherwise do not auto-bind the node
          return false;
          

          Feeling like a newbie here, but how exactly do I configure to execute this type of script everytime I delete something? (I'm talking about deletion by clicking with mouse's right button and then selecting delete, because that's how the operators will probably do it).
          If this is possible almost ALL my problems can be resolved by configuring this!  ;D

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

            Hi,

            how delete is involved here? I thought that original question was about applying template. Do you need to apply template to all nodes in the system or only some of them?

            Best regards,
            Victor

            1 Reply Last reply
            0
            • J
              J
              jhuliagraziella
              wrote on last edited by
              #6

              Sorry, sorry, sorry. I mixed my posts and am embarassed now.  :-[

              @jhuliagraziella said in Suggestion - Apply template to containers:

              Feeling like a newbie here, but how exactly do I configure to execute this type of script everytime I delete something? (I'm talking about deletion by clicking with mouse's right button and then selecting delete, because that's how the operators will probably do it).
              If this is possible almost ALL my problems can be resolved by configuring this!  ;D

              Correction:
              Feeling like a newbie here, but how exactly do I configure to execute this type of script everytime I try to apply a template? (I'm talking about applying a template by clicking with mouse's right button and then selecting apply and selecting the nodes I want to apply, because that's how the operators will probably do it).
              If this is possible almost ALL my problems can be resolved by configuring this!  ;D

              I organized my node in containers to make it easier to see, but when applying templates this way of organizing really slows my job, because I have to open every container and select just the nodes I want and that way mistakes happen easily: I gotta be careful not to select nodes that shouldn't have the template applied and if I accidentaly select something that isn't a node (like a container) I get the following error:

              Cannot apply data collection template: Invalid object ID
              Invalid object ID

              What I wanted was: if i tried to apply a template to a container, all container's children nodes that are "aplliable" would be.

              1 Reply Last reply
              0
              • T
                T
                tomaskir
                wrote on last edited by
                #7

                As I said before, use auto-bind script on the template.

                What you want is already possible, just use the script that I gave you a few posts ago.

                It will bind the nodes under the folder to the template during a configuration poll.

                1 Reply Last reply
                0
                • J
                  J
                  jhuliagraziella
                  wrote on last edited by
                  #8

                  @tomaskir said in Suggestion - Apply template to containers:

                  As I said before, use auto-bind script on the template.

                  What you want is already possible, just use the script that I gave you a few posts ago.

                  It will bind the nodes under the folder to the template during a configuration poll.

                  I didn't want to use scripts because then an operator would have troubles when trying to change something... And I imagine the changes needed to turn possible what I asked for are not very complicated, but no problem! 🙂
                  Thank you very much for your help!

                  1 Reply Last reply
                  0
                  • A
                    A
                    alike767
                    wrote on last edited by
                    #9

                    @tomaskir said in Suggestion - Apply template to containers:

                    This is already entirely possible.

                    Simply use auto-bind scripts...
                    Here is an example:

                    parents = GetNodeParents($node);
                    
                    foreach(p : parents)
                    {
                      // if the node has a parent with this name
                      if (p->name == "Something")
                      {
                    	// auto-bind node
                    	return true;
                    }
                    
                    // otherwise do not auto-bind the node
                    return false;
                    

                    I am having a problem with this script.  I have copied and pasted it into a template on the Automatic Apply Rules section.  I changed "Something" to the name of one of my containers, and when I ran a poll Configuration (full) on one of my nodes that is in that container, the node did not get added to the template.

                    I noticed that there is an uneven number of "}" and put them in various places with no luck.  My guess is I am having a simple syntax issue.  Should this script work exactly as posted?

                    Thanks

                    1 Reply Last reply
                    0
                    • T
                      T
                      tomaskir
                      wrote on last edited by
                      #10

                      Oops, there was indeed a syntax error.

                      Fixed the script in the original post, please try it.

                      1 Reply Last reply
                      0
                      • A
                        A
                        alike767
                        wrote on last edited by
                        #11

                        That didn't fix it for me.  I must be doing something else wrong. 

                        Please find attached screen shot. 


                        Screenshot from 2016-07-28 12-17-14.png

                        1 Reply Last reply
                        0
                        • T
                          T
                          tomaskir
                          wrote on last edited by
                          #12

                          Try setting "CheckTrustedNodes" to 0 in Server Configuration and restarting the server.

                          Here is a Wiki article on the topic:
                          https://wiki.netxms.org/wiki/SG:Security_Issues

                          1 Reply Last reply
                          0
                          • A
                            A
                            alike767
                            wrote on last edited by
                            #13

                            Great.  That works.  I had tried that, but I guess never with the right syntax.

                            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