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. use dynamic IP from SNMPget to PING by subagent icmp.ping

use dynamic IP from SNMPget to PING by subagent icmp.ping

Scheduled Pinned Locked Moved Support
13 Posts 3 Posters 18.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.
  • V
    V
    Victor Kirhenshtein
    wrote on last edited by
    #4

    Hi!

    Solution #1 seems correct. You can get value from remote agent with AgentReadParameter function. However, easier would be to use proxy node directly:

    On GATEWAY1 a DCI: Origin = Agent, Parameter = Icmp.Ping(ip), Proxy-node = NetXMS-server

    No transformation script needed in this case.

    Best regards,
    Victor

    1 Reply Last reply
    0
    • Dani@M3TU
      Dani@M3TU
      Dani@M3T
      wrote on last edited by
      #5

      Hi Victor

      But in your suggestion, I have first get 'ip' (as you called it in your post) from a SNMPGetValue on node GATEWAY1. Can I use a script in the 'parameter' field of the DCI for this?

      thanks
      Dani

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

        Sorry, I misunderstood the situation. Then you can use the following DCI:

        Origin = SNMP, Parameter = OID you are using to get IP address

        with the following transformation script:

        server = FindNodeObject($node, "netxms-server-name");
        return AgentReadParameter(server, "Icmp.Ping(" . $1 . ")");
        

        Best regards,
        Victor

        1 Reply Last reply
        0
        • Dani@M3TU
          Dani@M3TU
          Dani@M3T
          wrote on last edited by
          #7

          Hi Victor

          Many thanks for the very fast solution. It works

          The following line is the solution:
          return AgentReadParameter(server, "Icmp.Ping(" . $1 . ")"); [I didn't know that]

          But can you explain me the syntax you used 'icmp.ping(" . $1 . ")?
          From SubAgent documentation I have this syntax 'Icmp.Ping(target,*timeout*,*psize*)'

          thanks a lot!

          Dani

          1 Reply Last reply
          0
          • Dani@M3TU
            Dani@M3TU
            Dani@M3T
            wrote on last edited by
            #8

            another 'problem' is: now the result of the DCI is the latency of the ping (=ok) but it's a string, not an integer. Maybe because the SNMP Data Type is string (it's an IP address) but the result of the transformation script should be an integer.

            1 Reply Last reply
            0
            • Dani@M3TU
              Dani@M3TU
              Dani@M3T
              wrote on last edited by
              #9

              sorry last post was too early 🙂
              I changed the Data Type of the DCI to integer and now it's ok. I thought the Data Type must be the type of the SNMP value. But it looks like Data Type is the type of the DCI-result after the transformation script.
              So only the question about the icmp.ping syntax is open.

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

                Timeout and packet size are optional arguments and can be omitted. There is word "optional" deep in parameter description 🙂 All following forms are valid:

                Icmp.Ping(10.10.10.1)
                Icmp.Ping(10.10.10.1,3000)
                Icmp.Ping(10.10.10.1,2000,120)
                Icmp.Ping(10.10.10.1,,140)

                Best regards,
                Victor

                1 Reply Last reply
                0
                • Dani@M3TU
                  Dani@M3TU
                  Dani@M3T
                  wrote on last edited by
                  #11

                  Thanks. I saw that in the documentation. But you gave me this:
                  Icmp.Ping(" . $1 . ")

                  I don't understand " . $1 . ".
                  '$1' is the result of the SNMPget, thats clear, but why these points?
                  I had expected something like Icmp.Ping("$1")

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

                    . is string concatenation operation in NXSL. NXSL does not do macro expansion within strings, so you have to do concatenation. Don't be confused by $ sign - it is valid character in identifiers and has not any special meaning. It's just a naming convention to start names of built-in variables with $. You can name your variable a$ for example.

                    Best regards,
                    Victor

                    1 Reply Last reply
                    0
                    • Dani@M3TU
                      Dani@M3TU
                      Dani@M3T
                      wrote on last edited by
                      #13

                      now the penny has dropped 😉 thanks!

                      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