Question

I'm writing a php script that allows me to get and set certain values on a device using snmp. I've got the the device's MIB and can load it easily into php. The problem is that I can't get the values I'm looking for using a 'human readable' oid string instead of a numeric one (the numeric oid works fine).

my code:

$host = "localhost";
$community = "public";
$mibFile = "C:\wamp\www\extra\AvenueMIBv105.mib";
$oid = '.1.3.6.1.4.1.19021.1.1.0.0.1';
snmp_read_mib($mibFile);

print_r(snmprealwalk($host, $community, $oid));

with $oid = '.1.3.6.1.4.1.19021.1.1.0.0.1', I get this output:

Array ( [AvenueMIBv105::private.1.19021.1.1.0.0.1.1.0] => INTEGER: 1 [AvenueMIBv105::private.1.19021.1.1.0.0.1.2.0] => INTEGER: 1

with $oid = 'AvenueMIBv105::private.slotSelect' I get this output:

Array([AvenueMIBv105::internet.2.1.1.3.0] => INTEGER: 129663870 [AvenueMIBv105::internet.2.1.1.4.0] => Hex-STRING: 75 73 65 72 4E 61 6D 65 00

I want both outputs to be the same. I realise that I must have the 'human readable' oid wrong, but I've tried loads of different strings for that and I always get the same wrong output. How should I be doing this? Also I know it sometimes makes a difference, the php script is running on a WAMP server.

Here is my MIB tree:

enter image description here

Was it helpful?

Solution

Your PHP library needs to be able to 'resolve' your OID to a the human readable OID name. You need to research if and how your PHP SNMP library does this for its output. This is an issue with your PHP SNMP library. If your library doesn't do this, then you will need to manually do it. The reason why your IReasoning browser does it, is because the Ireasoning resolves the OID to the human-readable name.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top