mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fix cisco entphysical sensors (need to do non-cisco too)
git-svn-id: http://www.observium.org/svn/observer/trunk@2345 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -18,12 +18,11 @@ function printEntPhysical($ent, $level, $class)
|
||||
{
|
||||
echo("<img src='images/16/contrast.png' style='vertical-align:middle'/> ");
|
||||
# FIXME /ciscosensors? doesn't exist anymore methinks? or does it?
|
||||
|
||||
$sensor = dbFetchRow("SELECT * FROM `sensors` WHERE `device_id` = ? AND `entPhysicalIndex` = ?", array($device['device_id'], $ent['entPhysicalIndex']));
|
||||
|
||||
print_r($sensor);
|
||||
|
||||
$link = " href='device/".$device['device_id']."/health/".$sensor['sensor_class']."/' onmouseover=\"return overlib('<img src=\'graph.php?id=".$sensor['sensor_id']."&type=sensor_".$sensor['sensor_class']."&from=-2d&to=now&width=400&height=150&a=".$ent['entPhysical_id']."\'><img src=\'graph.php?id=".$sensor['sensor_id']."&type=sensor_".$sensor['sensor_class']."&from=-2w&to=now&width=400&height=150&a=".$ent['entPhysical_id']."\'>', LEFT,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"";
|
||||
if(count($sensor))
|
||||
{
|
||||
$link = " href='device/".$device['device_id']."/health/".$sensor['sensor_class']."/' onmouseover=\"return overlib('<img src=\'graph.php?id=".$sensor['sensor_id']."&type=sensor_".$sensor['sensor_class']."&from=-2d&to=now&width=400&height=150&a=".$ent['entPhysical_id']."\'><img src=\'graph.php?id=".$sensor['sensor_id']."&type=sensor_".$sensor['sensor_class']."&from=-2w&to=now&width=400&height=150&a=".$ent['entPhysical_id']."\'>', LEFT,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"";
|
||||
}
|
||||
} else { unset ($link); }
|
||||
|
||||
if ($ent['entPhysicalClass'] == "backplane") { echo("<img src='images/16/brick.png' style='vertical-align:middle'/> "); }
|
||||
|
@ -138,7 +138,7 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
|
||||
|
||||
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, $entPhysicalIndex, $entry['entSensorMeasuredEntity']);
|
||||
discover_sensor($valid['sensor'], $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $limit, $warn_limit, $current, 'snmp', $entPhysicalIndex, $entry['entSensorMeasuredEntity']);
|
||||
}
|
||||
$cisco_entity_temperature = 1;
|
||||
unset($limit, $limit_low, $warn_limit, $warn_limit_low);
|
||||
|
@ -13,7 +13,8 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
|
||||
if (!$low_limit) { $low_limit = sensor_low_limit($class, $current); }
|
||||
|
||||
$insert = array('poller_type' => $poller_type, 'sensor_class' => $class, 'device_id' => $device['device_id'], 'sensor_oid' => $oid, 'sensor_index' => $index, 'sensor_type' => $type, 'sensor_descr' => $descr,
|
||||
'sensor_divisor' => $divisor, 'sensor_multiplier' => $multiplier, 'sensor_limit' => $high_limit, 'sensor_limit_warn' => $warn_limit, 'sensor_limit_low' => $low_limit, 'sensor_limit_low_warn' => $low_warn_limit, 'current' => $current);
|
||||
'sensor_divisor' => $divisor, 'sensor_multiplier' => $multiplier, 'sensor_limit' => $high_limit, 'sensor_limit_warn' => $warn_limit, 'sensor_limit_low' => $low_limit,
|
||||
'sensor_limit_low_warn' => $low_warn_limit, 'current' => $current, 'entPhysicalIndex' => $entPhysicalIndex, 'entPhysicalIndex_measured' => $entPhysicalIndex_measured );
|
||||
|
||||
$inserted = dbInsert($insert, 'sensors');
|
||||
|
||||
@ -39,7 +40,7 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
|
||||
{
|
||||
|
||||
$update = array('sensor_limit' => ($high_limit == NULL ? NULL : $high_limit));
|
||||
$updated = dbUpdate($update, '`sensor_id` = ?', array($sensor_entry['sensor_id']));
|
||||
$updated = dbUpdate($update, 'sensors', '`sensor_id` = ?', array($sensor_entry['sensor_id']));
|
||||
if ($debug) { echo("( $updated updated )\n"); }
|
||||
echo("H");
|
||||
log_event("Sensor High Limit Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr)." (".$high_limit.")", $device, 'sensor', $sensor_id);
|
||||
@ -58,7 +59,7 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
|
||||
if ($sensor_entry['sensor_limit_low'] != $low_limit)
|
||||
{
|
||||
$update = array('sensor_limit_low' => ($low_limit == NULL ? NULL : $low_limit));
|
||||
$updated = dbUpdate($update, '`sensor_id` = ?', array($sensor_entry['sensor_id']));
|
||||
$updated = dbUpdate($update, 'sensors', '`sensor_id` = ?', array($sensor_entry['sensor_id']));
|
||||
if ($debug) { echo("( $updated updated )\n"); }
|
||||
echo("L");
|
||||
log_event("Sensor Low Limit Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr)." (".$low_limit.")", $device, 'sensor', $sensor_id);
|
||||
@ -72,7 +73,7 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
|
||||
{
|
||||
$update = array('sensor_oid' => $oid, 'sensor_descr' => $descr, 'sensor_multiplier' => $multiplier, 'sensor_divisor' => $divisor,
|
||||
'entPhysicalIndex' => $entPhysicalIndex, 'entPhysicalIndex_measured' => $entPhysicalIndex_measured);
|
||||
$updated = dbUpdate($update, '`sensor_id` = ?', array($sensor_entry['sensor_id']));
|
||||
$updated = dbUpdate($update, 'sensors', '`sensor_id` = ?', array($sensor_entry['sensor_id']));
|
||||
echo("U");
|
||||
log_event("Sensor Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr), $device, 'sensor', $sensor_id);
|
||||
if ($debug) { echo("( $updated updated )\n"); }
|
||||
|
Reference in New Issue
Block a user