01.03.2012, 18:06, "Nikolay Shopik" <shopik@xxxxxxxxxx>: > On 01/03/12 17:48, Denis Ovsienko wrote: > >> The only reason was to keep the code readable. sysObjectID is a very basic >> OID, it has been in this code for more, than 4 years yet. Are you sure the >> PHP SNMP module comes with all the dependencies it is supposed to have on >> this system? > > PHP SNMP module is fine, as I said, problem was this machine had NO MIB > files loaded at all, thus complain can't find such object name. I understand the nature of the problem, but my point is that it may be a problem of local libnetsnmp instance and not of every application linked against it. Let me explain it with a session log from a Fedora 16 host: [root@localhost ~]# fgrep -rn 'sysObjectID OBJECT-TYPE' /usr/share/snmp/ /usr/share/snmp/mibs/RFC1213-MIB.txt:80:sysObjectID OBJECT-TYPE /usr/share/snmp/mibs/SNMPv2-MIB.txt:88:sysObjectID OBJECT-TYPE [root@localhost ~]# rpmquery -f /usr/share/snmp/mibs/RFC1213-MIB.txt net-snmp-libs-5.7.1-2.fc16.x86_64 [root@localhost ~]# rpm -e net-snmp-libs error: Failed dependencies: libnetsnmp.so.30()(64bit) is needed by (installed) net-snmp-utils-1:5.7.1-2.fc16.x86_64 libnetsnmp.so.30()(64bit) is needed by (installed) net-snmp-agent-libs-1:5.7.1-2.fc16.x86_64 libnetsnmp.so.30()(64bit) is needed by (installed) net-snmp-1:5.7.1-2.fc16.x86_64 libnetsnmp.so.30()(64bit) is needed by (installed) hplip-libs-3.11.12-1.fc16.x86_64 libnetsnmp.so.30()(64bit) is needed by (installed) hpijs-1:3.11.12-1.fc16.x86_64 libnetsnmp.so.30()(64bit) is needed by (installed) php-snmp-5.3.10-1.fc16.x86_64 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ net-snmp-libs = 1:5.7.1-2.fc16 is needed by (installed) net-snmp-utils-1:5.7.1-2.fc16.x86_64 net-snmp-libs = 1:5.7.1-2.fc16 is needed by (installed) net-snmp-1:5.7.1-2.fc16.x86_64 You can see, that libnetsnmp is shipped with the essential MIBs and built to use these. It doesn't matter if you run "snmpget" from the shell or use PHP-SNMP module, sysObjectID.0 will work. Could you troubleshoot the server to find out what is wrong with its libsnmp? > > Also I just wondering why using such generic error (fatal SNMP failure) > when it's easier just pass snmpwalk error to user. But I've assume you > already answered that, code written long time ago :-P. > > It's really hard to tell if it MIB failed to load or just device doesn't > answer to SNMP packet. So I have to come up with hackish and very dirty > workaround. Good patches are welcome. -- Denis Ovsienko