space/indent fixes and cleanups

git-svn-id: http://www.observium.org/svn/observer/trunk@1849 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-03-15 15:10:23 +00:00
parent 1ff3eb6632
commit 0cbb3ab944
6 changed files with 34 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
For more granular updates check http://twitter.com/observium or
For more granular updates check http://twitter.com/observium or
http://www.observium.org/websvn/listing.php?repname=observer
Release 0.10.7.1 ( 19th July 2010 )
@@ -11,7 +11,7 @@ Release 0.10.7 ( 18th July 2010 )
* rrdcached support
* Support of ADSL-LINE-MIB and new ports display mode designed
for service providers with DSLAMs and MSANs
* Discovery of new device/os types :
* Discovery of new device/os types :
Apple Airport, Axis Camera, Motorola Netopia, APC Switched PDU,
Extreme Extremeware, Redback, ZyXEL ZyWALL, DELL DRAC,
Dell PowerVault, Allied Telesis, Cisco NX-OS, MGE Evolution UPS
@@ -108,14 +108,14 @@ Release 0.3.2.1 ( 27th March 2008 )
Minor bugfix to interface discovery engine.
Release 0.3.2 ( 26th March 2008 )
Release 0.3.2 ( 26th March 2008 )
Added BGP peer detection and watching
Cleaned up the front page and made it more useful
Added better syslog support
Added some Juniper Netscreen support
Added some Juniper Netscreen support
Wrote a better OS detection system
Added some billing features
Added some billing features
Rewrote and restructured a lot of the discovery
Rewrote some polling stuff
@@ -125,7 +125,7 @@ Rewrote some polling stuff
Release 0.3.1 ( 30th November 2007 )
Fixed a great many things and made it prettier!
.. This release took so long that I've largely forgotten
.. This release took so long that I've largely forgotten
what's been changed. Again!
Release 0.3.0-pre1 ( 24th June 2007 )

2
README
View File

@@ -1,4 +1,4 @@
Copyright (C) 2006-2010 Adam Armstrong <adama@memetic.org>
Copyright (C) 2006-2011 Adam Armstrong <adama@memetic.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -7,30 +7,36 @@ include("includes/functions.php");
## Check all of our interface RRD files for errors
if($argv[1]) { $where = "AND `interface_id` = '$argv[1]'"; }
if ($argv[1]) { $where = "AND `interface_id` = '$argv[1]'"; }
$i = '0';
$interface_query = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id $where");
while ($interface = mysql_fetch_array($interface_query)) {
while ($interface = mysql_fetch_array($interface_query))
{
$errors = $interface['ifInErrors_delta'] + $interface['ifOutErrors_delta'];
if($errors > '1') {
$errored[] = $interface['hostname'] . " - " . $interface['ifDescr'] . " - " . $interface['ifAlias'] . " - " . $interface['ifInErrors_delta'] . " - " . $interface['ifOutErrors_delta'];
if ($errors > '1')
{
$errored[] = $interface['hostname'] . " - " . $interface['ifDescr'] . " - " . $interface['ifAlias'] . " - " . $interface['ifInErrors_delta'] . " - " . $interface['ifOutErrors_delta'];
}
$i++;
}
echo("Checked $i Interfaces\n");
if($errored) { ## If there are errored ports
if ($errored)
{ ## If there are errored ports
$i=0;
$msg = "Interfaces with errors : \n\n";
foreach ($errored as $int) {
foreach ($errored as $int)
{
$msg .= "$int\n"; ## Add a line to the report email warning about them
$i++;
}
}
## Send the alert email
notify($device, "Observium detected errors on $i interface" . ($i != 1 ? 's' : ''), $msg);
}
?>
?>

View File

@@ -7,17 +7,19 @@ include("includes/functions.php");
# Remove a host and all related data from the system
if($argv[1]) {
if ($argv[1])
{
$host = strtolower($argv[1]);
$id = getidbyname($host);
if($id) {
if ($id)
{
echo(delete_device($id));
echo("Removed $host\n");
} else {
echo("Host doesn't exist!\n");
}
} else {
echo("Host Removal Tool\nUsage: ./delhost.php <hostname>\n");
echo("Host Removal Tool\nUsage: ./delhost.php <hostname>\n");
}
?>

View File

@@ -5,15 +5,16 @@ mysql_query("ALTER TABLE `eventlog` ADD `event_id` INT NOT NULL AUTO_INCREMENT
$s = "SELECT * FROM eventlog";
$q = mysql_query($s);
while ($event = mysql_fetch_array($q)) {
if($event['interface']) {
while ($event = mysql_fetch_array($q))
{
if ($event['interface'])
{
mysql_query("UPDATE `eventlog` SET `interface` = NULL, `type` = 'interface', `reference` = '".$event['interface']."' WHERE `event_id` = '".$event['event_id']."'");
}
$i++;
}
mysql_query("ALTER TABLE `eventlog` DROP `interface`");
?>
?>

View File

@@ -7,11 +7,11 @@ include("includes/functions.php");
# Remove a host and all related data from the system
if($argv[1] && $argv[2])
if ($argv[1] && $argv[2])
{
$host = strtolower($argv[1]);
$id = getidbyname($host);
if($id)
if ($id)
{
renamehost($id, $argv[2]);
echo("Renamed $host\n");