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. scripting and ssh commands

scripting and ssh commands

Scheduled Pinned Locked Moved Support
7 Posts 3 Posters 61.0k 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.
  • E
    E
    Egert143
    wrote on last edited by
    #1

    Could realy use some help with scripting, just starting out with it and could use some guidance.

    i have peaced together a sample script that is supposed to ssh into device and reboot it, i wanna use it through tool menu. So far i havent got it working yet.

    Script: AgentReadList(FindNodeObject($node, 2493), "SSH.Command(192.168.1.10,user,password,put [/system reboot])");

    Device never recives any ssh logins

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

      Do you have SSH subagent loaded on node with ID 2493? If yes, check agent's log on that node for how SSH request was processed. You may need to set debug level 5 or higher on agent.

      Best regards,
      Victor

      1 Reply Last reply
      0
      • E
        E
        Egert143
        wrote on last edited by
        #3

        Node 2493 is router. i changed it to netxms server and now the script is working.

        AgentReadList(FindNodeObject($node, "NetXms-Server"), "SSH.Command(192.168.1.10, username ,password,put [/system reboot])");

        When i create tool to run this script, how can i insert dynamic values to script, that are taken from node where tool is used (ip, username, password)?

        Egert

        1 Reply Last reply
        0
        • E
          E
          Egert143
          wrote on last edited by
          #4

          Any help with last question ? 🙂

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

            You can use attributes from node objects (NXSL class Node - https://wiki.netxms.org/wiki/NXSL:Node, accessible via $node variable). SSH credentials are not accessible from NXSL, however it version 3.0 we have added method executeSSHCommand in Node class.

            Best regards,
            Victor

            1 Reply Last reply
            0
            • E
              E
              Egert143
              wrote on last edited by
              #6

              Resurecting an old topic.

              What i am trying to do is make tool->restart ssh command (for ubiquiti wireless device).

              is "$node->executeSSHCommand("reboot");" correct syntax ? when i run it it returns null as value and device doesent reboot. Ssh credentials are filled out in node config.

              1 Reply Last reply
              0
              • F
                F
                Filipp Sudanov
                wrote on last edited by
                #7

                ssh functionality is implemented only in ssh.nsm subagent, server does not do ssh communications. So, if you have zoning, you need to load ssh.nsm on zone proxies. If there's no zoning, agent running on netxms server will be used for ssh commands, so you need to enable ssh.nsm there.

                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