snmpnetstat Invalid version error && cacti SNMP – Get TCP Connection Status graph data 0
perl
#!perl -w
# ————————————————–
# ARGV[0] =
# ARGV[1] =
# ARGV[2] =
# ARGV[3] =
# ARGV[4] =
# ————————————————–
$in_hostname = $ARGV[0] if defined $ARGV[0];
$in_version = $ARGV[1] if defined $ARGV[1];
$in_community = $ARGV[2] if defined $ARGV[2];
$in_port = $ARGV[3] if defined $ARGV[3];
$in_timeout = $ARGV[4] if defined $ARGV[4];
if ($in_version eq “2”)
{
$in_version = “2c”;
}
# my $_cmd = “snmpnetstat -v $in_version -c $in_community -t $in_timeout -n -P tcp $in_hostname:$in_port”;
my $_cmd = “snmpnetstat -v $in_version -c $in_community -t $in_timeout -Cn -Cp tcp $in_hostname:$in_port”;