my %tcpStates = ( 1 => [0, "GAUGE", "closed", "Connections waiting for a termination request acknowledgment from the remote TCP."],
2 => [0, "GAUGE", "listen", "Connections waiting for a request from any remote TCP and port."],
3 => [0, "GAUGE", "synSent", "Connections waiting for a matching request after having sent a connection request."],
4 => [0, "GAUGE", "synReceived", "Connections waiting for a confirming request acknowledgment after having both received and sent a connection request."],
5 => [0, "GAUGE", "established", "Connections opened and data received can be delivered to the user. The normal state for the data transfer phase of the connection."],
6 => [0, "GAUGE", "finWait1", "Connections waiting for a termination request from the remote TCP, or an acknowledgment of the connection termination request previously sent."],
7 => [0, "GAUGE", "finWait2", "Connections waiting for a termination request from the remote TCP."],
8 => [0, "GAUGE", "closeWait", "Connections waiting for a termination request from the local user."],
9 => [0, "GAUGE", "lastAck", "Connections waiting for an acknowledgment of the termination request previously sent to the remote TCP (which includes an acknowledgment of its connection termination request)."],
10 => [0, "GAUGE", "closing", "Connections waiting for a termination request acknowledgment from the remote TCP."],
11 => [0, "GAUGE", "timeWait", "Connections waiting for enough time to pass to be sure the remote TCP received the acknowledgment of its termination request."],
12 => [0, "GAUGE", "deleteTCP", "Connections terminated by a SNMP Managment Station (put)"]
);
if (defined $ARGV[0] and $ARGV[0] eq "snmpconf")
{
print "require 1.3.6.1.2.1.6.13.1.1. [0-9]\n";
exit 0;
}
if ($0 =~ /^(?:|.*\/)snmp_([^_]+)_netstat$/)
{
$host = $1;
if ($host =~ /^([^:]+):(\d+)$/)
{
$host = $1;
$port = $2;
}
}
elsif (!defined($host))
{
print "# Debug: $0 -- $1\n" if $DEBUG;
die "# Error: couldn't understand what I'm supposed to monitor.";