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@81 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
14
cleanup.php
14
cleanup.php
@ -7,7 +7,7 @@ include("config.php");
|
||||
include("includes/functions.php");
|
||||
|
||||
$query = "SELECT *,A.id as id FROM ipaddr AS A, interfaces as I, devices as D
|
||||
WHERE A.interface_id = I.interface_id AND I.device_id = D.id AND D.status = '1'";
|
||||
WHERE A.interface_id = I.interface_id AND I.device_id = D.device_id AND D.status = '1'";
|
||||
|
||||
$data = mysql_query($query);
|
||||
while($row = mysql_fetch_array($data)) {
|
||||
@ -23,7 +23,7 @@ while($row = mysql_fetch_array($data)) {
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM interfaces AS I, devices as D
|
||||
WHERE I.host = D.id AND D.status = '1'";
|
||||
WHERE I.device_id = D.device_id AND D.status = '1'";
|
||||
$data = mysql_query($query);
|
||||
while($row = mysql_fetch_array($data)) {
|
||||
$index = $row[ifIndex];
|
||||
@ -31,8 +31,12 @@ while($row = mysql_fetch_array($data)) {
|
||||
$community = $row['community'];
|
||||
$response = trim(`snmpget -v2c -Osq -c $community $hostname ifIndex.$index | cut -d " " -f 2`);
|
||||
if($response != $index) {
|
||||
mysql_query("delete from interfaces where id = '" . $row['interface_id'] . "'");
|
||||
echo("Deleted $row[ifDescr] from $hostname\n");
|
||||
mysql_query("DELETE from interfaces where interface_id = '" . $row['interface_id'] . "'");
|
||||
mysql_query("DELETE from `adjacencies` WHERE `interface_id` = '" . $row['interface_id'] . "'");
|
||||
mysql_query("DELETE from `links` WHERE `src_if` = '" . $row['interface_id'] . "'");
|
||||
mysql_query("DELETE from `links` WHERE `dst_if` = '" . $row['interface_id'] . "'");
|
||||
mysql_query("DELETE from `ipaddr` WHERE `interface_id` = '" . $row['interface_id'] . "'");
|
||||
echo("Removed interface " . $row['ifDescr'] . " from " . $row['hostname'] . "<br />");
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +45,7 @@ $interface_query = mysql_query("SELECT interface_id,device_id FROM `interfaces`"
|
||||
while ($interface = mysql_fetch_array($interface_query)) {
|
||||
$device_id = $interface['device_id'];
|
||||
$interface_id = $interface['interface_id'];
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `id` = '$device_id'"), 0) == '0') {
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `devices` WHERE `device_id` = '$device_id'"), 0) == '0') {
|
||||
mysql_query("delete from interfaces where `interface_id` = '$interface_id'");
|
||||
echo("Deleting if $interface_id \n");
|
||||
}
|
||||
|
@ -8,13 +8,13 @@
|
||||
$type = strtolower($device['os']);
|
||||
unset($image);
|
||||
|
||||
$image = getImage($device[id]);
|
||||
$image = getImage($device['device_id']);
|
||||
|
||||
echo("
|
||||
<tr >
|
||||
<td width='40' align=center valign=middle>$image</td>
|
||||
<td valign=middle><span style='font-weight: bold; font-size: 20px;'>" . generatedevicelink($device) . "</span>
|
||||
<br />$device[purpose]</td>
|
||||
<br />" . $device['purpose'] . "</td>
|
||||
<td></td>
|
||||
</tr>");
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
$class = "list-device-ignored";
|
||||
if ($device['status'] == '1') { $class = "list-device-ignored-up"; }
|
||||
}
|
||||
|
||||
$type = strtolower($device['os']);
|
||||
unset($image);
|
||||
|
||||
|
@ -72,7 +72,7 @@ echo("
|
||||
$sql = "SELECT * FROM interfaces WHERE `device_id` = '$id'";
|
||||
$query = mysql_query($sql);
|
||||
while($data = mysql_fetch_array($query)) {
|
||||
echo("$ifsep" . generateiflink($data, makeshortif(strtolower($data['if']))));
|
||||
echo("$ifsep" . generateiflink($data, makeshortif(strtolower($data['ifDescr']))));
|
||||
$ifsep = ", ";
|
||||
}
|
||||
unset($ifsep);
|
||||
|
@ -13,7 +13,8 @@ $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);
|
||||
$device['uptime'] = mysql_result(mysql_query("SELECT `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] ."' AND `attrib_type` = 'uptime'"), 0);
|
||||
|
||||
include("includes/hostbox.inc");
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
$interface_query = mysql_query("select * from interfaces WHERE interface_id = '$_GET[id]'");
|
||||
$interface = mysql_fetch_array($interface_query);
|
||||
|
||||
$device_query = mysql_query("select * from devices where id = '$interface[host]'");
|
||||
$device_query = mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $interface['device_id'] . "'");
|
||||
$device = mysql_fetch_array($device_query);
|
||||
|
||||
$hostname = $device['hostname'];
|
||||
@ -24,7 +24,7 @@ $interface = mysql_fetch_array($interface_query);
|
||||
$i = 1;
|
||||
$inf = fixifName($ifname);
|
||||
|
||||
# $bg="#ffffff";
|
||||
$bg="#ffffff";
|
||||
echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
||||
include("includes/device-header.inc");
|
||||
echo("</table>");
|
||||
|
Reference in New Issue
Block a user