[racktables-users] Re: snmpgeneric.php

  • From: Denis Ovsienko <infrastation@xxxxxxxxx>
  • To: "racktables-users@xxxxxxxxxxxxx" <racktables-users@xxxxxxxxxxxxx>
  • Date: Tue, 21 Aug 2012 16:42:08 +0400

23.07.2012, 22:10, "Samir Patrice" <samir.patrice@xxxxxxxxx>:
> Thanks for information Jim.
> Back to snmp.php,  the "Fatal SNMP failure " message is appearing because the 
> test in line 1675 is returning a Boolean value false, this is the code:
>   if (FALSE === ($sysObjectID = $device->snmpget ('sysObjectID.0')))
>
> Normally it should return the Boolean value true. I am not familiar with php, 
> can someone help me understand this test in php?

The PHP manual states: "Returns SNMP object value on success or FALSE on error."

The matter is, this function can return integer 0 for a successful call (when 
the remote variable is set to 0). The "===" operator disables PHP's type 
casting to distinguish between FALSE and 0, there should be similar use cases 
in the code. In this case FALSE means a generic error, specific error code 
(timeout or no such variable) should be figured out by some other means. Using 
tcpdump is sometimes the fastest option to troubleshoot this error.

-- 
 Denis Ovsienko

Other related posts: