more code cleanup

git-svn-id: http://www.observium.org/svn/observer/trunk@2517 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-09-20 14:22:34 +00:00
parent d864ce234f
commit dc0ebc7343
34 changed files with 775 additions and 763 deletions
+3 -3
View File
@@ -31,12 +31,12 @@ if (is_array($cefs))
echo(" | |-".$path.": ".$path_name['cefSwitchingPath']."\n");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `cef` WHERE `device_id` = '".$device['device_id']."' AND `entPhysicalIndex` = '".$entity."'
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `cef` WHERE `device_id` = '".$device['device_id']."' AND `entPhysicalIndex` = '".$entity."'
AND `afi` = '".$afi."' AND `cef_index` = '".$path."'"),0) != "1")
{
$sql = "INSERT INTO `cef` (`device_id`, `entPhysicalIndex`, `afi`, `cef_index`, `cef_path`)
$sql = "INSERT INTO `cef` (`device_id`, `entPhysicalIndex`, `afi`, `cef_index`, `cef_path`)
VALUES ('".$device['device_id']."', '".$entity."', '".$afi."', '".$path."', '".$path_name['cefSwitchingPath']."')";
mysql_query($sql);
mysql_query($sql);
echo("+");
}
@@ -77,7 +77,7 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
}
### Bit dirty also, clean later
$descr = str_replace("Temp: ", "", $descr);
$descr = str_replace("Temp: ", "", $descr);
$descr = str_ireplace("temperature ", "", $descr);
$oid = ".1.3.6.1.4.1.9.9.91.1.1.1.1.4.".$index;
@@ -132,9 +132,9 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
$ok = TRUE;
if ($current == "-127") { $ok = FALSE; } ## False reading
# if ($type == "temperature" && $current < 1) { $ok = FALSE; } ## False reading. Temperature <1 :)
if ($descr == "") { $ok = FALSE; } ## Invalid description. Lots of these on Nexus
if ($current == "-127") { $ok = FALSE; } ## False reading
# if ($type == "temperature" && $current < 1) { $ok = FALSE; } ## False reading. Temperature <1 :)
if ($descr == "") { $ok = FALSE; } ## Invalid description. Lots of these on Nexus
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");
+11 -11
View File
@@ -21,19 +21,19 @@ if ($config['enable_pseudowires'] && $device['os_group'] == "ios")
if ($cpwOid)
{
list($cpw_remote_id) = explode(":", shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MPLS-MIB -Ln -Osqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcMplsPeerLdpID." . $cpwOid));
$interface_descr = trim(shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MIB -Oqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcName." . $cpwOid));
$cpw_remote_device = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = '".$cpw_remote_id."' AND A.interface_id = I.interface_id"),0);
$if_id = @mysql_result(mysql_query("SELECT `interface_id` FROM `ports` WHERE `ifDescr` = '$interface_descr' AND `device_id` = '".$device['device_id']."'"),0);
list($cpw_remote_id) = explode(":", shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MPLS-MIB -Ln -Osqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcMplsPeerLdpID." . $cpwOid));
$interface_descr = trim(shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MIB -Oqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcName." . $cpwOid));
$cpw_remote_device = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = '".$cpw_remote_id."' AND A.interface_id = I.interface_id"),0);
$if_id = @mysql_result(mysql_query("SELECT `interface_id` FROM `ports` WHERE `ifDescr` = '$interface_descr' AND `device_id` = '".$device['device_id']."'"),0);
if ($cpw_remote_device && $if_id)
{
$hostname = gethostbyid($cpw_remote_device);
if ($cpw_remote_device && $if_id)
{
$hostname = gethostbyid($cpw_remote_device);
#echo("\nOid: " . $cpwOid . " cpwVcID: " . $cpwVcID . " Remote Id: " . $cpw_remote_id . "($hostname(".$cpw_remote_device.") -> $interface_descr($if_id))");
if (mysql_result(mysql_query("SELECT count(*) FROM pseudowires WHERE `interface_id` = '$if_id'
AND `cpwVcID`='".$cpwVcID."'"),0))
if (mysql_result(mysql_query("SELECT count(*) FROM pseudowires WHERE `interface_id` = '$if_id'
AND `cpwVcID`='".$cpwVcID."'"),0))
{
echo(".");
echo(".");
}
else
{
@@ -44,7 +44,7 @@ if ($config['enable_pseudowires'] && $device['os_group'] == "ios")
#echo($device['device_id'] . " $cpwOid $cpw_remote_device $if_id $cpwVcID\n");
}
$cpw_exists[] = $device['device_id'] . " $cpwOid $cpw_remote_device $if_id $cpwVcID";
}
}
}
}
}
+21 -21
View File
@@ -21,17 +21,17 @@ if ($device['os'] == "apc")
$split_oid = explode('.',$oid);
$index = $split_oid[count($split_oid)-1];
$current_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index; #rPDULoadStatusLoad
$phase_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.4.".$index; #rPDULoadStatusPhaseNumber
$limit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.4.".$index; #rPDULoadPhaseConfigOverloadThreshold
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.2.".$index; #rPDULoadPhaseConfigLowLoadThreshold
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.3.".$index; #rPDULoadPhaseConfigNearOverloadThreshold
$current_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index; #rPDULoadStatusLoad
$phase_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.4.".$index; #rPDULoadStatusPhaseNumber
$limit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.4.".$index; #rPDULoadPhaseConfigOverloadThreshold
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.2.".$index; #rPDULoadPhaseConfigLowLoadThreshold
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.3.".$index; #rPDULoadPhaseConfigNearOverloadThreshold
$phase = snmp_get($device, $phase_oid, "-Oqv", "");
$current = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
$limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
if (count(explode("\n",$oids)) != 1)
{
$descr = "Phase $phase";
@@ -48,7 +48,7 @@ if ($device['os'] == "apc")
unset($oids);
#v2 firmware- first bank is total, v3 firmware, 3rd bank is total
$oids = snmp_walk($device, "rPDULoadBankConfigIndex", "-OsqnU", "PowerNet-MIB"); # should work with firmware v2 and v3
$oids = snmp_walk($device, "rPDULoadBankConfigIndex", "-OsqnU", "PowerNet-MIB"); # should work with firmware v2 and v3
if ($oids)
{
echo("APC PowerNet-MIB Banks ");
@@ -83,11 +83,11 @@ if ($device['os'] == "apc")
if ($index == "1") { $descr = "Bank Total"; }
}
$current_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index; #rPDULoadStatusLoad
$bank_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.5.".$index; #rPDULoadStatusBankNumber
$limit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.4.".$index; #rPDULoadBankConfigOverloadThreshold
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.2.".$index; #rPDULoadBankConfigLowLoadThreshold
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.3.".$index; #rPDULoadBankConfigNearOverloadThreshold
$current_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index; #rPDULoadStatusLoad
$bank_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.5.".$index; #rPDULoadStatusBankNumber
$limit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.4.".$index; #rPDULoadBankConfigOverloadThreshold
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.2.".$index; #rPDULoadBankConfigLowLoadThreshold
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.3.".$index; #rPDULoadBankConfigNearOverloadThreshold
$bank = snmp_get($device, $bank_oid, "-Oqv", "");
$current = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
@@ -112,16 +112,16 @@ if ($device['os'] == "apc")
if ($debug) { print_r($oids); }
$oids = trim($oids);
if ($oids) echo("APC PowerNet-MIB ATS ");
$current_oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1"; #atsOutputCurrent
$limit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1"; #atsConfigPhaseOverLoadThreshold
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1"; #atsConfigPhaseLowLoadThreshold
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1"; #atsConfigPhaseNearOverLoadThreshold
$current_oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1"; #atsOutputCurrent
$limit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1"; #atsConfigPhaseOverLoadThreshold
$lowlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1"; #atsConfigPhaseLowLoadThreshold
$warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1"; #atsConfigPhaseNearOverLoadThreshold
$index = 1;
$current = snmp_get($device, $current_oid, "-Oqv", "") / $precision;
$limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC!
$descr = "Output Feed";
discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current);
+2 -2
View File
@@ -11,7 +11,7 @@ if ($device['os'] == 'sentry3')
# These PDUs may have > 1 "tower" accessible via a single management interface
$tower_count = snmp_get($device,"systemTowerCount.0", "-Ovq", "Sentry3-MIB");
$towers=1;
while($towers <= $tower_count) {
while ($towers <= $tower_count) {
#################################
# Check for Infeeds
@@ -107,7 +107,7 @@ if ($device['os'] == 'sentry3')
$towers++;
} // while($towers <= $tower_count)
} // while ($towers <= $tower_count)
unset($towers);
}
+22 -22
View File
@@ -19,21 +19,21 @@ if ($device['os'] == "ironware")
$fdp_if_array = $fdp_array[$key];
foreach (array_keys($fdp_if_array) as $entry_key)
{
$fdp = $fdp_if_array[$entry_key];
$remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$fdp['snFdpCacheDeviceId']."' OR `hostname`='".$fdp['snFdpCacheDeviceId']."'"), 0);
$fdp = $fdp_if_array[$entry_key];
$remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$fdp['snFdpCacheDeviceId']."' OR `hostname`='".$fdp['snFdpCacheDeviceId']."'"), 0);
if(!$remote_device_id)
if (!$remote_device_id)
{
$remote_device_id = discover_new_device($fdp['snFdpCacheDeviceId']);
}
if ($remote_device_id)
{
$if = $fdp['snFdpCacheDevicePort'];
$remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0);
} else { $remote_interface_id = "0"; }
if ($remote_device_id)
{
$if = $fdp['snFdpCacheDevicePort'];
$remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0);
} else { $remote_interface_id = "0"; }
discover_link($interface['interface_id'], $fdp['snFdpCacheVendorId'], $remote_interface_id, $fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDevicePort'], $fdp['snFdpCachePlatform'], $fdp['snFdpCacheVersion']);
discover_link($interface['interface_id'], $fdp['snFdpCacheVendorId'], $remote_interface_id, $fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDevicePort'], $fdp['snFdpCachePlatform'], $fdp['snFdpCacheVersion']);
}
}
}
@@ -54,7 +54,7 @@ if ($cdp_array)
$cdp = $cdp_if_array[$entry_key];
$remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$cdp['cdpCacheDeviceId']."' OR `hostname`='".$cdp['cdpCacheDeviceId']."'"), 0);
if(!$remote_device_id)
if (!$remote_device_id)
{
$remote_device_id = discover_new_device($cdp['cdpCacheDeviceId']);
}
@@ -98,26 +98,26 @@ if ($lldp_array)
$lldp_instance = $lldp_if_array[$entry_key];
foreach (array_keys($lldp_instance) as $entry_instance)
{
$lldp = $lldp_instance[$entry_instance];
$remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$lldp['lldpRemSysName']."' OR `hostname`='".$lldp['lldpRemSysName']."'"), 0);
$lldp = $lldp_instance[$entry_instance];
$remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$lldp['lldpRemSysName']."' OR `hostname`='".$lldp['lldpRemSysName']."'"), 0);
if(!$remote_device_id)
if (!$remote_device_id)
{
$remote_device_id = discover_new_device($lldp['lldpRemSysName']);
}
if ($remote_device_id)
{
$if = $lldp['lldpRemPortDesc']; $id = $lldp['lldpRemPortId'];
$remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if' OR `ifDescr`= '$id' OR `ifName`='$id') AND `device_id` = '".$remote_device_id."'"),0);
} else {
if ($remote_device_id)
{
$if = $lldp['lldpRemPortDesc']; $id = $lldp['lldpRemPortId'];
$remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if' OR `ifDescr`= '$id' OR `ifName`='$id') AND `device_id` = '".$remote_device_id."'"),0);
} else {
$remote_interface_id = "0";
}
if (is_numeric($interface['interface_id']) && isset($lldp['lldpRemSysName']) && isset($lldp['lldpRemPortId']))
{
discover_link($interface['interface_id'], 'lldp', $remote_interface_id, $lldp['lldpRemSysName'], $lldp['lldpRemPortId'], NULL, $lldp['lldpRemSysDesc']);
}
if (is_numeric($interface['interface_id']) && isset($lldp['lldpRemSysName']) && isset($lldp['lldpRemPortId']))
{
discover_link($interface['interface_id'], 'lldp', $remote_interface_id, $lldp['lldpRemSysName'], $lldp['lldpRemPortId'], NULL, $lldp['lldpRemSysDesc']);
}
}
}
}
+14 -14
View File
@@ -15,20 +15,20 @@
foreach ($entity_array as $entPhysicalIndex => $entry) {
$entPhysicalDescr = $entry['entPhysicalDescr'];
$entPhysicalContainedIn = $entry['entPhysicalContainedIn'];
$entPhysicalClass = $entry['entPhysicalClass'];
$entPhysicalName = $entry['entPhysicalName'];
$entPhysicalSerialNum = $entry['entPhysicalSerialNum'];
$entPhysicalModelName = $entry['entPhysicalModelName'];
$entPhysicalMfgName = $entry['entPhysicalMfgName'];
$entPhysicalVendorType = $entry['entPhysicalVendorType'];
$entPhysicalParentRelPos = $entry['entPhysicalParentRelPos'];
$entPhysicalHardwareRev = $entry['entPhysicalHardwareRev'];
$entPhysicalFirmwareRev = $entry['entPhysicalFirmwareRev'];
$entPhysicalSoftwareRev = $entry['entPhysicalSoftwareRev'];
$entPhysicalIsFRU = $entry['entPhysicalIsFRU'];
$entPhysicalAlias = $entry['entPhysicalAlias'];
$entPhysicalDescr = $entry['entPhysicalDescr'];
$entPhysicalContainedIn = $entry['entPhysicalContainedIn'];
$entPhysicalClass = $entry['entPhysicalClass'];
$entPhysicalName = $entry['entPhysicalName'];
$entPhysicalSerialNum = $entry['entPhysicalSerialNum'];
$entPhysicalModelName = $entry['entPhysicalModelName'];
$entPhysicalMfgName = $entry['entPhysicalMfgName'];
$entPhysicalVendorType = $entry['entPhysicalVendorType'];
$entPhysicalParentRelPos = $entry['entPhysicalParentRelPos'];
$entPhysicalHardwareRev = $entry['entPhysicalHardwareRev'];
$entPhysicalFirmwareRev = $entry['entPhysicalFirmwareRev'];
$entPhysicalSoftwareRev = $entry['entPhysicalSoftwareRev'];
$entPhysicalIsFRU = $entry['entPhysicalIsFRU'];
$entPhysicalAlias = $entry['entPhysicalAlias'];
$entPhysicalAssetID = $entry['entPhysicalAssetID'];
if (isset($entity_array['$entPhysicalIndex']['0']['entAliasMappingIdentifier'])) { $ifIndex = $entity_array['$entPhysicalIndex']['0']['entAliasMappingIdentifier']; }
+5 -5
View File
@@ -15,7 +15,7 @@ function discover_new_device($hostname)
{
global $config;
if($config['autodiscovery']['xdp']) {
if ($config['autodiscovery']['xdp']) {
if ( isDomainResolves($hostname . "." . $config['mydomain']) ) {
$dst_host = $hostname . "." . $config['mydomain'];
} else {
@@ -26,7 +26,7 @@ function discover_new_device($hostname)
if ( match_network($config['nets'], $ip) )
{
$remote_device_id = addHost ($dst_host, NULL, "v2c");
if($remote_device_id) {
if ($remote_device_id) {
$remote_device = device_by_id_cache($remote_device_id, 1);
echo("+[".$remote_device['hostname']."(".$remote_device['device_id'].")]");
discover_device($remote_device);
@@ -51,10 +51,10 @@ function discover_device($device, $options = NULL)
echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." ");
if($device['os'] == 'generic') // verify if OS has changed from generic
if ($device['os'] == 'generic') // verify if OS has changed from generic
{
$device['os']= getHostOS($device);
if($device['os'] != 'generic')
if ($device['os'] != 'generic')
{
echo "Device os was updated to".$device['os']."!";
dbUpdate(array('os' => $device['os']), 'devices', '`device_id` = ?', array($device['device_id']));
@@ -343,7 +343,7 @@ function discover_storage(&$valid, $device, $index, $type, $mib, $descr, $size,
else
{
$updated = dbUpdate(array('storage_descr' => $descr, 'storage_type' => $type, 'storage_units' => $units, 'storage_size' => $size), 'storage', '`device_id` = ? AND `storage_index` = ? AND `storage_mib` = ?', array($device['device_id'], $index, $mib));
if($updated) { echo("U"); } else { echo("."); }
if ($updated) { echo("U"); } else { echo("."); }
}
$valid[$mib][$index] = 1;
}
+2 -2
View File
@@ -7,12 +7,12 @@ if (!$os)
## Specific Linux-derivatives
if($os == "linux") {
if ($os == "linux") {
## Check for QNAP Systems TurboNAS
$entPhysicalMfgName = snmp_get($device, "ENTITY-MIB::entPhysicalMfgName.1", "-Osqnv");
if(strpos($entPhysicalMfgName, "QNAP") !== FALSE) { $os = "qnap";}
if (strpos($entPhysicalMfgName, "QNAP") !== FALSE) { $os = "qnap";}
elseif(strstr($sysObjectId, ".1.3.6.1.4.1.5528.100.20.10.2014")) { $os = "netbotz"; }
}
+5 -5
View File
@@ -4,7 +4,7 @@ echo("Port Stack: ");
$sql = "SELECT * FROM `ports_stack` WHERE `device_id` = '".$device['device_id']."'";
$query = mysql_query($sql);
while($entry = mysql_fetch_assoc($query))
while ($entry = mysql_fetch_assoc($query))
{
$stack_db_array[$entry['interface_id_high']][$entry['interface_id_low']]['ifStackStatus'] = $entry['ifStackStatus'];
}
@@ -16,21 +16,21 @@ foreach($stack_poll_array as $interface_id_high => $entry_high)
foreach($entry_high as $interface_id_low => $entry_low)
{
$ifStackStatus = $entry_low['ifStackStatus'];
if(isset($stack_db_array[$interface_id_high][$interface_id_low]))
if (isset($stack_db_array[$interface_id_high][$interface_id_low]))
{
if($stack_db_array[$interface_id_high][$interface_id_low]['ifStackStatus'] == $ifStackStatus)
if ($stack_db_array[$interface_id_high][$interface_id_low]['ifStackStatus'] == $ifStackStatus)
{
echo(".");
} else {
mysql_query("UPDATE `ports_stack` SET `ifStackStatus` = '".$ifStackStatus."' WHERE `device_id` = '".$device['device_id']."' AND `interface_id_high` = '".$interface_id_high."' AND `interface_id_low` = '".$interface_id_low."'");
echo("U");
if($debug) { echo(mysql_error()); }
if ($debug) { echo(mysql_error()); }
}
unset($stack_db_array[$interface_id_high][$interface_id_low]);
} else {
mysql_query("INSERT INTO `ports_stack` (`device_id`,`interface_id_high`,`interface_id_low`,`ifStackStatus`) VALUES ('".$device['device_id']."','".$interface_id_high."','".$interface_id_low."','".$ifStackStatus."')");
echo("+");
if($debug) { echo(mysql_error()); }
if ($debug) { echo(mysql_error()); }
}
}
}
@@ -37,7 +37,7 @@ if (is_array($hrDevice_array))
echo("Moved RRD ");
}
if($device['os'] == "arista-eos" && $index == "1") { unset($descr); }
if ($device['os'] == "arista-eos" && $index == "1") { unset($descr); }
if (isset($descr) && $descr != "An electronic chip that makes the computer work.")
{
+7 -7
View File
@@ -14,11 +14,11 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
if (isset($entry['cpmCPUTotal5minRev']))
{
$usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.8." . $index;
$usage = $entry['cpmCPUTotal5minRev'];
$usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.8." . $index;
$usage = $entry['cpmCPUTotal5minRev'];
} elseif (isset($entry['cpmCPUTotal5min'])) {
$usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.5." . $index;
$usage = $entry['cpmCPUTotal5min'];
$usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.5." . $index;
$usage = $entry['cpmCPUTotal5min'];
}
if ($entPhysicalIndex) {
@@ -32,16 +32,16 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
if (is_file($old_rrd))
{
rename($old_rrd,$new_rrd);
rename($old_rrd,$new_rrd);
if ($debug) { echo("$old_rrd $new_rrd"); }
echo("Moved RRD ");
echo("Moved RRD ");
}
#echo("|".$descr."|");
if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "")
{
discover_processor($valid['processor'], $device, $usage_oid, $index, "cpm", $descr, "1", $entry['juniSystemModuleCpuUtilPct'], $entPhysicalIndex, NULL);
discover_processor($valid['processor'], $device, $usage_oid, $index, "cpm", $descr, "1", $entry['juniSystemModuleCpuUtilPct'], $entPhysicalIndex, NULL);
}
}
}
@@ -15,7 +15,7 @@ if ($device['os'] == "ironware" || $device['os_group'] == "ironware")
{
$usage_oid = ".1.3.6.1.4.1.1991.1.1.2.11.1.1.6." . $index;
$usage = $entry['snAgentCpuUtil100thPercent'];
$precision = 100;
$precision = 100;
} elseif ($entry['snAgentCpuUtilValue']) {
$usage_oid = ".1.3.6.1.4.1.1991.1.1.2.11.1.1.4." . $index;
$usage = $entry['snAgentCpuUtilValue'];
@@ -3,15 +3,15 @@
if ($device['os'] == "cometsystem-p85xx")
{
$regexp = '/
\.1\.3\.6\.1\.4\.1\.22626\.1\.5\.2\.
(?P<id>\d+)
\.
(?:
1\.0 (?P<name>.*)|
3\.0 (?P<temp_intval>.*)|
5\.0 (?P<limit_high>.*)|
6\.0 (?P<limit_low>.*)|
)
\.1\.3\.6\.1\.4\.1\.22626\.1\.5\.2\.
(?P<id>\d+)
\.
(?:
1\.0 (?P<name>.*)|
3\.0 (?P<temp_intval>.*)|
5\.0 (?P<limit_high>.*)|
6\.0 (?P<limit_low>.*)|
)
/x';
$oids = snmp_walk($device, ".1.3.6.1.4.1.22626.1.5.2", "-OsqnU", "");
@@ -30,7 +30,7 @@ if ($device['os'] == "linux")
$descr = snmp_get($device, $descr_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
$current = snmp_get($device, $volt_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $divisor;
$limit = snmp_get($device, $limit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $divisor;
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $divisor;
$lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $divisor;
$monitor = snmp_get($device, $monitor_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB");
$descr = trim(str_ireplace("Voltage", "", $descr));