Skip to content

Instantly share code, notes, and snippets.

@FransUrbo
Created July 13, 2015 14:37
Show Gist options
  • Save FransUrbo/b891f94b1100f2a3b251 to your computer and use it in GitHub Desktop.
Save FransUrbo/b891f94b1100f2a3b251 to your computer and use it in GitHub Desktop.
snmp pass_persist script to test large integers
#!/bin/bash
# pass_persist handler
# http://sourceforge.net/p/net-snmp/mailman/message/26930463/
while true; do
read command
if [ "$command" == "PING" ]; then
echo "PONG"
continue
fi
read oid
if [ "$oid" == ".1.3.6.1.4.1.22222.42.1.0" ]; then
echo $oid
echo integer
echo 123456
elif [ "$oid" == ".1.3.6.1.4.1.22222.42.2.0" ]; then
echo $oid
echo integer64
# echo opaque_i64 # => 'OPAQUE: FF'
echo 9223372036854775806 # Within the confines of a signed int64!
elif [ "$oid" == ".1.3.6.1.4.1.22222.42.3.0" ]; then
echo $oid
echo counter
echo 123456
elif [ "$oid" == ".1.3.6.1.4.1.22222.42.4.0" ]; then
echo $oid
echo counter64
echo 9223372036854775806 # Within the confines of a signed int64!
elif [ "$oid" == ".1.3.6.1.4.1.22222.42.5.0" ]; then
echo $oid
echo unsigned # Gauge32 (??)
echo 4294967294 # Within the confines of a unsigned int32!
elif [ "$oid" == ".1.3.6.1.4.1.22222.42.6.0" ]; then
echo $oid
echo unsigned64
echo 18446744073709551614 # Within the confines of a unsigned int64!
else
echo "NONE"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment