cloved/check_traffic — pull request #2 by dgilm (2014-07-01 09:57:29+00:00)
Title: Fix 32bit and 64bit counter selector

The script fails checking 64 bit counters:

```
$ ./check_traffic.sh -V 2c -C public -H 192.168.1.89 -I 1 -w 200,200 -c 300,300 -K -B
IF-MIB::.1: Unknown Object Identifier
IF-MIB::.1: Unknown Object Identifier
No Data been get here. Please confirm your ARGS and re-check it with Verbose mode, then to check the log.(If you snmp not support 64 bit counter, do not use -6 option)
```
That's because snmpget exit code is not reliable:

```
$ /usr/bin/snmpget -t 15 -Oa -v 2c -c public 192.168.1.89 IF-MIB::ifHCOutOctets.1
IF-MIB::ifHCOutOctets.1 = No Such Object available on this agent at this OID
$ echo $?
0
```
```
$ /usr/bin/snmpget -t 15 -Oa -v 2c -c public 192.168.1.89 IF-MIB::ifOutOctets.1
IF-MIB::ifOutOctets.1 = Counter32: 4050020
$ echo $?
0
```
The patch checks the snmpget output instead of the error code in order to choose a 32counter or a 64counter.