mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
updates
git-svn-id: http://www.observium.org/svn/observer/trunk@2344 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -8,21 +8,20 @@ if (device_permitted($entry['device_id']))
|
|||||||
echo("<tr style=\"background-color: $bg_colour\">
|
echo("<tr style=\"background-color: $bg_colour\">
|
||||||
<td width=0></td>");
|
<td width=0></td>");
|
||||||
|
|
||||||
echo("<td class=syslog width=140>" . $entry['date'] . "</td>");
|
|
||||||
|
|
||||||
$entry['hostname'] = shorthost($entry['hostname'], 20);
|
$entry['hostname'] = shorthost($entry['hostname'], 20);
|
||||||
|
|
||||||
if ($_GET['page'] != "device")
|
if ($_GET['page'] != "device")
|
||||||
{
|
{
|
||||||
|
echo("<td class=syslog width=140>" . $entry['date'] . "</td>");
|
||||||
echo("<td width=160><strong>".generate_device_link($entry)."</strong></td>");
|
echo("<td width=160><strong>".generate_device_link($entry)."</strong></td>");
|
||||||
|
echo("<td class=syslog><strong>" . $entry['program'] . " : </strong> " . htmlspecialchars($entry['msg']) . "</td>");
|
||||||
|
} else {
|
||||||
|
echo("<td class=syslog><i>" . $entry['date'] . "</i> <strong>" . $entry['program'] . "</strong> " . htmlspecialchars($entry['msg']) . "</td>");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo(" <td class=syslog>
|
echo("</tr>");
|
||||||
<strong>" . $entry['program'] . " : </strong>
|
|
||||||
" . htmlspecialchars($entry['msg']) . "
|
|
||||||
</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,7 +18,12 @@ function printEntPhysical($ent, $level, $class)
|
|||||||
{
|
{
|
||||||
echo("<img src='images/16/contrast.png' style='vertical-align:middle'/> ");
|
echo("<img src='images/16/contrast.png' style='vertical-align:middle'/> ");
|
||||||
# FIXME /ciscosensors? doesn't exist anymore methinks? or does it?
|
# FIXME /ciscosensors? doesn't exist anymore methinks? or does it?
|
||||||
$link = " href='device/".$device['device_id']."/ciscosensors/".$ent['entSensorType']."/' onmouseover=\"return overlib('<img src=\'graph.php?host=49&type=cisco_entity_sensor&from=-2d&to=now&width=400&height=150&a=".$ent['entPhysical_id']."\'><img src=\'graph.php?host=49&type=cisco_entity_sensor&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();\"";
|
|
||||||
|
$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();\"";
|
||||||
} else { unset ($link); }
|
} else { unset ($link); }
|
||||||
|
|
||||||
if ($ent['entPhysicalClass'] == "backplane") { echo("<img src='images/16/brick.png' style='vertical-align:middle'/> "); }
|
if ($ent['entPhysicalClass'] == "backplane") { echo("<img src='images/16/brick.png' style='vertical-align:middle'/> "); }
|
||||||
|
@@ -60,7 +60,7 @@ if ($services['total'])
|
|||||||
|
|
||||||
|
|
||||||
### FIXME - split this into overview/syslog.inc.php?
|
### FIXME - split this into overview/syslog.inc.php?
|
||||||
$syslog = dbFetchRows("SELECT *, DATE_FORMAT(timestamp, '%d/%b/%y %T') AS date from syslog WHERE device_id = ? ORDER BY timestamp DESC LIMIT 20", array($device['device_id']));
|
$syslog = dbFetchRows("SELECT *, DATE_FORMAT(timestamp, '%Y-%m-%d %T') AS date from syslog WHERE device_id = ? ORDER BY timestamp DESC LIMIT 20", array($device['device_id']));
|
||||||
if (is_array($syslog))
|
if (is_array($syslog))
|
||||||
{
|
{
|
||||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||||
|
@@ -43,7 +43,7 @@ if ($_POST['program'])
|
|||||||
$param[] = $_POST['program'];
|
$param[] = $_POST['program'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog WHERE device_id = ? $where";
|
$sql = "SELECT *, DATE_FORMAT(timestamp, '%Y-%m-%d %T') AS date from syslog WHERE device_id = ? $where";
|
||||||
$sql .= " ORDER BY timestamp DESC LIMIT 1000";
|
$sql .= " ORDER BY timestamp DESC LIMIT 1000";
|
||||||
echo("<table cellspacing=0 cellpadding=2 width=100%>");
|
echo("<table cellspacing=0 cellpadding=2 width=100%>");
|
||||||
foreach (dbFetchRows($sql, $param) as $entry) { include("includes/print-syslog.inc.php"); }
|
foreach (dbFetchRows($sql, $param) as $entry) { include("includes/print-syslog.inc.php"); }
|
||||||
|
@@ -67,14 +67,14 @@ if (is_numeric($_POST['device']))
|
|||||||
|
|
||||||
if ($_SESSION['userlevel'] >= '5')
|
if ($_SESSION['userlevel'] >= '5')
|
||||||
{
|
{
|
||||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog AS S";
|
$sql = "SELECT *, DATE_FORMAT(timestamp, '%Y-%m-%d %T') AS date from syslog AS S";
|
||||||
if(count($array))
|
if(count($array))
|
||||||
{
|
{
|
||||||
$sql .= " WHERE 1 ".$where;
|
$sql .= " WHERE 1 ".$where;
|
||||||
}
|
}
|
||||||
$sql .= " ORDER BY timestamp DESC LIMIT 1000";
|
$sql .= " ORDER BY timestamp DESC LIMIT 1000";
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog AS S, devices_perms AS P";
|
$sql = "SELECT *, DATE_FORMAT(timestamp, '%Y-%m-%d %T') AS date from syslog AS S, devices_perms AS P";
|
||||||
$sql .= "WHERE S.device_id = P.device_id AND P.user_id = ?";
|
$sql .= "WHERE S.device_id = P.device_id AND P.user_id = ?";
|
||||||
if(count($array))
|
if(count($array))
|
||||||
{
|
{
|
||||||
|
@@ -138,7 +138,7 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios")
|
|||||||
|
|
||||||
if ($ok) {
|
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");
|
# 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);
|
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']);
|
||||||
}
|
}
|
||||||
$cisco_entity_temperature = 1;
|
$cisco_entity_temperature = 1;
|
||||||
unset($limit, $limit_low, $warn_limit, $warn_limit_low);
|
unset($limit, $limit_low, $warn_limit, $warn_limit_low);
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
### Discover sensors
|
### 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, $poller_type = 'snmp')
|
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, $poller_type = 'snmp', $entPhysicalIndex = NULL, $entPhysicalIndex_measured = NULL)
|
||||||
{
|
{
|
||||||
global $config, $debug;
|
global $config, $debug;
|
||||||
|
|
||||||
if ($debug) { echo("Discover sensor: $oid, $index, $type, $descr, $precision\n"); }
|
if ($debug) { echo("Discover sensor: $oid, $index, $type, $descr, $precision, $entPhysicalIndex\n"); }
|
||||||
|
|
||||||
if (dbFetchCell("SELECT COUNT(sensor_id) FROM `sensors` WHERE `poller_type`= ? AND `sensor_class` = ? AND `device_id` = ? AND sensor_type = ? AND `sensor_index` = ?", array($poller_type, $class, $device['device_id'], $type, $index)) == '0')
|
if (dbFetchCell("SELECT COUNT(sensor_id) FROM `sensors` WHERE `poller_type`= ? AND `sensor_class` = ? AND `device_id` = ? AND sensor_type = ? AND `sensor_index` = ?", array($poller_type, $class, $device['device_id'], $type, $index)) == '0')
|
||||||
{
|
{
|
||||||
@@ -64,14 +64,14 @@ function discover_sensor(&$valid, $class, $device, $oid, $index, $type, $descr,
|
|||||||
log_event("Sensor Low Limit Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr)." (".$low_limit.")", $device, 'sensor', $sensor_id);
|
log_event("Sensor Low Limit Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr)." (".$low_limit.")", $device, 'sensor', $sensor_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oid == $sensor_entry['sensor_oid'] && $descr == $sensor_entry['sensor_descr'] && $multiplier == $sensor_entry['sensor_multiplier'] && $divisor == $sensor_entry['sensor_divisor'])
|
if ($oid == $sensor_entry['sensor_oid'] && $descr == $sensor_entry['sensor_descr'] && $multiplier == $sensor_entry['sensor_multiplier'] && $divisor == $sensor_entry['sensor_divisor'] && $entPhysicalIndex_measured == $sensor_entry['entPhysicalIndex_measured'] && $entPhysicalIndex == $sensor_entry['entPhysicalIndex'])
|
||||||
{
|
{
|
||||||
echo(".");
|
echo(".");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$update = array('sensor_oid' => $oid, 'sensor_descr' => $descr, 'sensor_multiplier' => $multiplier, 'sensor_divisor' => $divisor,
|
||||||
$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, '`sensor_id` = ?', array($sensor_entry['sensor_id']));
|
||||||
echo("U");
|
echo("U");
|
||||||
log_event("Sensor Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr), $device, 'sensor', $sensor_id);
|
log_event("Sensor Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr), $device, 'sensor', $sensor_id);
|
||||||
|
Reference in New Issue
Block a user