Syslog Fixes

git-svn-id: http://www.observium.org/svn/observer/trunk@175 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2008-03-22 13:30:33 +00:00
parent 387c6be30a
commit df9a8c604a
4 changed files with 6 additions and 9 deletions

View File

@ -75,7 +75,7 @@
} }
echo("</td>"); echo("</td>");
echo("<td valign=top class=interface-desc>"); echo("<td width=375 valign=top class=interface-desc>");
if ( strpos($ifDescr, "oopback") === false && !$dographs) { if ( strpos($ifDescr, "oopback") === false && !$dographs) {
$link_query = mysql_query("select * from links AS L, interfaces AS I, devices AS D WHERE L.src_if = '$if_id' AND L.dst_if = I.interface_id AND I.device_id = D.device_id"); $link_query = mysql_query("select * from links AS L, interfaces AS I, devices AS D WHERE L.src_if = '$if_id' AND L.dst_if = I.interface_id AND I.device_id = D.device_id");
while($link = mysql_fetch_array($link_query)) { while($link = mysql_fetch_array($link_query)) {

View File

@ -17,10 +17,10 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
echo("<tr style=\"background-color: $bg\"> echo("<tr style=\"background-color: $bg\">
<td width=0></td>"); <td width=0></td>");
echo("<td class=syslog width=150>" . $entry['date'] . "</td>"); echo("<td class=syslog width=125>" . $entry['date'] . "</td>");
if($_GET['page'] == "syslog") { if($_GET['page'] == "syslog") {
echo("<td><strong>".generatedevicelink($entry['device_id'], $entry['hostname'])."</strong></td>"); echo("<td width=200><strong>".generatedevicelink($entry['device_id'], $entry['hostname'])."</strong></td>");
} }

View File

@ -3,7 +3,7 @@
$interface_query = mysql_query("SELECT * FROM `interfaces` $where"); $interface_query = mysql_query("SELECT * FROM `interfaces` $where");
while ($interface = mysql_fetch_array($interface_query)) { while ($interface = mysql_fetch_array($interface_query)) {
if(!$device) { $device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE device_id = '" . $interface['device_id'] . "'")); } if(!$device) { $device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $interface['device_id'] . "'")); }
unset($ifAdminStatus, $ifOperStatus, $ifAlias, $ifDescr); unset($ifAdminStatus, $ifOperStatus, $ifAlias, $ifDescr);
@ -110,6 +110,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
} }
$woo = "N:$ifHCInOctets:$ifHCOutOctets:$ifInErrors:$ifOutErrors:$ifInUcastPkts:$ifOutUcastPkts:$ifInNUcastPkts:$ifOutNUcastPkts"; $woo = "N:$ifHCInOctets:$ifHCOutOctets:$ifInErrors:$ifOutErrors:$ifInUcastPkts:$ifOutUcastPkts:$ifInNUcastPkts:$ifOutNUcastPkts";
$ret = rrdtool_update("$rrdfile", $woo); $ret = rrdtool_update("$rrdfile", $woo);
} else { } else {
echo("Interface " . $device['hostname'] . " " . $interface['ifDescr'] . " is down\n"); echo("Interface " . $device['hostname'] . " " . $interface['ifDescr'] . " is down\n");
} }

View File

@ -4,7 +4,7 @@
include("config.php"); include("config.php");
include("includes/functions.php"); include("includes/functions.php");
echo("Observer Poller v$observer_version\n\n"); echo("Observer Poller v".$config['version']."\n\n");
if($argv[1] == "--device" && $argv[2]) { if($argv[1] == "--device" && $argv[2]) {
$where = "AND `device_id` = '".$argv[2]."'"; $where = "AND `device_id` = '".$argv[2]."'";
@ -23,8 +23,6 @@ if($argv[1] == "--device" && $argv[2]) {
echo("Starting polling run:\n\n"); echo("Starting polling run:\n\n");
$device_query = mysql_query("SELECT * FROM `devices` WHERE `ignore` = '0' $where ORDER BY `device_id` ASC"); $device_query = mysql_query("SELECT * FROM `devices` WHERE `ignore` = '0' $where ORDER BY `device_id` ASC");
while ($device = mysql_fetch_array($device_query)) { while ($device = mysql_fetch_array($device_query)) {
@ -252,10 +250,8 @@ while ($device = mysql_fetch_array($device_query)) {
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('" . $device['device_id'] . "', NULL, NOW(), 'Device status changed to $stat')"); mysql_query("INSERT INTO eventlog (host, interface, datetime, message) VALUES ('" . $device['device_id'] . "', NULL, NOW(), 'Device status changed to $stat')");
} }
if ($uptime) { if ($uptime) {
$old_uptime = mysql_result(mysql_query("SELECT `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'uptime'"), 0); $old_uptime = mysql_result(mysql_query("SELECT `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'uptime'"), 0);
if( $uptime < $old_uptime ) { if( $uptime < $old_uptime ) {