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. Request user input from nxsl

Request user input from nxsl

Scheduled Pinned Locked Moved Support
11 Posts 3 Posters 59.3k 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.
  • G
    G
    gkaudewitz
    wrote on last edited by
    #1

    Hello together,

    is there a possibility to request some userinput from a script? This input from a mask the user can fill within the GUI should be attached for example to the current node or container as CustomAttributes.

    Best regards

    Georg

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

      Hi,

      no, it's not possible. However, it is possible to create object tools with input fields - depending on what you are trying to achieve it may be good alternative.

      Best regards,
      Victor

      1 Reply Last reply
      0
      • G
        G
        gkaudewitz
        wrote on last edited by
        #3

        Hello Victor,

        thank's for the tip! But how can I pass the values of the Input Fields to a servercommand that will call nxscript for inserting the values of the Input Fields as Custom Attributes?
        The node  identified by %n can be passed in the commandline  in Object Tools.
        Best regards
        Georg

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

          Create a normal server command Object Tools, and as command, use this:
          /root/some/script.sh %a %U %(foo) %(bar)

          Where foo and bar are from your input fields.
          (you still need to configure the input fields in their configuration)

          1 Reply Last reply
          0
          • G
            G
            gkaudewitz
            wrote on last edited by
            #5

            Thaks for fast answering my questions to all of you.

            I tried all other combinations of brackets and % but not this one...

            One more question now: I've tested a script on an other system running on 2.0-RC1 and got a window requesting values for the parmeters. My production system still is running on 1.1.17 there I get no window requesting the values. Is there a difference between 2.0 and 1.1.17 or is there a Problem with my production Environment (Java on the Client or something else..)

            1 Reply Last reply
            0
            • G
              G
              gkaudewitz
              wrote on last edited by
              #6

              Sorry I just read that inputfields for object Tools have been implemented with 2.0-RC1....

              1 Reply Last reply
              0
              • G
                G
                gkaudewitz
                wrote on last edited by
                #7

                It's confusing....

                runnig the following script with /data/netxms/bin/nxscript /data/scripts/first.nxsl 124 ddd dddd I always get the same error:

                NetXMS Scripting Host  Version 2.0-RC1
                Copyright (c) 2005-2015 Victor Kirhenshtein
                
                Error 11 in line 4: Function not found
                
                
                

                An object with ID 124 exists in my testdatabase. There is no differencs wether I run the script from objecttools or from Linux commandline.

                sub main()
                {
                
                 obj = FindObject(null,$1);
                 if (obj == null)
                   { println "Object not found Id:" . $1;
                     return;
                   };
                 SetCustomAttribute(obj,"Bau",$2);
                 SetCustomAttribute(obj,"Etage",$3);
                 SetCustomAttribute(obj,"Raum",$4);
                
                 //println "Hello World " . $1 . " " . $2 . " " . $3 . " " . $4 . " " . $5;
                }
                

                Is it necessary to set some path or lib-variables?

                I'm using version 2.0-RC1(8035)

                1 Reply Last reply
                0
                • T
                  T
                  tomaskir
                  wrote on last edited by
                  #8
                  sub main()
                  {
                    obj = FindObject($1);
                    if (obj == null)
                    {
                      println "Object not found Id:" . $1;
                      return;
                    }
                  
                    SetCustomAttribute(obj,"Bau",$2);
                    SetCustomAttribute(obj,"Etage",$3);
                    SetCustomAttribute(obj,"Raum",$4);
                  
                    //println "Hello World " . $1 . " " . $2 . " " . $3 . " " . $4 . " " . $5;
                  }
                  
                  1 Reply Last reply
                  0
                  • G
                    G
                    gkaudewitz
                    wrote on last edited by
                    #9

                    Thank's for the correction concerning the function FindObject. I tried the function FindNodeObject too several times.
                    But the problem persists.

                    NetXMS Scripting Host  Version 2.0-RC1
                    Copyright (c) 2005-2015 Victor Kirhenshtein
                    
                    Error 11 in line 4: Function not found
                    
                    

                    Best regards

                    Georg

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

                      Hi,

                      nxscript provides only generic functions, as it is completely independent from server process. You have to run your script within netxmsd, for example using nxadm:

                      /data/netxms/bin/nxadm -c 'exec /data/scripts/first.nxsl 124 ddd dddd'
                      

                      and if you need to execute NXSL script as reaction to event, you can simply create your script in script library and use "execute script" action.

                      Best regards,
                      Victor

                      1 Reply Last reply
                      0
                      • G
                        G
                        gkaudewitz
                        wrote on last edited by
                        #11

                        Hi,

                        Your advise in mind how to call the nxsl-Script everything worked fine for Nodes!
                        Trying to execute the same script for a Container within the gui does not work at all.
                        I inserted a println-statement to the script to see the object-Id that is called, but I don't get any Output for a containerobject.
                        Executing the script directly from commandline on Linux with an id identifying a Container I will get the expected result for that container.

                        Best regards

                        Georg

                        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