fixing things!

git-svn-id: http://www.observium.org/svn/observer/trunk@55 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2007-04-04 10:43:23 +00:00
parent fb5f32b4e4
commit d4bfb35389
5 changed files with 32 additions and 42 deletions

View File

@@ -1,26 +1,14 @@
#!/bin/bash
./process-syslog.php
sleep 5
sleep 10
./process-syslog.php &
sleep 5
sleep 10
./process-syslog.php &
sleep 5
sleep 10
./process-syslog.php &
sleep 5
sleep 10
./process-syslog.php &
sleep 5
./process-syslog.php &
sleep 5
./process-syslog.php &
sleep 5
./process-syslog.php &
sleep 5
./process-syslog.php &
sleep 5
./process-syslog.php &
sleep 5
./process-syslog.php &
sleep 5
sleep 10
./process-syslog.php &

View File

@@ -15,7 +15,7 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
echo("<tr style=\"background-color: $bg\">
<td width=0></td>
<td class=syslog width=180>
$entry[datetime]
" . $entry['datetime'] . "
</td>");
if(!$_GET[id] && !$overview) {
$dev['id'] = $entry['host'];
@@ -25,14 +25,17 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
</td>");
}
$if['id'] = $entry[interface];
echo("<td class=list-bold width=175>");
if($if['id']) {
$if['id'] = $entry['interface'];
$if['if'] = $interface;
echo("<td class=list-bold width=175>
" . generateiflink($if) . "
</td>
echo(generateiflink($if));
}
echo("</td>");
<td width=20>$icon</td>
<td class=syslog>
$entry[message]
" . $entry['message'] . "
</td>
<td></td>
</tr>");

View File

@@ -1,16 +1,22 @@
<?php
if($_GET['location']) { $where = "AND location = '$_GET[location]'"; }
if($_GET['location'] == "Unset") { $where = "AND location = ''"; }
if($_GET['type']) { $where = "AND type = '$_GET[type]'"; }
$sql = "select * from devices AS D, device_uptime AS U WHERE D.id = U.device_id $where ORDER BY `ignore`, `status`, `os`, `hostname`";
if($_GET['status'] == "alerted") { $sql = "select *, D.id as id from devices AS D, device_uptime AS U WHERE D.id = U.device_id " . str_replace("WHERE", "OR", $device_alert_sql) . " GROUP BY `id` ORDER BY `ignore`, `status`, `os`, `hostname`"; }
if($_GET['ignore']) { mysql_query("UPDATE devices SET `ignore` = '1' WHERE `id` = '$_GET[ignore]'"); }
if($_GET['unignore']) { mysql_query("UPDATE devices SET `ignore` = '0' WHERE `id` = '$_GET[unignore]'"); }
if($_GET['location']) { $where = "WHERE location = '$_GET[location]'"; }
if($_GET['location'] == "Unset") { $where = "WHERE location = ''"; }
if($_GET['type']) { $where = "WHERE type = '$_GET[type]'"; }
$sql = "select * from devices $where ORDER BY `ignore`, `status`, `os`, `hostname`";
if($_GET['status'] == "alerted") { $sql = "select * from devices " . $device_alert_sql . " GROUP BY `id` ORDER BY `ignore`, `status`, `os`, `hostname`"; }
$device_query = mysql_query($sql);
echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
while($device = mysql_fetch_array($device_query)) {
$device[uptime] = @mysql_result(mysql_query("SELECT device_uptime FROM device_uptime WHERE device_id = '" . $device[id] ."'" ), 0);
include("includes/hostbox.inc");
}

View File

@@ -68,13 +68,13 @@ while ($interface = mysql_fetch_array($interface_query)) {
if ( $old_if != $ifDescr && $ifDescr != "" ) {
$update = "`if` = '$ifDescr'";
$seperator = ", ";
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'Name: $old_if -> $ifDescr')");
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'Name -> $ifDescr')");
}
if ( $old_alias != $ifAlias ) {
$update .= $seperator . "`name` = \"$ifAlias\"";
$seperator = ", ";
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'Desc: $old_alias -> $ifAlias')");
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'Desc -> $ifAlias')");
}
if ( $old_up != $ifOperStatus && $ifOperStatus != "" ) {
$update .= $seperator . "`up` = '$ifOperStatus'";
@@ -90,22 +90,22 @@ while ($interface = mysql_fetch_array($interface_query)) {
if ( $old_duplex != $ifDuplex && $ifDuplex != "" ) {
$update .= $seperator . "`ifDuplex` = '$ifDuplex'";
$seperator = ", ";
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'Duplex changed to $ifDuplex')");
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'Duplex -> $ifDuplex')");
}
if ( $old_type != $ifType && $ifType != "" ) {
$update .= $seperator . "`ifType` = '$ifType'";
$seperator = ", ";
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'Type changed to $ifType')");
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'Type -> $ifType')");
}
if ( $old_mtu != $ifMtu && $ifMtu != "" ) {
$update .= $seperator . "`ifMtu` = '$ifMtu'";
$seperator = ", ";
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'MTU changed to $ifMtu')");
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'MTU -> $ifMtu')");
}
if ( $old_physaddress != $ifPhysAddress && $ifPhysAddress != "" ) {
$update .= $seperator . "`ifPhysAddress` = '$ifPhysAddress'";
$seperator = ", ";
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'MAC changed to $ifPhysAddress')");
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'MAC -> $ifPhysAddress')");
}
if ( $old_speed != $ifSpeed && $ifSpeed != "" ) {
@@ -113,7 +113,7 @@ while ($interface = mysql_fetch_array($interface_query)) {
$seperator = ", ";
$prev = humanspeed($old_speed);
$now = humanspeed($ifSpeed);
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'Speed changed from $prev -> $now')");
mysql_query("INSERT INTO eventlog (host, interface, datetime, message) values ($interface[host], $interface[sqlid], NOW(), 'Speed -> $now')");
}
if ($update) {

View File

@@ -1,16 +1,9 @@
#!/usr/bin/php
<?
#
# Statistics Polling Script
#
include("config.php");
include("includes/functions.php");
#
# Poll Device Statistics
#
$device_query = mysql_query("SELECT id,hostname,os,community,snmpver FROM `devices` WHERE `id` LIKE '%" . $argv[1] . "' AND status = '1' ORDER BY id DESC");
while ($device = mysql_fetch_array($device_query)) {