diff --git a/discovery.php b/discovery.php index cdd5a96c9b..ceba913eb0 100755 --- a/discovery.php +++ b/discovery.php @@ -120,17 +120,11 @@ while ($device = mysql_fetch_array($device_query)) #include("includes/discovery/os.inc.php"); include("includes/discovery/ports.inc.php"); -# include("includes/discovery/entity-physical.inc.php"); + include("includes/discovery/entity-physical.inc.php"); include("includes/discovery/processors.inc.php"); include("includes/discovery/mempools.inc.php"); include("includes/discovery/ipv4-addresses.inc.php"); include("includes/discovery/ipv6-addresses.inc.php"); -# include("includes/discovery/temperatures.inc.php"); -# include("includes/discovery/humidity.inc.php"); -# include("includes/discovery/voltages.inc.php"); -# include("includes/discovery/frequencies.inc.php"); -# include("includes/discovery/current.inc.php"); -# include("includes/discovery/fanspeeds.inc.php"); include("includes/discovery/sensors.inc.php"); include("includes/discovery/storage.inc.php"); include("includes/discovery/hr-device.inc.php"); diff --git a/html/includes/graphs/graph.inc.php b/html/includes/graphs/graph.inc.php index 9f90c7ab4b..ac1641d5ec 100644 --- a/html/includes/graphs/graph.inc.php +++ b/html/includes/graphs/graph.inc.php @@ -100,7 +100,7 @@ if(!$auth) graph_error("No Authorisation"); } } else { - $rrd_options .= " HRULE:0#999999"; + #$rrd_options .= " HRULE:0#999999"; if($no_file) { if($width < 200) diff --git a/html/includes/graphs/sensor/current.inc.php b/html/includes/graphs/sensor/current.inc.php index 97ff7afe1f..ce1070829e 100644 --- a/html/includes/graphs/sensor/current.inc.php +++ b/html/includes/graphs/sensor/current.inc.php @@ -16,4 +16,8 @@ include("includes/graphs/common.inc.php"); $rrd_options .= " GPRINT:current:LAST:%5.2lfA"; $rrd_options .= " GPRINT:current:MAX:%5.2lfA\\\\l"; + if(is_numeric($sensor['sensor_limit'])) $rrd_options .= " HRULE:".$sensor['sensor_limit']."#999999::dashes"; + if(is_numeric($sensor['sensor_limit_low'])) $rrd_options .= " HRULE:".$sensor['sensor_limit_low']."#999999::dashes"; + + ?> diff --git a/html/includes/graphs/sensor/fanspeed.inc.php b/html/includes/graphs/sensor/fanspeed.inc.php index 982d250f06..4cf0b96434 100644 --- a/html/includes/graphs/sensor/fanspeed.inc.php +++ b/html/includes/graphs/sensor/fanspeed.inc.php @@ -15,4 +15,7 @@ include("includes/graphs/common.inc.php"); $rrd_options .= " GPRINT:fan:LAST:%3.0lfrpm"; $rrd_options .= " GPRINT:fan:MAX:%3.0lfrpm\\\\l"; + if(is_numeric($sensor['sensor_limit'])) $rrd_options .= " HRULE:".$sensor['sensor_limit']."#999999::dashes"; + if(is_numeric($sensor['sensor_limit_low'])) $rrd_options .= " HRULE:".$sensor['sensor_limit_low']."#999999::dashes"; + ?> diff --git a/html/includes/graphs/sensor/frequency.inc.php b/html/includes/graphs/sensor/frequency.inc.php index a81e5c83bf..db8cb915ce 100644 --- a/html/includes/graphs/sensor/frequency.inc.php +++ b/html/includes/graphs/sensor/frequency.inc.php @@ -15,4 +15,7 @@ include("includes/graphs/common.inc.php"); $rrd_options .= " GPRINT:freq:LAST:%3.0lfHz"; $rrd_options .= " GPRINT:freq:MAX:%3.0lfHz\\\\l"; + if(is_numeric($sensor['sensor_limit'])) $rrd_options .= " HRULE:".$sensor['sensor_limit']."#999999::dashes"; + if(is_numeric($sensor['sensor_limit_low'])) $rrd_options .= " HRULE:".$sensor['sensor_limit_low']."#999999::dashes"; + ?> diff --git a/html/includes/graphs/sensor/humidity.inc.php b/html/includes/graphs/sensor/humidity.inc.php index 3c6757bbbc..eede593a0c 100644 --- a/html/includes/graphs/sensor/humidity.inc.php +++ b/html/includes/graphs/sensor/humidity.inc.php @@ -28,4 +28,7 @@ include("includes/graphs/common.inc.php"); $rrd_options .= " GPRINT:humidity:LAST:%3.0lf%%"; $rrd_options .= " GPRINT:humidity:MAX:%3.0lf%%\\\\l"; + if(is_numeric($sensor['sensor_limit'])) $rrd_options .= " HRULE:".$sensor['sensor_limit']."#999999::dashes"; + if(is_numeric($sensor['sensor_limit_low'])) $rrd_options .= " HRULE:".$sensor['sensor_limit_low']."#999999::dashes"; + ?> diff --git a/html/includes/graphs/sensor/temperature.inc.php b/html/includes/graphs/sensor/temperature.inc.php index b540f61fb5..787baf7ad3 100644 --- a/html/includes/graphs/sensor/temperature.inc.php +++ b/html/includes/graphs/sensor/temperature.inc.php @@ -33,9 +33,7 @@ include("includes/graphs/common.inc.php"); $rrd_options .= " GPRINT:temp_min:MIN:%4.1lfC"; $rrd_options .= " GPRINT:temp_max:MAX:%4.1lfC\\\\l"; - $rrd_options .= " HRULE:".$sensor['sensor_limit']."#999999::dashes"; - $rrd_options .= " HRULE:".$sensor['sensor_limit_low']."#999999::dashes"; - - + if(is_numeric($sensor['sensor_limit'])) $rrd_options .= " HRULE:".$sensor['sensor_limit']."#999999::dashes"; + if(is_numeric($sensor['sensor_limit_low'])) $rrd_options .= " HRULE:".$sensor['sensor_limit_low']."#999999::dashes"; ?> diff --git a/html/includes/graphs/sensor/voltage.inc.php b/html/includes/graphs/sensor/voltage.inc.php index 5a27b221d5..84911b1586 100644 --- a/html/includes/graphs/sensor/voltage.inc.php +++ b/html/includes/graphs/sensor/voltage.inc.php @@ -24,4 +24,7 @@ $rrd_options .= " LINE1.5:volt#cc0000:'" . $sensor['sensor_descr_fixed']."'"; $rrd_options .= " GPRINT:volt:LAST:%6.2lfV"; $rrd_options .= " GPRINT:volt:MAX:%6.2lfV\\\\l"; +if(is_numeric($sensor['sensor_limit'])) $rrd_options .= " HRULE:".$sensor['sensor_limit']."#999999::dashes"; +if(is_numeric($sensor['sensor_limit_low'])) $rrd_options .= " HRULE:".$sensor['sensor_limit_low']."#999999::dashes"; + ?> diff --git a/html/pages/device/health/sensors.inc.php b/html/pages/device/health/sensors.inc.php index 0479cd610b..b8ef284530 100644 --- a/html/pages/device/health/sensors.inc.php +++ b/html/pages/device/health/sensors.inc.php @@ -14,9 +14,9 @@ while($temp = mysql_fetch_array($query)) { echo(" " . $temp['sensor_descr'] . " " . $temp['sensor_type'] . " - " . print_temperature($temp['sensor_current'], $temp['sensor_limit']) .$unit. " - " . $temp['sensor_limit'] . $unit . " - " . $temp['sensor_limit_low'] . $unit ." + " . format_si($temp['sensor_current']) .$unit. " + " . format_si($temp['sensor_limit']) . $unit . " + " . format_si($temp['sensor_limit_low']) . $unit ." \n"); echo(""); diff --git a/includes/discovery/cisco-entity-sensor.inc.php b/includes/discovery/cisco-entity-sensor.inc.php index 09ad28de77..39fe915bf0 100644 --- a/includes/discovery/cisco-entity-sensor.inc.php +++ b/includes/discovery/cisco-entity-sensor.inc.php @@ -4,16 +4,42 @@ global $valid_sensor; if ($device['os'] == "ios" || $device['os_group'] == "ios") { - echo(" CISCO-ENTITY-SENSOR"); + echo("\nCISCO-ENTITY-SENSOR"); $oids = array(); + echo("\nCaching OIDs:"); + if(!is_array($entity_array)) + { + $entity_array = array(); + echo(" entPhysicalDescr"); + $entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalDescr", $entity_array, "CISCO-ENTITY-SENSOR-MIB"); + echo(" entPhysicalName"); + $entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalName", $entity_array, "CISCO-ENTITY-SENSOR-MIB"); + } + + echo(" entSensorType"); $oids = snmpwalk_cache_multi_oid($device, "entSensorType", $oids, "CISCO-ENTITY-SENSOR-MIB"); + echo(" entSensorScale"); $oids = snmpwalk_cache_multi_oid($device, "entSensorScale", $oids, "CISCO-ENTITY-SENSOR-MIB"); + echo(" entSensorValue"); $oids = snmpwalk_cache_multi_oid($device, "entSensorValue", $oids, "CISCO-ENTITY-SENSOR-MIB"); + echo(" entSensorMeasuredEntity"); $oids = snmpwalk_cache_multi_oid($device, "entSensorMeasuredEntity", $oids, "CISCO-ENTITY-SENSOR-MIB"); + echo(" entSensorPrecision"); $oids = snmpwalk_cache_multi_oid($device, "entSensorPrecision", $oids, "CISCO-ENTITY-SENSOR-MIB"); + $t_oids = array(); + echo(" entSensorThresholdSeverity"); + $t_oids = snmpwalk_cache_twopart_oid($device, "entSensorThresholdSeverity", $t_oids, "CISCO-ENTITY-SENSOR-MIB"); + echo(" entSensorThresholdRelation"); + $t_oids = snmpwalk_cache_twopart_oid($device, "entSensorThresholdRelation", $t_oids, "CISCO-ENTITY-SENSOR-MIB"); + echo(" entSensorThresholdValue"); + $t_oids = snmpwalk_cache_twopart_oid($device, "entSensorThresholdValue", $t_oids, "CISCO-ENTITY-SENSOR-MIB"); + + echo("\nSensors: "); + + if($debug) { print_r($oids); } $entitysensor['voltsDC'] = "voltage"; @@ -25,28 +51,31 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios") $entitysensor['rpm'] = "fanspeed"; $entitysensor['celsius'] = "temperature"; - if(is_array($oids[$device['device_id']])) + if(is_array($oids)) { - foreach($oids[$device['device_id']] as $index => $entry) + foreach($oids as $index => $entry) { #echo("[" . $entry['entSensorType'] . "|" . $entry['entSensorValue']. "|" . $index . "]"); if($entitysensor[$entry['entSensorType']] && is_numeric($entry['entSensorValue']) && is_numeric($index)) { $entPhysicalIndex = $index; - $descr = snmp_get($device, "entPhysicalName.".$index, "-Oqv", "ENTITY-MIB"); + $descr = $entity_array[$index]['entPhysicalName']; if($descr || $device['os'] == "iosxr") { $descr = rewrite_entity_descr($descr); } else { - $descr = snmp_get($device, "entPhysicalDescr.".$index, "-Oqv", "ENTITY-MIB"); + $descr = $entity_array[$index]['entPhysicalDescr']; $descr = rewrite_entity_descr($descr); } - + ## Set description based on measured entity if it exists if(is_numeric($entry['entSensorMeasuredEntity']) && $entry['entSensorMeasuredEntity']) { - $measured_descr = snmp_get($device, "entPhysicalName.".$entry['entSensorMeasuredEntity'],"-Oqv", "ENTITY-MIB"); - if(!measured_descr) { $measured_descr = snmp_get($device, "entPhysicalDescr.".$entry['entSensorMeasuredEntity'],"-Oqv", "ENTITY-MIB");} + $measured_descr = $entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalName']; + if(!measured_descr) + { + $measured_descr = $entity_array[$entry['entSensorMeasuredEntity']]['entPhysicalDescr']; + } $descr = $measured_descr . " - " . $descr; } @@ -70,10 +99,49 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios") if(is_numeric($entry['entSensorPrecision']) && $entry['entSensorPrecision'] > "0") { $divisor = $divisor . str_pad('', $entry['entSensorPrecision'], "0"); } $current = $current * $multiplier / $divisor; - $current = $current * $multiplier / $divisor; - discover_sensor($valid_sensor, $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, NULL, NULL, NULL, NULL, $temperature); + ### Set thresholds to null + $limit = NULL; $low_limit = NULL; $warn_limit = NULL; $warn_limit_low = NULL; + ### Check thresholds for this entry (bit dirty, but it works!) + if(is_array($t_oids[$index])) + { + foreach($t_oids[$index] as $t_index => $entry) + { + ### Critical Limit + if($entry['entSensorThresholdSeverity'] == "major" && $entry['entSensorThresholdRelation'] == "greaterOrEqual") + { + $limit = $entry['entSensorThresholdValue'] * $multiplier / $divisor; + } + + if($entry['entSensorThresholdSeverity'] == "major" && $entry['entSensorThresholdRelation'] == "lessOrEqual") + { + $limit_low = $entry['entSensorThresholdValue'] * $multiplier / $divisor; + } + ### Warning Limit + if($entry['entSensorThresholdSeverity'] == "minor" && $entry['entSensorThresholdRelation'] == "greaterOrEqual") + { + $warn_limit = $entry['entSensorThresholdValue'] * $multiplier / $divisor; + } + + if($entry['entSensorThresholdSeverity'] == "minor" && $entry['entSensorThresholdRelation'] == "lessOrEqual") + { + $warn_limit_low = $entry['entSensorThresholdValue'] * $multiplier / $divisor; + } + } + } + ### End Threshold code + + $ok = TRUE; + + if($current == "-127") { $ok = FALSE; } + + if($ok) { +# echo("\n$valid_sensor, $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $limit, $warn_limit, $current"); + discover_sensor($valid_sensor, $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $limit, $warn_limit, $current); + } $cisco_entity_temperature = 1; + unset($limit, $limit_low, $warn_limit, $warn_limit_low); + } } } diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index ac4bbe832d..a32220245b 100755 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -7,7 +7,6 @@ $community = $device['community']; if($device['os'] == "ironware") { echo(" Brocade FDP: "); $fdp_array = snmpwalk_cache_twopart_oid($device, "snFdpCacheEntry", array(), "FOUNDRY-SN-SWITCH-GROUP-MIB"); - $fdp_array = $fdp_array[$device['device_id']]; if($fdp_array) { unset($fdp_links); foreach( array_keys($fdp_array) as $key) @@ -34,7 +33,6 @@ if($device['os'] == "ironware") { echo(" CISCO-CDP-MIB: "); unset($cdp_array); $cdp_array = snmpwalk_cache_twopart_oid($device, "cdpCache", array(), "CISCO-CDP-MIB"); -$cdp_array = $cdp_array[$device['device_id']]; if($cdp_array) { unset($cdp_links); foreach( array_keys($cdp_array) as $key) @@ -65,9 +63,7 @@ echo(" LLDP-MIB: "); unset($lldp_array); $lldp_array = snmpwalk_cache_threepart_oid($device, "lldpRemoteSystemsData", array(), "LLDP-MIB"); -$lldp_array = $lldp_array[$device['device_id']]; $dot1d_array = snmpwalk_cache_oid($device, "dot1dBasePortIfIndex", array(), "BRIDGE-MIB"); -$dot1d_array = $dot1d_array[$device['device_id']]; #print_r($lldp_array); #print_r($dot1d_array); diff --git a/includes/discovery/entity-physical.inc.php b/includes/discovery/entity-physical.inc.php index 2cf44f8299..9d01662554 100755 --- a/includes/discovery/entity-physical.inc.php +++ b/includes/discovery/entity-physical.inc.php @@ -6,12 +6,16 @@ if($config['enable_inventory']) { + + echo("\nCaching OIDs:"); + $entity_array = array(); - $entity_array = snmpwalk_cache_oid($device, "entPhysicalEntry", $entity_array, "ENTITY-MIB"); + echo(" entPhysicalEntry"); + $entity_array = snmpwalk_cache_oid($device, "entPhysicalEntry", $entity_array, "ENTITY-MIB"); + echo(" entAliasMappingIdentifier"); + $entity_array = snmpwalk_cache_twopart_oid($device, "entAliasMappingIdentifier", $entity_array, "ENTITY-MIB:IF-MIB"); - if(!$entity_array[$device['device_id']]) { $entity_array[$device['device_id']] = array(); } - - foreach($entity_array[$device['device_id']] as $entPhysicalIndex => $entry) { + foreach($entity_array as $entPhysicalIndex => $entry) { $entPhysicalDescr = $entry['entPhysicalDescr']; $entPhysicalContainedIn = $entry['entPhysicalContainedIn']; @@ -29,12 +33,12 @@ $entPhysicalAlias = $entry['entPhysicalAlias']; $entPhysicalAssetID = $entry['entPhysicalAssetID']; + if(isset($entity_array['$entPhysicalIndex']['0']['entAliasMappingIdentifier'])) { $ifIndex = $entity_array['$entPhysicalIndex']['0']['entAliasMappingIdentifier']; } - $ent_data = $config['snmpget'] . " -M ".$config['mibdir']." -m ENTITY-MIB:IF-MIB -Ovqs -"; - $ent_data .= $device['snmpver'] . " -M ".$config['mibdir']." -c " . $device['community'] . " " . $device['hostname'] .":".$device['port']; - $ent_data .= " entAliasMappingIdentifier." . $entPhysicalIndex. ".0"; - - $ifIndex = shell_exec($ent_data); +# $ent_data = $config['snmpget'] . " -M ".$config['mibdir']." -m ENTITY-MIB:IF-MIB -Ovqs -"; +# $ent_data .= $device['snmpver'] . " -M ".$config['mibdir']." -c " . $device['community'] . " " . $device['hostname'] .":".$device['port']; +# $ent_data .= " entAliasMappingIdentifier." . $entPhysicalIndex. ".0"; +# $ifIndex = shell_exec($ent_data); if(!strpos($ifIndex, "fIndex") || $ifIndex == "") { unset($ifIndex); } list(,$ifIndex) = explode(".", $ifIndex); @@ -66,26 +70,6 @@ echo("+"); } -# if($entPhysicalClass == "sensor") -# { -# $entSensorType = $entry['entSensorType']; -# $entSensorScale = $entry['entSensorScale']; -# $entSensorPrecision = $entry['entSensorPrecision']; -# $entSensorValueUpdateRate = $entry['entSensorValueUpdateRate']; -# $entSensorMeasuredEntity = $entry['entSensorMeasuredEntity']; - -# if($config['allow_entity_sensor'][$entSensorType]) { -# $sql = "UPDATE `entPhysical` SET entSensorType = '$entSensorType', entSensorScale = '$entSensorScale', entSensorPrecision = '$entSensorPrecision', "; -# $sql .= " entSensorMeasuredEntity = '$entSensorMeasuredEntity'"; -# $sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"; -# } else { -# echo("!"); -# $sql = "UPDATE `entPhysical` SET entSensorType = '', entSensorScale = '', entSensorPrecision = '', entSensorMeasuredEntity = ''"; -# $sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"; -# } -# mysql_query($sql); -# } - $valid[$entPhysicalIndex] = 1; } } diff --git a/includes/discovery/entity-sensor.inc.php b/includes/discovery/entity-sensor.inc.php index aa222c9604..bf7b047499 100644 --- a/includes/discovery/entity-sensor.inc.php +++ b/includes/discovery/entity-sensor.inc.php @@ -4,10 +4,26 @@ global $valid_sensor; echo(" ENTITY-SENSOR"); + echo("\nCaching OIDs:"); + + if(!is_array($entity_array)) + { + $entity_array = array(); + echo(" entPhysicalDescr"); + $entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalDescr", $entity_array, "CISCO-ENTITY-SENSOR-MIB"); + echo(" entPhysicalName"); + $entity_array = snmpwalk_cache_multi_oid($device, "entPhysicalName", $entity_array, "CISCO-ENTITY-SENSOR-MIB"); + } + + $oids = array(); +echo(" entPhySensorType"); $oids = snmpwalk_cache_multi_oid($device, "entPhySensorType", $oids, "ENTITY-SENSOR-MIB"); +echo(" entPhySensorScale"); $oids = snmpwalk_cache_multi_oid($device, "entPhySensorScale", $oids, "ENTITY-SENSOR-MIB"); +echo(" entPhySensorPrecision"); $oids = snmpwalk_cache_multi_oid($device, "entPhySensorPrecision", $oids, "ENTITY-SENSOR-MIB"); +echo(" entPhySensorValue"); $oids = snmpwalk_cache_multi_oid($device, "entPhySensorValue", $oids, "ENTITY-SENSOR-MIB"); $entitysensor['voltsDC'] = "voltage"; @@ -19,22 +35,27 @@ $entitysensor['percentRH'] = "humidity"; $entitysensor['rpm'] = "fanspeed"; $entitysensor['celsius'] = "temperature"; -if(is_array($oids[$device['device_id']])) +if(is_array($oids)) { - foreach($oids[$device['device_id']] as $index => $entry) + foreach($oids as $index => $entry) { #echo("[" . $entry['entPhySensorType'] . "|" . $entry['entPhySensorValue']. "|" . $index . "]"); if($entitysensor[$entry['entPhySensorType']] && is_numeric($entry['entPhySensorValue']) && is_numeric($index)) { $entPhysicalIndex = $index; - $descr = snmp_get($device, "entPhysicalDescr.".$index, "-Oqv", "ENTITY-SENSOR-MIB"); $oid = ".1.3.6.1.2.1.99.1.1.1.4.".$index; $current = $entry['entPhySensorValue']; #ENTITY-SENSOR-MIB::entPhySensorUnitsDisplay.11 = STRING: "C" - $descr = snmp_get($device, "entPhysicalName.".$index, "-Oqv", "ENTITY-MIB"); - if(!$descr) { $descr = snmp_get($device, "entPhysicalDescr.".$index, "-Oqv", "ENTITY-MIB"); } + $descr = $entity_array[$index]['entPhysicalName']; + if($descr || $device['os'] == "iosxr") + { + $descr = rewrite_entity_descr($descr); + } else { + $descr = $entity_array[$index]['entPhysicalDescr']; + $descr = rewrite_entity_descr($descr); + } $valid = TRUE; @@ -60,6 +81,8 @@ if(is_array($oids[$device['device_id']])) #echo($descr . "|" . $index . "|" .$current . "|" . $multiplier . "|" . $divisor ."|" . $entry['entPhySensorScale'] . "|" . $entry['entPhySensorPrecision'] . "\n"); + if($current == "-127") { $valid = FALSE; } + if($valid && mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = '".$device['device_id']."' AND `sensor_class` = '".$type."' AND `sensor_type` = 'cisco-entity-sensor' AND `sensor_index` = '".$index."'"),0) == "0") ## Check to make sure we've not already seen this sensor via cisco's entity sensor mib { diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 470a0f9c00..887ef032dd 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -1,4 +1,6 @@ $entry) { + if(is_array($vp_array)) { + foreach($vp_array as $index => $entry) { list($ifIndex,$vp_id)= explode('.', $index); diff --git a/includes/discovery/mempools/cemp.inc.php b/includes/discovery/mempools/cemp.inc.php index ef940eae63..128d4bdc48 100755 --- a/includes/discovery/mempools/cemp.inc.php +++ b/includes/discovery/mempools/cemp.inc.php @@ -8,8 +8,8 @@ if($device['os'] == "ios" || $device['os_group'] == "ios") { $array = snmpwalk_cache_multi_oid($device, "cempMemPoolEntry", NULL, "CISCO-ENHANCED-MEMPOOL-MIB"); - if(is_array($array[$device['device_id']])) { - foreach($array[$device['device_id']] as $index => $entry) { + if(is_array($array)) { + foreach($array as $index => $entry) { if(is_numeric($entry['cempMemPoolUsed']) && $entry['cempMemPoolValid'] == "true") { list($entPhysicalIndex) = explode(".", $index); $entPhysicalName = snmp_get($device, "entPhysicalDescr.".$entPhysicalIndex, "-Oqv", "ENTITY-MIB"); diff --git a/includes/discovery/mempools/cmp.inc.php b/includes/discovery/mempools/cmp.inc.php index 9b355b81d0..bfc35b9ef0 100755 --- a/includes/discovery/mempools/cmp.inc.php +++ b/includes/discovery/mempools/cmp.inc.php @@ -13,7 +13,7 @@ if(($device['os'] == "ios" || $device['os_group'] == "ios") && $cemp_count == "0 $cmp_array = snmpwalk_cache_oid($device, 'ciscoMemoryPool', NULL, "CISCO-MEMORY-POOL-MIB"); if(is_array($cmp_array)) { - foreach($cmp_array[$device[device_id]] as $index => $cmp) { + foreach($cmp_array as $index => $cmp) { if(is_numeric($cmp['ciscoMemoryPoolUsed']) && is_numeric($index)) { discover_mempool($valid_mempool, $device, $index, "cmp", $cmp['ciscoMemoryPoolName'], "1", NULL, NULL); } diff --git a/includes/discovery/mempools/hp-procurve.inc.php b/includes/discovery/mempools/hp-procurve.inc.php index bd01627d46..661262dfc6 100755 --- a/includes/discovery/mempools/hp-procurve.inc.php +++ b/includes/discovery/mempools/hp-procurve.inc.php @@ -23,7 +23,7 @@ global $valid_mempool; if(is_array($array)) { echo("procurve : "); - foreach($array[$device[device_id]] as $index => $mempool) + foreach($array as $index => $mempool) { if(is_numeric($index) && is_numeric($mempool['hpLocalMemTotalBytes'])) { discover_mempool($valid_mempool, $device, $index, "hpLocal", "Local Memory ".$index, NULL, NULL, NULL); diff --git a/includes/discovery/mempools/hrstorage.inc.php b/includes/discovery/mempools/hrstorage.inc.php index 2743dcab77..87ff3779d4 100755 --- a/includes/discovery/mempools/hrstorage.inc.php +++ b/includes/discovery/mempools/hrstorage.inc.php @@ -6,7 +6,7 @@ $storage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOU if(is_array($storage_array)) { echo("hrStorage : "); - foreach($storage_array[$device[device_id]] as $index => $storage) + foreach($storage_array as $index => $storage) { $fstype = $storage['hrStorageType']; $descr = $storage['hrStorageDescr']; diff --git a/includes/discovery/mempools/junos.inc.php b/includes/discovery/mempools/junos.inc.php index 77355f93b5..4991e57427 100755 --- a/includes/discovery/mempools/junos.inc.php +++ b/includes/discovery/mempools/junos.inc.php @@ -11,8 +11,8 @@ if($device['os'] == "junos") $mempools_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDescr", $mempools_array, "JUNIPER-MIB" , $config['install_dir']."/mibs/junos"); if($debug) { print_r($mempools_array); } - if(is_array($mempools_array[$device['device_id']])) { - foreach($mempools_array[$device['device_id']] as $index => $entry) { + if(is_array($mempools_array)) { + foreach($mempools_array as $index => $entry) { if($entry['jnxOperatingDRAMSize'] && !strpos($entry['jnxOperatingDescr'], "sensor") && !strstr($entry['jnxOperatingDescr'], "fan")) { if ($debug) { echo($index . " " . $entry['jnxOperatingDescr'] . " -> " . $entry['jnxOperatingBuffer'] . " -> " . $entry['jnxOperatingDRAMSize'] . "\n"); } $usage_oid = ".1.3.6.1.4.1.2636.3.1.13.1.8." . $index; diff --git a/includes/discovery/processors/hrdevice.inc.php b/includes/discovery/processors/hrdevice.inc.php index 6495dff697..3a58fccd3e 100755 --- a/includes/discovery/processors/hrdevice.inc.php +++ b/includes/discovery/processors/hrdevice.inc.php @@ -8,7 +8,7 @@ unset($hrDevice_array); foreach ($hrDevice_oids as $oid) { $hrDevice_array = snmpwalk_cache_oid($device, $oid, $hrDevice_array, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); } if(is_array($hrDevice_array)) { - foreach($hrDevice_array[$device['device_id']] as $index => $entry) + foreach($hrDevice_array as $index => $entry) { if ($entry['hrDeviceType'] == "hrDeviceProcessor") { diff --git a/includes/discovery/processors/ios.inc.php b/includes/discovery/processors/ios.inc.php index c0dc566cdd..b3554d17a4 100755 --- a/includes/discovery/processors/ios.inc.php +++ b/includes/discovery/processors/ios.inc.php @@ -8,7 +8,7 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios") $processors_array = snmpwalk_cache_oid($device, "cpmCPU", NULL, "CISCO-PROCESS-MIB"); if($debug) { print_r($processors_array); } - foreach ($processors_array[$device['device_id']] as $index => $entry) + foreach ($processors_array as $index => $entry) { if (is_numeric($entry['cpmCPUTotal5minRev']) || is_numeric($entry['cpmCPUTotal5min'])) { diff --git a/includes/discovery/processors/ironware.inc.php b/includes/discovery/processors/ironware.inc.php index bdc68426b0..b6763006de 100755 --- a/includes/discovery/processors/ironware.inc.php +++ b/includes/discovery/processors/ironware.inc.php @@ -7,7 +7,7 @@ if($device['os'] == "ironware" || $device['os_group'] == "ironware") echo("IronWare : "); $processors_array = snmpwalk_cache_triple_oid($device, "snAgentCpuUtilEntry", $processors_array, "FOUNDRY-SN-AGENT-MIB"); if($debug) { print_r($processors_array); } - foreach($processors_array[$device['device_id']] as $index => $entry) + foreach($processors_array as $index => $entry) { if (($entry['snAgentCpuUtilValue'] || $entry['snAgentCpuUtil100thPercent']) && $entry['snAgentCpuUtilInterval'] == "300") { diff --git a/includes/discovery/processors/junos.inc.php b/includes/discovery/processors/junos.inc.php index 5f206aadb6..a678aa5dbb 100755 --- a/includes/discovery/processors/junos.inc.php +++ b/includes/discovery/processors/junos.inc.php @@ -11,9 +11,9 @@ if($device['os'] == "junos") $processors_array = snmpwalk_cache_multi_oid($device, "jnxOperatingDescr", $processors_array, "JUNIPER-MIB" , '+'.$config['install_dir']."/mibs/junos"); if ($debug) { print_r($processors_array); } - if (is_array($processors_array[$device['device_id']])) + if (is_array($processors_array)) { - foreach ($processors_array[$device['device_id']] as $index => $entry) + foreach ($processors_array as $index => $entry) { if ($entry['jnxOperatingDescr'] == "Routing Engine" || $entry['jnxOperatingDRAMSize'] && !strpos($entry['jnxOperatingDescr'], "sensor") && !strstr($entry['jnxOperatingDescr'], "fan")) { diff --git a/includes/discovery/processors/junose.inc.php b/includes/discovery/processors/junose.inc.php index 81d38325fe..ed8b5f8751 100755 --- a/includes/discovery/processors/junose.inc.php +++ b/includes/discovery/processors/junose.inc.php @@ -9,7 +9,7 @@ if($device['os'] == "junose") $processors_array = snmpwalk_cache_double_oid($device, "juniSystemModule", $processors_array, "Juniper-System-MIB" , $config['install_dir']."/mibs/junose"); if($debug) { print_r($processors_array); } - foreach ($processors_array[$device['device_id']] as $index => $entry) + foreach ($processors_array as $index => $entry) { if ($entry['juniSystemModuleCpuUtilPct'] && $entry['juniSystemModuleCpuUtilPct'] != "-1") { diff --git a/includes/discovery/storage-hrstorage.inc.php b/includes/discovery/storage-hrstorage.inc.php index b46f3ddf3d..f3111ba25c 100755 --- a/includes/discovery/storage-hrstorage.inc.php +++ b/includes/discovery/storage-hrstorage.inc.php @@ -4,7 +4,7 @@ $storage_array = snmpwalk_cache_oid($device, "hrStorageEntry", NULL, "HOST-RESOU if(is_array($storage_array)) { echo("hrStorage : "); - foreach($storage_array[$device[device_id]] as $index => $storage) + foreach($storage_array as $index => $storage) { $fstype = $storage['hrStorageType']; diff --git a/includes/discovery/temperatures/cisco-envmon.inc.php b/includes/discovery/temperatures/cisco-envmon.inc.php index 11e528701f..98b3ff03ce 100644 --- a/includes/discovery/temperatures/cisco-envmon.inc.php +++ b/includes/discovery/temperatures/cisco-envmon.inc.php @@ -1,8 +1,9 @@ $entry) + foreach($oids as $index => $entry) { $descr = "Slot ".$index; $oid = ".1.3.6.1.4.1.6027.3.8.1.2.1.1.5.".$index; diff --git a/includes/discovery/temperatures/ftos-e-series.inc.php b/includes/discovery/temperatures/ftos-e-series.inc.php index ca9fa5eaf4..f9f5d00a79 100644 --- a/includes/discovery/temperatures/ftos-e-series.inc.php +++ b/includes/discovery/temperatures/ftos-e-series.inc.php @@ -17,9 +17,9 @@ if ($device['os'] == "ftos" || $device['os_group'] == "ftos") $oids = snmpwalk_cache_oid($device, "chSysCardUpperTemp", array(), "F10-CHASSIS-MIB", $config['mib_dir'].":".$config['mib_dir']."/ftos" ); - if(is_array($oids[$device['device_id']])) + if(is_array($oids)) { - foreach($oids[$device['device_id']] as $index => $entry) + foreach($oids as $index => $entry) { $descr = "Slot ".$index; $oid = ".1.3.6.1.4.1.6027.3.1.1.2.3.1.8.".$index; diff --git a/includes/discovery/temperatures/ftos-s-series.inc.php b/includes/discovery/temperatures/ftos-s-series.inc.php index 6759640de6..3927ed5e58 100644 --- a/includes/discovery/temperatures/ftos-s-series.inc.php +++ b/includes/discovery/temperatures/ftos-s-series.inc.php @@ -15,9 +15,9 @@ if ($device['os'] == "ftos" || $device['os_group'] == "ftos") $oids = snmpwalk_cache_oid($device, "chStackUnitSysType", $oids, "F10-S-SERIES-CHASSIS-MIB", $config['mib_dir'].":".$config['mib_dir']."/ftos" ); - if(is_array($oids[$device['device_id']])) + if(is_array($oids)) { - foreach($oids[$device['device_id']] as $index => $entry) + foreach($oids as $index => $entry) { $descr = "Unit ".$index . " " . $entry['chStackUnitSysType']; $oid = ".1.3.6.1.4.1.6027.3.10.1.2.2.1.14.".$index; diff --git a/includes/discovery/temperatures/junose.inc.php b/includes/discovery/temperatures/junose.inc.php index dc357c597a..8ab5b32b8e 100644 --- a/includes/discovery/temperatures/junose.inc.php +++ b/includes/discovery/temperatures/junose.inc.php @@ -8,9 +8,9 @@ if ($device['os'] == "junose") { echo("JunOSe: "); $oids = snmpwalk_cache_multi_oid($device, "juniSystemTempValue", array(), "Juniper-System-MIB", $config['install_dir']."/mibs/junose"); - if(is_array($oids[$device['device_id']])) + if(is_array($oids)) { - foreach($oids[$device[device_id]] as $index => $entry) + foreach($oids as $index => $entry) { if(is_numeric($entry['juniSystemTempValue']) && is_numeric($index) && $entry['juniSystemTempValue'] > "0") { diff --git a/includes/discovery/temperatures/zyxel-ies.inc.php b/includes/discovery/temperatures/zyxel-ies.inc.php index f07b54d428..fa57949b55 100644 --- a/includes/discovery/temperatures/zyxel-ies.inc.php +++ b/includes/discovery/temperatures/zyxel-ies.inc.php @@ -12,9 +12,9 @@ if ($device['os'] == 'ies') $oids = snmpwalk_cache_multi_oid($device, "accessSwitchSysTempCurValue", $oids, "ZYXEL-AS-MIB"); $oids = snmpwalk_cache_multi_oid($device, "accessSwitchSysTempHighThresh", $oids, "ZYXEL-AS-MIB"); - if(is_array($oids[$device['device_id']])) + if(is_array($oids)) { - foreach($oids[$device[device_id]] as $index => $entry) + foreach($oids as $index => $entry) { $entPhysicalIndex = $index; $descr = trim(snmp_get($device, "accessSwitchSysTempDescr.".$index, "-Oqv", "ZYXEL-AS-MIB"),'"'); diff --git a/includes/discovery/ucd-diskio.inc.php b/includes/discovery/ucd-diskio.inc.php index 4b6e29dfec..29b44ff2b9 100644 --- a/includes/discovery/ucd-diskio.inc.php +++ b/includes/discovery/ucd-diskio.inc.php @@ -5,8 +5,8 @@ $valid_diskio = array(); # if($debug) { print_r($diskio_array); } - if(is_array($diskio_array[$device['device_id']])) { - foreach($diskio_array[$device['device_id']] as $index => $entry) { + if(is_array($diskio_array)) { + foreach($diskio_array as $index => $entry) { if($entry['diskIONRead'] > "0" || $entry['diskIONWritten'] > "0") { if ($debug) { echo("$index ".$entry['diskIODevice']."\n"); } diff --git a/includes/functions.php b/includes/functions.php index 45296c0712..21a9870917 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -124,10 +124,18 @@ function formatstorage($rate, $round = '2') function format_si($rate) { - $sizes = Array('', 'k', 'M', 'G', 'T', 'P', 'E'); - $round = Array('0','0','0','2','2','2','2','2','2'); - $ext = $sizes[0]; - for ($i=1; (($i < count($sizes)) && ($rate >= 1000)); $i++) { $rate = $rate / 1000; $ext = $sizes[$i]; } + if($rate >= "0.1") { + $sizes = Array('', 'k', 'M', 'G', 'T', 'P', 'E'); + $round = Array('2','2','2','2','2','2','2','2','2'); + $ext = $sizes[0]; + for ($i=1; (($i < count($sizes)) && ($rate >= 1000)); $i++) { $rate = $rate / 1000; $ext = $sizes[$i]; } + } else { + $sizes = Array('', 'm', 'u', 'n'); + $round = Array('2','2','2','2'); + $ext = $sizes[0]; + for ($i=1; (($i < count($sizes)) && ($rate != 0) && ($rate <= 0.1)); $i++) { $rate = $rate * 1000; $ext = $sizes[$i]; } + } + return round($rate, $round[$i]).$ext; } diff --git a/includes/polling/altiga-ssl.inc.php b/includes/polling/altiga-ssl.inc.php index 4e1a095519..ccf4e610c6 100755 --- a/includes/polling/altiga-ssl.inc.php +++ b/includes/polling/altiga-ssl.inc.php @@ -28,15 +28,15 @@ if($device['os'] == "asa" || $device['os'] == "pix") { foreach($oids as $oid) { - if(is_numeric($data_array[$device['device_id']][0][$oid])) { - $value = $data_array[$device['device_id']][0][$oid]; + if(is_numeric($data_array[0][$oid])) { + $value = $data_array[0][$oid]; } else { $value = "0"; } $rrdupdate .= ":$value"; } - if($data_array[$device['device_id']][0]['alSslStatsTotalSessions'] || is_file($rrdfile)) + if($data_array[0]['alSslStatsTotalSessions'] || is_file($rrdfile)) { rrdtool_update($rrdfile, $rrdupdate); } diff --git a/includes/polling/cisco-ipsec-flow-monitor.inc.php b/includes/polling/cisco-ipsec-flow-monitor.inc.php index ed847bdf0f..496eea8c9f 100755 --- a/includes/polling/cisco-ipsec-flow-monitor.inc.php +++ b/includes/polling/cisco-ipsec-flow-monitor.inc.php @@ -35,7 +35,7 @@ if($device['os_group'] == "ios") { $data = snmpwalk_cache_oid($device, "cipSecGlobalStats", NULL, "CISCO-IPSEC-FLOW-MONITOR-MIB"); - $data = $data[$device['device_id']][0]; + $data = $data[0]; ## Use HC Counters if they exist if(is_numeric($data['cipSecGlobalHcInOctets'])) { $data['cipSecGlobalInOctets']= $data['cipSecGlobalHcInOctets']; } diff --git a/includes/polling/cisco-mac-accounting.inc.php b/includes/polling/cisco-mac-accounting.inc.php index 4309256092..0be6e51e74 100755 --- a/includes/polling/cisco-mac-accounting.inc.php +++ b/includes/polling/cisco-mac-accounting.inc.php @@ -23,7 +23,7 @@ while ($acc = mysql_fetch_assoc($mac_accounting_query)) { $polled_period = $polled - $acc['poll_time']; - if($cip_array[$device_id][$ifIndex][$mac]) { + if($cip_array[$ifIndex][$mac]) { $update .= "`poll_time` = '".$polled."'"; $update .= ", `poll_prev` = '".$acc['poll_time']."'"; @@ -31,12 +31,12 @@ while ($acc = mysql_fetch_assoc($mac_accounting_query)) { $mac_entries++; - $b_in = $cip_array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedBytes']['input']; - $b_out = $cip_array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedBytes']['output']; - $p_in = $cip_array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedPkts']['input']; - $p_out = $cip_array[$device_id][$ifIndex][$mac]['cipMacHCSwitchedPkts']['output']; + $b_in = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedBytes']['input']; + $b_out = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedBytes']['output']; + $p_in = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedPkts']['input']; + $p_out = $cip_array[$ifIndex][$mac]['cipMacHCSwitchedPkts']['output']; - $this_ma = &$cip_array[$device_id][$ifIndex][$mac]; + $this_ma = &$cip_array[$ifIndex][$mac]; /// Update metrics foreach ($cip_oids as $oid) { diff --git a/includes/polling/ipSystemStats.inc.php b/includes/polling/ipSystemStats.inc.php index f432fe3ba4..1886c46104 100755 --- a/includes/polling/ipSystemStats.inc.php +++ b/includes/polling/ipSystemStats.inc.php @@ -50,7 +50,6 @@ echo("Polling IP-MIB ipSystemStats "); $ipSystemStats = snmpwalk_cache_oid($device, "ipSystemStats", NULL, "IP-MIB"); - $ipSystemStats = $ipSystemStats[$device[device_id]]; if($ipSystemStats) { diff --git a/includes/polling/junose-atm-vp.inc.php b/includes/polling/junose-atm-vp.inc.php index 75bdd37b1f..8c3b21571b 100755 --- a/includes/polling/junose-atm-vp.inc.php +++ b/includes/polling/junose-atm-vp.inc.php @@ -15,7 +15,6 @@ if(mysql_affected_rows()) { $vp_cache = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsOutPackets", $vp_cache, "Juniper-UNI-ATM-MIB" , $config['install_dir']."/mibs/junose"); $vp_cache = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsOutPacketOctets", $vp_cache, "Juniper-UNI-ATM-MIB" , $config['install_dir']."/mibs/junose"); $vp_cache = snmpwalk_cache_multi_oid($device, "juniAtmVpStatsOutPacketErrors", $vp_cache, "Juniper-UNI-ATM-MIB" , $config['install_dir']."/mibs/junose"); - $vp_cache = $vp_cache[$device[device_id]]; echo("Checking JunOSe ATM vps: "); diff --git a/includes/polling/mempools/hpGlobal.inc.php b/includes/polling/mempools/hpGlobal.inc.php index ed6a8d3f3c..f47acad772 100755 --- a/includes/polling/mempools/hpGlobal.inc.php +++ b/includes/polling/mempools/hpGlobal.inc.php @@ -13,7 +13,7 @@ if(!is_array($mempool_cache['hpGlobal'])) { if ($debug) { print_r($mempool_cache); } } else { if($debug) { echo("Cached!"); } } -$entry = $mempool_cache['hpGlobal'][$device[device_id]][$mempool[mempool_index]]; +$entry = $mempool_cache['hpGlobal'][$mempool[mempool_index]]; $mempool['units'] = "1"; $mempool['used'] = $entry['hpGlobalMemAllocBytes']; diff --git a/includes/polling/mempools/hpLocal.inc.php b/includes/polling/mempools/hpLocal.inc.php index b8f7f023ab..0034d36e20 100644 --- a/includes/polling/mempools/hpLocal.inc.php +++ b/includes/polling/mempools/hpLocal.inc.php @@ -13,7 +13,7 @@ if(!is_array($mempool_cache['hpLocal'])) { if ($debug) { print_r($mempool_cache); } } else { if($debug) { echo("Cached!"); } } -$entry = $mempool_cache['hpLocal'][$device[device_id]][$mempool[mempool_index]]; +$entry = $mempool_cache['hpLocal'][$mempool[mempool_index]]; $mempool['units'] = "1"; $mempool['used'] = $entry['hpLocalMemAllocBytes']; diff --git a/includes/polling/mempools/hrstorage.inc.php b/includes/polling/mempools/hrstorage.inc.php index 571761c268..56b8510a09 100755 --- a/includes/polling/mempools/hrstorage.inc.php +++ b/includes/polling/mempools/hrstorage.inc.php @@ -7,7 +7,7 @@ if(!is_array($storage_cache['hrstorage'])) { if ($debug) { print_r($storage_cache); } } else { if($debug) { echo("Cached!"); } } -$entry = $storage_cache['hrstorage'][$device[device_id]][$mempool[mempool_index]]; +$entry = $storage_cache['hrstorage'][$mempool[mempool_index]]; $mempool['units'] = $entry['hrStorageAllocationUnits']; $mempool['used'] = $entry['hrStorageUsed'] * $mempool['units']; diff --git a/includes/polling/mempools/junos.inc.php b/includes/polling/mempools/junos.inc.php index fd2ba79d13..92cb9fc7f0 100755 --- a/includes/polling/mempools/junos.inc.php +++ b/includes/polling/mempools/junos.inc.php @@ -12,7 +12,7 @@ if(!is_array($mempool_cache['junos'])) { if($debug) {print_r($mempool_cache);} } -$entry = $mempool_cache['junos'][$device[device_id]][$mempool[mempool_index]]; +$entry = $mempool_cache['junos'][$mempool[mempool_index]]; $perc = $entry['jnxOperatingBuffer']; $mempool['total'] = $entry['jnxOperatingDRAMSize']; diff --git a/includes/polling/netstats-icmp.inc.php b/includes/polling/netstats-icmp.inc.php index 3369698bdb..1c8258ef53 100755 --- a/includes/polling/netstats-icmp.inc.php +++ b/includes/polling/netstats-icmp.inc.php @@ -29,8 +29,8 @@ if($device[os] != "Snom") { $rrdupdate = "N"; foreach($oids as $oid){ - if(is_numeric($data_array[$device['device_id']][0][$oid])) { - $value = $data_array[$device['device_id']][0][$oid]; + if(is_numeric($data_array[0][$oid])) { + $value = $data_array[0][$oid]; } else { $value = "0"; } @@ -39,7 +39,7 @@ if($device[os] != "Snom") { unset($snmpstring); - if(isset($data_array[$device['device_id']][0]['icmpInMsgs']) && isset($data_array[$device['device_id']][0]['icmpOutMsgs'])) { + if(isset($data_array[0]['icmpInMsgs']) && isset($data_array[0]['icmpOutMsgs'])) { if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } rrdtool_update($rrd_file, $rrdupdate); $graphs['netstat_icmp'] = TRUE; diff --git a/includes/polling/netstats-snmp.inc.php b/includes/polling/netstats-snmp.inc.php index 9cd0ae3fdd..91df5d9fa3 100755 --- a/includes/polling/netstats-snmp.inc.php +++ b/includes/polling/netstats-snmp.inc.php @@ -27,15 +27,15 @@ if($device[os] != "Snom") { $rrdupdate = "N"; foreach($oids as $oid){ - if(is_numeric($data_array[$device['device_id']][0][$oid])) { - $value = $data_array[$device['device_id']][0][$oid]; + if(is_numeric($data_array[0][$oid])) { + $value = $data_array[0][$oid]; } else { $value = "0"; } $rrdupdate .= ":$value"; } - if(isset($data_array[$device['device_id']][0]['snmpInPkts']) && isset($data_array[$device['device_id']][0]['snmpOutPkts'])) { + if(isset($data_array[0]['snmpInPkts']) && isset($data_array[0]['snmpOutPkts'])) { if(!file_exists($rrd_file)) { rrdtool_create($rrd_file, $rrd_create); } rrdtool_update($rrd_file, $rrdupdate); $graphs['netstat_snmp'] = TRUE; diff --git a/includes/polling/port-etherlike.inc.php b/includes/polling/port-etherlike.inc.php index f7aea62567..58df4a93f5 100755 --- a/includes/polling/port-etherlike.inc.php +++ b/includes/polling/port-etherlike.inc.php @@ -1,7 +1,7 @@