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. Automatic Config of new objects

Automatic Config of new objects

Scheduled Pinned Locked Moved Support
14 Posts 2 Posters 56.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.
  • M
    M
    MatthewDreher
    wrote on last edited by
    #5

    That helps a ton.  One final question.  If I want a template to automatically apply a service check against a server (custom port 80 or http check for example) how would I put that in?  Would I just use localhost and port 80? 

    ServiceCheck.Custom(localhost,80) with threshold >= 1

    Sorry if these sound like horribly newbie questions.

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

      If you want to check the website from the agent running on that node, then yes.
      (that is not very useful tho, because it may run locally, but may not run remotely)

      So usually, you want to check from the NetXMS server.
      Here you would set "Source node" to the NetXMS server.

      Assuming you are binding from the template then, you would set the DCI parameter as:
      ServiceCheck.Custom(%{node_primary_ip},80)

      This will replace the %{node_primary_ip} macro in each DCI for the IP address of the node the DCI is bound to.
      https://wiki.netxms.org/wiki/UM:Data_Collection#Macros_in_template_items

      As a last note, I recommend doing ServiceCheck.HTTP rather than ServiceCheck.Custom, since it will actually check the website returned.
      Documentation here: https://wiki.netxms.org/wiki/Subagent:PortCheck

      1 Reply Last reply
      0
      • M
        M
        MatthewDreher
        wrote on last edited by
        #7

        Ok, then how would I get it to automatically apply to the netxms server?  Does just returning true in the script add the template to the netxms server and $node adds it to the newly added node?

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

          Template auto-bind script it evaluated against each node during that node's configuration poll.
          So "return true;" will bind it to that node.

          If you want to bind only to the NetXMS server itself, use

          return $node->isLocalMgmt;
          
          1 Reply Last reply
          0
          • M
            M
            MatthewDreher
            wrote on last edited by
            #9

            Perfect.  I think that's all I need at this point.  Really appreciate the assistance.

            1 Reply Last reply
            0
            • M
              M
              MatthewDreher
              wrote on last edited by
              #10

              nm, definitely got more questions.

              So, using your above code, I have a server that has IIS installed.  Ideally, I'd look for the open port or a service on the box.  In this case, the service is w3wp.exe, the iis service.  I'd like the template to apply once the node is added, add the template to the netxms server, and automatically monitor the new node for port 80

              Auto Apply rule would be this:

              searchProcess = "w3wp.exe";
              procArray = AgentReadList($node, "System.ProcessList");
              
              if (procArray == null)
                return false;
              
              foreach (process : procArray) {
                if (index(process, searchProcess) != 0)
                  return $node->isLocalMgmt;
              }
              
              return false;
              

              and dci paramater would be ServiceCheck.Custom(%{node_primary_ip},80) (I'm just doing the custom port for simplicity atm, I'll be adding in the http later).

              Not working obviously.

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

                Your above code will apply this template to a node that has the "w3wp.exe" process running AND is the NetXMS server itself.

                Is this really what you want to do?

                1 Reply Last reply
                0
                • M
                  M
                  MatthewDreher
                  wrote on last edited by
                  #12

                  no, I want to check the node to see if it has the service running, then apply a monitor to the netxms server to monitor against the node for port 80

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

                    Your auto-bind script will be

                    searchProcess = "w3wp.exe";
                    procArray = AgentReadList($node, "System.ProcessList");
                    
                    if (procArray == null)
                      return false;
                    
                    foreach (process : procArray) {
                      if (index(process, searchProcess) != 0)
                        return true;
                    }
                    
                    return false;
                    

                    On the DCI, the parameter will be:

                    ServiceCheck.Custom(%{node_primary_ip},80)
                    

                    Make sure to set "Source node" in the DCI configuration to the NetXMS server.

                    The template will be bound to the node running the IIS server, not to the NetXMS server.
                    (since the NetXMS server is not the one offering the HTTP service, the DCI should not be on the NetXMS server)

                    The service check will be performed from the NetXMS server to the IIS node tho.
                    (that is what the "Source node" setting configures)

                    1 Reply Last reply
                    0
                    • M
                      M
                      MatthewDreher
                      wrote on last edited by
                      #14

                      Ok, perfect.  Thanks again for the help.

                      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