Is counting TCP connections without using Agent possible?
-
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.ddddxxx.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?
-
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 -
Thank you.
This Manual page helped immensely: https://wiki.netxms.org/wiki/NXSL:SNMPWalkThe 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;
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