mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
vastly improved entity-sensors and cisco-entity-sensors speed. improved entity-mib inventory. removed device_id element from oid caches. add min/max ranges to sensor graphs.
git-svn-id: http://www.observium.org/svn/observer/trunk@1669 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -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");
|
||||
|
@@ -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)
|
||||
|
@@ -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";
|
||||
|
||||
|
||||
?>
|
||||
|
@@ -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";
|
||||
|
||||
?>
|
||||
|
@@ -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";
|
||||
|
||||
?>
|
||||
|
@@ -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";
|
||||
|
||||
?>
|
||||
|
@@ -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";
|
||||
|
||||
?>
|
||||
|
@@ -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";
|
||||
|
||||
?>
|
||||
|
@@ -14,9 +14,9 @@ while($temp = mysql_fetch_array($query)) {
|
||||
echo("<tr class=list-large style=\"background-color: $row_colour; padding: 5px;\">
|
||||
<td width=500>" . $temp['sensor_descr'] . "</td>
|
||||
<td>" . $temp['sensor_type'] . "</td>
|
||||
<td width=50>" . print_temperature($temp['sensor_current'], $temp['sensor_limit']) .$unit. "</td>
|
||||
<td width=50>" . $temp['sensor_limit'] . $unit . "</td>
|
||||
<td width=50>" . $temp['sensor_limit_low'] . $unit ."</td>
|
||||
<td width=50>" . format_si($temp['sensor_current']) .$unit. "</td>
|
||||
<td width=50>" . format_si($temp['sensor_limit']) . $unit . "</td>
|
||||
<td width=50>" . format_si($temp['sensor_limit_low']) . $unit ."</td>
|
||||
</tr>\n");
|
||||
echo("<tr bgcolor=$row_colour><td colspan='5'>");
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -6,12 +6,16 @@
|
||||
|
||||
if($config['enable_inventory']) {
|
||||
|
||||
|
||||
echo("\nCaching OIDs:");
|
||||
|
||||
$entity_array = array();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
{
|
||||
|
@@ -1,4 +1,6 @@
|
||||
<?php
|
||||
|
||||
### Discover sensors
|
||||
function discover_sensor (&$valid, $class, $device, $oid, $index, $type, $descr, $divisor = '1', $multiplier = '1', $low_limit = NULL, $low_warn_limit = NULL, $warn_limit = NULL, $high_limit = NULL, $current = NULL)
|
||||
{
|
||||
global $config, $debug;
|
||||
@@ -22,17 +24,35 @@ function discover_sensor (&$valid, $class, $device, $oid, $index, $type, $descr
|
||||
{
|
||||
$sensor_entry = mysql_fetch_array(mysql_query("SELECT * FROM `sensors` WHERE sensor_class='" . mres($class) . "' AND device_id = '".$device['device_id']."' AND sensor_type = '$type' AND `sensor_index` = '$index'"));
|
||||
|
||||
if(!$high_limit)
|
||||
{
|
||||
if(!$sensor_entry['sensor_limit'])
|
||||
{
|
||||
$high_limit = sensor_limit($class, $current);
|
||||
} else {
|
||||
$high_limit = $sensor_entry['sensor_limit'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($high_limit != $sensor_entry['sensor_limit'])
|
||||
{
|
||||
mysql_query("UPDATE sensors SET `sensor_limit` = '".$high_limit."' WHERE `sensor_id` = '".$sensor_entry['sensor_id']."'");
|
||||
echo("H");
|
||||
log_event("Sensor High Limit Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr)." (".$high_limit.")", $device['device_id'], 'sensor', $sensor_id);
|
||||
}
|
||||
|
||||
if(!$sensor_entry['sensor_low_limit'])
|
||||
if(!$low_limit)
|
||||
{
|
||||
if(!$sensor_entry['sensor_limit_low'])
|
||||
{
|
||||
$low_limit = sensor_low_limit($class, $current);
|
||||
} else {
|
||||
$low_limit = $sensor_entry['sensor_limit_low'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($sensor_entry['sensor_limit_low'] != $low_limit)
|
||||
{
|
||||
mysql_query("UPDATE sensors SET `sensor_limit_low` = '".$low_limit."' WHERE `sensor_id` = '".$sensor_entry['sensor_id']."'");
|
||||
echo("L");
|
||||
log_event("Sensor Low Limit Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr)." (".$low_limit.")", $device['device_id'], 'sensor', $sensor_id);
|
||||
@@ -72,7 +92,7 @@ function sensor_low_limit ($class, $current) {
|
||||
$limit = $current * 0.95;
|
||||
break;
|
||||
case 'current':
|
||||
$limit = $current * 0.90;
|
||||
$limit = $current * 0.80;
|
||||
break;
|
||||
case 'fanspeed':
|
||||
$limit = $current * 0.80;
|
||||
@@ -100,7 +120,7 @@ function sensor_limit ($class, $current) {
|
||||
$limit = $current * 1.05;
|
||||
break;
|
||||
case 'current':
|
||||
$limit = $current * 1.10;
|
||||
$limit = $current * 1.20;
|
||||
break;
|
||||
case 'fanspeed':
|
||||
$limit = $current * 1.30;
|
||||
|
@@ -9,9 +9,9 @@ $hrDevices = array();
|
||||
foreach ($hrDevice_oids as $oid) { $hrDevices = snmpwalk_cache_oid($device, $oid, $hrDevices, "HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES"); }
|
||||
if($debug) {print_r($hrDevices);}
|
||||
|
||||
if(is_array($hrDevices[$device['device_id']]))
|
||||
if(is_array($hrDevices))
|
||||
{
|
||||
$hrDevices = $hrDevices[$device['device_id']];
|
||||
$hrDevices = $hrDevices;
|
||||
foreach($hrDevices as $hrDevice)
|
||||
{
|
||||
if(is_array($hrDevice) && is_numeric($hrDevice['hrDeviceIndex']))
|
||||
|
@@ -12,8 +12,8 @@ if($device['os'] == "junose" && $config['enable_ports_junoseatmvp'])
|
||||
$valid_vp = array();
|
||||
if($debug) { print_r($vp_array); }
|
||||
|
||||
if(is_array($vp_array[$device['device_id']])) {
|
||||
foreach($vp_array[$device['device_id']] as $index => $entry) {
|
||||
if(is_array($vp_array)) {
|
||||
foreach($vp_array as $index => $entry) {
|
||||
|
||||
list($ifIndex,$vp_id)= explode('.', $index);
|
||||
|
||||
|
@@ -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");
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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'];
|
||||
|
@@ -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;
|
||||
|
@@ -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")
|
||||
{
|
||||
|
@@ -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']))
|
||||
{
|
||||
|
@@ -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")
|
||||
{
|
||||
|
@@ -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"))
|
||||
{
|
||||
|
@@ -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")
|
||||
{
|
||||
|
@@ -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'];
|
||||
|
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
global $valid_sensor;
|
||||
global $entity_temperature;
|
||||
|
||||
if (!isset($cisco_entity_temperature) && $device['os'] == "ios" || $device['os_group'] == "ios")
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = '".$device['device_id']."' AND `sensor_class` = 'temperature' AND (`sensor_type` = 'cisco-entity-sensor' OR `sensor_type` = 'entity-sensor')"),0) == "0" && ($device['os'] == "ios" || $device['os_group'] == "ios"))
|
||||
{
|
||||
echo("Cisco ");
|
||||
$oids = snmp_walk($device, ".1.3.6.1.4.1.9.9.13.1.3.1.2", "-Osqn", "CISCO-ENVMON-MIB");
|
||||
|
@@ -15,9 +15,9 @@ if ($device['os'] == "ftos" || $device['os_group'] == "ftos")
|
||||
|
||||
$oids = snmpwalk_cache_oid($device, "chSysCardTemp", array(), "F10-C-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 = "Slot ".$index;
|
||||
$oid = ".1.3.6.1.4.1.6027.3.8.1.2.1.1.5.".$index;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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")
|
||||
{
|
||||
|
@@ -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"),'"');
|
||||
|
@@ -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"); }
|
||||
|
@@ -124,10 +124,18 @@ function formatstorage($rate, $round = '2')
|
||||
|
||||
function format_si($rate)
|
||||
{
|
||||
if($rate >= "0.1") {
|
||||
$sizes = Array('', 'k', 'M', 'G', 'T', 'P', 'E');
|
||||
$round = Array('0','0','0','2','2','2','2','2','2');
|
||||
$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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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']; }
|
||||
|
@@ -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) {
|
||||
|
@@ -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) {
|
||||
|
||||
|
@@ -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: ");
|
||||
|
||||
|
@@ -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'];
|
||||
|
@@ -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'];
|
||||
|
@@ -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'];
|
||||
|
@@ -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'];
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if($port_stats[$device['device_id']][$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd"
|
||||
&& isset($port_stats[$device['device_id']][$port['ifIndex']]['dot3StatsIndex'])) { // Check to make sure Port data is cached.
|
||||
if($port_stats[$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd"
|
||||
&& isset($port_stats[$port['ifIndex']]['dot3StatsIndex'])) { // Check to make sure Port data is cached.
|
||||
|
||||
$this_port = &$port_stats[$device[device_id]][$port[ifIndex]];
|
||||
|
||||
|
@@ -12,11 +12,11 @@ $peth_oids = array('pethPsePortAdminEnable', 'pethPsePortPowerPairsControlAbilit
|
||||
$port_stats = snmpwalk_cache_oid($device, "pethPsePortEntry", $port_stats, "POWER-ETHERNET-MIB");
|
||||
$port_stats = snmpwalk_cache_oid($device, "cpeExtPsePortEntry", $port_stats, "CISCO-POWER-ETHERNET-EXT-MIB");
|
||||
|
||||
if($port_stats[$device['device_id']][$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd"
|
||||
&& isset($port_stats[$device['device_id']][$port['ifIndex']]['dot3StatsIndex']))
|
||||
if($port_stats[$port['ifIndex']] && $port['ifType'] == "ethernetCsmacd"
|
||||
&& isset($port_stats[$port['ifIndex']]['dot3StatsIndex']))
|
||||
{ // Check to make sure Port data is cached.
|
||||
|
||||
$this_port = &$port_stats[$device['device_id']][$port['ifIndex']];
|
||||
$this_port = &$port_stats[$port['ifIndex']];
|
||||
|
||||
$rrdfile = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("port-".$port['ifIndex']."-poe.rrd");
|
||||
|
||||
|
@@ -96,9 +96,9 @@
|
||||
while ($port = mysql_fetch_array($port_query)) {
|
||||
|
||||
echo("Port " . $port['ifDescr'] . " ");
|
||||
if($port_stats[$device['device_id']][$port['ifIndex']] && $port['ignore'] == "0") { // Check to make sure Port data is cached.
|
||||
if($port_stats[$port['ifIndex']] && $port['ignore'] == "0") { // Check to make sure Port data is cached.
|
||||
|
||||
$this_port = &$port_stats[$device['device_id']][$port['ifIndex']];
|
||||
$this_port = &$port_stats[$port['ifIndex']];
|
||||
|
||||
$polled_period = $polled - $port['poll_time'];
|
||||
|
||||
|
@@ -7,7 +7,7 @@ if(!is_array($storage_cache['hrstorage'])) {
|
||||
if ($debug) { print_r($storage_cache); }
|
||||
}
|
||||
|
||||
$entry = $storage_cache['hrstorage'][$device[device_id]][$storage[storage_index]];
|
||||
$entry = $storage_cache['hrstorage'][$storage[storage_index]];
|
||||
|
||||
$storage['units'] = $entry['hrStorageAllocationUnits'];
|
||||
$storage['used'] = $entry['hrStorageUsed'] * $storage['units'];
|
||||
|
@@ -10,8 +10,6 @@ if(mysql_affected_rows()) {
|
||||
$diskio_cache = array();
|
||||
$diskio_cache = snmpwalk_cache_oid($device, "diskIOEntry", $diskio_cache);
|
||||
|
||||
$diskio_cache = $diskio_cache[$device['device_id']];
|
||||
|
||||
echo("Checking UCD DiskIO MIB: ");
|
||||
|
||||
while($diskio = mysql_fetch_array($diskio_data)) {
|
||||
|
@@ -33,7 +33,6 @@
|
||||
#UCD-SNMP-MIB::ssRawSwapOut.0 = Counter32: 937422
|
||||
|
||||
$ss = snmpwalk_cache_oid($device, "systemStats", array());
|
||||
$ss = $ss[$device['device_id']][0];
|
||||
|
||||
## Create CPU RRD if it doesn't already exist
|
||||
$cpu_rrd_create = " --step 300 \
|
||||
|
@@ -113,7 +113,7 @@ function snmpwalk_cache_cip($device, $oid, $array, $mib = 0)
|
||||
$mac = "$h_a$h_b$h_c$h_d$h_e$h_f";
|
||||
if($dir == "1") { $dir = "input"; } elseif($dir == "2") { $dir = "output"; }
|
||||
if($mac && $dir) {
|
||||
$array[$device_id][$ifIndex][$mac][$oid][$dir] = $this_value;
|
||||
$array[$ifIndex][$mac][$oid][$dir] = $this_value;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
@@ -158,7 +158,7 @@ function snmpwalk_cache_oid($device, $oid, $array, $mib = NULL, $mibdir = NULL)
|
||||
$oid = trim($oid); $value = trim($value);
|
||||
list($oid, $index) = explode(".", $oid);
|
||||
if (!strstr($value, "at this OID") && isset($oid) && isset($index)) {
|
||||
$array[$device[device_id]][$index][$oid] = $value;
|
||||
$array[$index][$oid] = $value;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
@@ -179,7 +179,7 @@ function snmpwalk_cache_multi_oid($device, $oid, $array, $mib = NULL, $mibdir =
|
||||
if(isset($oid_parts['5'])) { $index .= ".".$oid_parts['5']; }
|
||||
if(isset($oid_parts['6'])) { $index .= ".".$oid_parts['6']; }
|
||||
if (!strstr($value, "at this OID") && isset($oid) && isset($index)) {
|
||||
$array[$device[device_id]][$index][$oid] = $value;
|
||||
$array[$index][$oid] = $value;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
@@ -195,7 +195,7 @@ function snmpwalk_cache_double_oid($device, $oid, $array, $mib = NULL, $mibdir =
|
||||
list($oid, $first, $second) = explode(".", $oid);
|
||||
if (!strstr($value, "at this OID") && isset($oid) && isset($first) && isset($second)) {
|
||||
$double = $first.".".$second;
|
||||
$array[$device[device_id]][$double][$oid] = $value;
|
||||
$array[$double][$oid] = $value;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
@@ -210,7 +210,7 @@ function snmpwalk_cache_triple_oid($device, $oid, $array, $mib = NULL, $mibdir =
|
||||
list($oid, $first, $second, $third) = explode(".", $oid);
|
||||
if (!strstr($value, "at this OID") && isset($oid) && isset($first) && isset($second)) {
|
||||
$index = $first.".".$second.".".$third;
|
||||
$array[$device[device_id]][$index][$oid] = $value;
|
||||
$array[$index][$oid] = $value;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
@@ -242,7 +242,7 @@ function snmpwalk_cache_twopart_oid($device, $oid, $array, $mib = 0)
|
||||
$oid = trim($oid); $value = trim($value); $value = str_replace("\"", "", $value);
|
||||
list($oid, $first, $second) = explode(".", $oid);
|
||||
if (!strstr($value, "at this OID") && isset($oid) && isset($first) && isset($second)) {
|
||||
$array[$device_id][$first][$second][$oid] = $value;
|
||||
$array[$first][$second][$oid] = $value;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
@@ -272,7 +272,7 @@ function snmpwalk_cache_threepart_oid($device, $oid, $array, $mib = 0) {
|
||||
list($oid, $first, $second, $third) = explode(".", $oid);
|
||||
if($debug) {echo("$entry || $oid || $first || $second || $third\n");}
|
||||
if (!strstr($value, "at this OID") && isset($oid) && isset($first) && isset($second) && isset($third)) {
|
||||
$array[$device_id][$first][$second][$third][$oid] = $value;
|
||||
$array[$first][$second][$third][$oid] = $value;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
@@ -300,10 +300,10 @@ function snmp_cache_slotport_oid($oid, $device, $array, $mib = 0) {
|
||||
$entry = str_replace($oid.".", "", $entry);
|
||||
list($slotport, $value) = explode("=", $entry);
|
||||
$slotport = trim($slotport); $value = trim($value);
|
||||
if ($array[$device_id][$slotport]['ifIndex']) {
|
||||
$ifIndex = $array[$device_id][$slotport]['ifIndex'];
|
||||
#$array[$device_id][$slotport][$oid] = $value;
|
||||
$array[$device_id][$ifIndex][$oid] = $value;
|
||||
if ($array[$slotport]['ifIndex']) {
|
||||
$ifIndex = $array[$slotport]['ifIndex'];
|
||||
#$array[$slotport][$oid] = $value;
|
||||
$array[$ifIndex][$oid] = $value;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
@@ -332,7 +332,7 @@ function snmp_cache_port_oids($oids, $port, $device, $array, $mib=0) {
|
||||
#echo("Caching: ifIndex $port\n");
|
||||
foreach($oids as $oid){
|
||||
if(!strstr($values[$x], "at this OID")) {
|
||||
$array[$device[device_id]][$port][$oid] = $values[$x];
|
||||
$array[$port][$oid] = $values[$x];
|
||||
}
|
||||
$x++;
|
||||
}
|
||||
@@ -351,8 +351,8 @@ function snmp_cache_portIfIndex ($device, $array) {
|
||||
$entry = str_replace("CISCO-STACK-MIB::portIfIndex.", "", $entry);
|
||||
list($slotport, $ifIndex) = explode(" ", $entry);
|
||||
if($slotport && $ifIndex){
|
||||
$array[$device_id][$ifIndex]['portIfIndex'] = $slotport;
|
||||
$array[$device_id][$slotport]['ifIndex'] = $ifIndex;
|
||||
$array[$ifIndex]['portIfIndex'] = $slotport;
|
||||
$array[$slotport]['ifIndex'] = $ifIndex;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
@@ -371,10 +371,10 @@ function snmp_cache_portName ($device, $array) {
|
||||
$entry = str_replace("portName.", "", $entry);
|
||||
list($slotport, $portName) = explode("=", $entry);
|
||||
$slotport = trim($slotport); $portName = trim($portName);
|
||||
if ($array[$device_id][$slotport]['ifIndex']) {
|
||||
$ifIndex = $array[$device_id][$slotport]['ifIndex'];
|
||||
$array[$device_id][$slotport]['portName'] = $portName;
|
||||
$array[$device_id][$ifIndex]['portName'] = $portName;
|
||||
if ($array[$slotport]['ifIndex']) {
|
||||
$ifIndex = $array[$slotport]['ifIndex'];
|
||||
$array[$slotport]['portName'] = $portName;
|
||||
$array[$ifIndex]['portName'] = $portName;
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
|
@@ -32,9 +32,9 @@ if($argv[1] == "--device" && $argv[2]) {
|
||||
}
|
||||
|
||||
if ($argv[2] == "--type" && $argv[3]) {
|
||||
$type = $argv[3];
|
||||
$discovery_type = $argv[3];
|
||||
} elseif ($argv[3] == "--type" && $argv[4]) {
|
||||
$type = $argv[4];
|
||||
$discovery_type = $argv[4];
|
||||
} else {
|
||||
echo("Require valid discovery type.\n");
|
||||
exit;
|
||||
@@ -42,7 +42,7 @@ if ($argv[2] == "--type" && $argv[3]) {
|
||||
|
||||
$devices_polled = 0;
|
||||
|
||||
echo("includes/discovery/".$type.".php \n");
|
||||
echo("includes/discovery/".$discovery_type.".php \n");
|
||||
|
||||
#$debug = 1;
|
||||
|
||||
@@ -53,7 +53,7 @@ while ($device = mysql_fetch_array($device_query)) {
|
||||
echo($device['hostname'] . "(".$device['sysName']."|".$device['device_id'].")\n");
|
||||
if($config['os'][$device['os']]['group']) {$device['os_group'] = $config['os'][$device['os']]['group']; echo "(".$device['os_group'].")";}
|
||||
|
||||
include("includes/discovery/".$type);
|
||||
include("includes/discovery/".$discovery_type);
|
||||
|
||||
echo("\n"); $devices_polled++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user