git-svn-id: http://www.observium.org/svn/observer/trunk@2344 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-05-17 22:10:23 +00:00
parent e3463a5323
commit 046833b67e
7 changed files with 23 additions and 19 deletions

View File

@@ -8,21 +8,20 @@ if (device_permitted($entry['device_id']))
echo("<tr style=\"background-color: $bg_colour\">
<td width=0></td>");
echo("<td class=syslog width=140>" . $entry['date'] . "</td>");
$entry['hostname'] = shorthost($entry['hostname'], 20);
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 class=syslog><strong>" . $entry['program'] . " : </strong> " . htmlspecialchars($entry['msg']) . "</td>");
} else {
echo("<td class=syslog><i>" . $entry['date'] . "</i>&nbsp;&nbsp;&nbsp;<strong>" . $entry['program'] . "</strong>&nbsp;&nbsp;&nbsp;" . htmlspecialchars($entry['msg']) . "</td>");
}
echo(" <td class=syslog>
<strong>" . $entry['program'] . " : </strong>
" . htmlspecialchars($entry['msg']) . "
</td>
<td></td>
</tr>");
echo("</tr>");
}

View File

@@ -18,7 +18,12 @@ 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?
$link = " href='device/".$device['device_id']."/ciscosensors/".$ent['entSensorType']."/' onmouseover=\"return overlib('<img src=\'graph.php?host=49&amp;type=cisco_entity_sensor&amp;from=-2d&amp;to=now&amp;width=400&amp;height=150&amp;a=".$ent['entPhysical_id']."\'><img src=\'graph.php?host=49&amp;type=cisco_entity_sensor&amp;from=-2w&amp;to=now&amp;width=400&amp;height=150&amp;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']."&amp;type=sensor_".$sensor['sensor_class']."&amp;from=-2d&amp;to=now&amp;width=400&amp;height=150&amp;a=".$ent['entPhysical_id']."\'><img src=\'graph.php?id=".$sensor['sensor_id']."&amp;type=sensor_".$sensor['sensor_class']."&amp;from=-2w&amp;to=now&amp;width=400&amp;height=150&amp;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'/> "); }

View File

@@ -60,7 +60,7 @@ if ($services['total'])
### 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))
{
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");

View File

@@ -43,7 +43,7 @@ if ($_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";
echo("<table cellspacing=0 cellpadding=2 width=100%>");
foreach (dbFetchRows($sql, $param) as $entry) { include("includes/print-syslog.inc.php"); }

View File

@@ -67,14 +67,14 @@ if (is_numeric($_POST['device']))
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))
{
$sql .= " WHERE 1 ".$where;
}
$sql .= " ORDER BY timestamp DESC LIMIT 1000";
} 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 = ?";
if(count($array))
{

View File

@@ -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);
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;
unset($limit, $limit_low, $warn_limit, $warn_limit_low);

View File

@@ -1,11 +1,11 @@
<?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, $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;
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')
{
@@ -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);
}
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(".");
}
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']));
echo("U");
log_event("Sensor Updated: ".mres($class)." ".mres($type)." ". mres($index)." ".mres($descr), $device, 'sensor', $sensor_id);