Fall back to using snmpEngineTime rather than be the default

This commit is contained in:
laf
2015-07-19 16:02:56 +01:00
parent 894a96c72a
commit 1265fc44b8
+6 -6
View File
@@ -28,8 +28,7 @@ if (!empty($agent_data['uptime'])) {
}
if (empty($uptime)) {
$uptime = (integer) snmp_get($device, 'snmpEngineTime.0', '-OUqv', 'SNMP-FRAMEWORK-MIB');
if (!is_numeric($snmpEngineTime)) {
$snmp_uptime = (integer) snmp_get($device, 'snmpEngineTime.0', '-OUqv', 'SNMP-FRAMEWORK-MIB');
$hrSystemUptime = snmp_get($device, 'hrSystemUptime.0', '-Oqv', 'HOST-RESOURCES-MIB');
if (!empty($hrSystemUptime) && !strpos($hrSystemUptime, 'No') && ($device['os'] != 'windows')) {
echo 'Using hrSystemUptime ('.$hrSystemUptime.")\n";
@@ -57,11 +56,12 @@ if (empty($uptime)) {
$secs = ($secs + ($mins * 60));
$uptime = $secs;
}//end if
}//end if
if ($snmp_uptime > $uptime && is_numeric($snmp_uptime)) {
$uptime = $snmp_uptime;
d_echo('hrSystemUptime or sysUpTime looks like to have rolled, using snmpEngineTime instead');
}
else {
echo 'Using snmpEngineTime ('.$uptime.")\n";
}//end if
}//end if
if (is_numeric($uptime)) {
if ($uptime < $device['uptime']) {