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. Is counting TCP connections without using Agent possible?

Is counting TCP connections without using Agent possible?

Scheduled Pinned Locked Moved Support
3 Posts 2 Posters 27.2k 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.
  • C
    C
    ChrisC
    wrote on last edited by
    #1

    https://www.netxms.org/forum/general-support/how-to-countgraphcheck-tcp-connection-states-table-with-netxms/msg2031/#msg2031 nicely explains how to do it using the Agent, but I was wondering if there is a way of counting OIDs that match a certain criteria without having to have an Agent installed, as some of this is available via SNMP.

    For example, OID:

    .1.3.6.1.2.1.6.13.1.4.xxx.xxx.xxx.xxx.ssss.yyy.yyy.yyy.yyy.dddd
    

    xxx.xxx.xxx.xxx is the local IP address, and ssss is the local port.
    yyy.yyy.yyy.yyy is the remote IP address, and dddd is the remote port.
    If I could count the number of times ".1.3.6.1.2.1.6.13.1.4.xxx.xxx.xxx.xxx.ssss.*" appears in the list, I could count how many connections there are to a specific service.

    Is this possible somehow?

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

      Yes, you can create a script DCI. Scripts are written using NXSL language, there's support for snmpget and snmpwalk. Here's a simple example, pls inform if you need more information on how to write a script
      https://www.netxms.org/documentation/nxsl-latest/#_read_snmp_value_from_node

      1 Reply Last reply
      0
      • C
        C
        ChrisC
        wrote on last edited by
        #3

        Thank you.
        This Manual page helped immensely: https://wiki.netxms.org/wiki/NXSL:SNMPWalk

        The following works perfectly:

        // Call this function with the following parameters:
        // $1 = port number (eg 5900 for VNC)
        // $2 = IP address (xxx.xxx.xxx.xxx)
        
        
        transport = CreateSNMPTransport($node);
        if (transport == null)
                   return -1;
        oid = ".1.3.6.1.2.1.6.13.1.4." . $2 . "." . $1 ; // IP connections
        vars = SNMPWalk(transport, oid);
        if (vars == null)
                   return -2; // SNMPWalk failed
        count = 0;
        foreach (v: vars) {
          //trace(1, "SNMP WALK ".v->name."=".v->value);
          count = count +1;
        }
        return count;
        
        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