opensolutions/OSS_SNMP

MIB Complications - Question

Closed this issue · 2 comments

We've just recently hit one instance where a user had mibs present on the system for his servertech pdu's and they modify the return data to add what type of unit they are measuring. I've put examples of the walks below.

snmpwalk -v 2c -c public 10.0.0.2 .1.3.6.1.4.1.1718.3.2.1.1.11.1 ;
Sentry3-MIB::towerActivePower.1 = INTEGER: 1730 Watts
snmpwalk -OU -v 2c -c public 10.0.0.2 .1.3.6.1.4.1.1718.3.2.1.1.11.1
Sentry3-MIB::towerActivePower.1 = INTEGER: 1730

If I set up an oss_snmp instance and tell it to read the above oid I get INTEGER: 1740 Watts as the initial return value that it passes to the parser. The parser knows this should just be an int and returns back 740.

Is there a way that you know of to force snmpwalk to NOT utilize the available mib?

This is the work around that we're using right now but not sure of the other implications.

        {
            case 'INTEGER':
                if( !is_numeric( substr($value,0,1) ) )
                    $rtn = (int)substr( substr( $value, strpos( $value, '(' ) + 1 ), 0, -1 );
                else
                    $rtn = (int)$value;
                break;
        }

Yeah.... this would certainly be use case specific. I think you'd need to handle this directly in the function you use to get the data and we'd possibly need to implement a 'get raw' type return.

I'll close this and happily evaluate a pull request if you want to go down that road.