diff --git a/html/.htaccess b/html/.htaccess index cc382a664..994950273 100644 --- a/html/.htaccess +++ b/html/.htaccess @@ -20,3 +20,5 @@ RewriteRule ^device/([0-9]+) ?page=device&id=$1 RewriteRule ^([a-z]+)/$ ?page=$1 +RewriteRule ^([a-z]+)/([a-z]+)/$ ?page=$1&view=$2 + diff --git a/html/includes/hostbox.inc b/html/includes/hostbox.inc index 6a752843a..47eddd51c 100644 --- a/html/includes/hostbox.inc +++ b/html/includes/hostbox.inc @@ -12,8 +12,8 @@ $image = getImage($device['device_id']); - echo(" -
- | ".$bill['bill_name']." |
+ ".$bill['bill_name']." |
$notes |
$type |
$allowed |
diff --git a/html/pages/default.php b/html/pages/default.php
index fa7c44bd1..e0cd80796 100644
--- a/html/pages/default.php
+++ b/html/pages/default.php
@@ -27,46 +27,53 @@ while($device = mysql_fetch_array($sql)){
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'");
while($device = mysql_fetch_array($sql)){
- unset($already);
- $i = 0;
- while ($i <= count($nodes)) {
- $thisnode = $device['device_id'];
- if ($nodes[$i] == $thisnode) {
- $already = "yes";
- }
- $i++;
- }
- if(!$already) { $nodes[] = $device['device_id']; }
+
+ echo("
+ ");
+
}
$sql = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
-while($device = mysql_fetch_array($sql)){
- unset($already);
- $i = 0;
- while ($i <= count($nodes)) {
- $thisnode = $device['device_id'];
- if ($nodes[$i] == $thisnode) {
- $already = "yes";
- }
- $i++;
- }
- if(!$already) { $nodes[] = $device['device_id']; }
+while($interface = mysql_fetch_array($sql)){
+
+ echo("+ Device Down + ".truncate($device['location'], 20)." +
+ ");
+
}
-$sql = mysql_query("SELECT D.device_id FROM `services` AS S, `devices` AS D WHERE S.service_host = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
-while($device = mysql_fetch_array($sql)){
- unset($already);
- $i = 0;
- while ($i <= count($nodes)) {
- $thisnode = $device['device_id'];
- if ($nodes[$i] == $thisnode) {
- $already = "yes";
- }
- $i++;
- }
- if(!$already) { $nodes[] = $device['device_id']; }
+$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.service_host = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
+while($service = mysql_fetch_array($sql)){
+
+ echo("+ Port Down + ".generateiflink($interface, makeshortif($interface['ifDescr']))." + ".truncate($interface['ifAlias'], 20)." +
+ ");
+
}
+$sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND B.device_id = D.device_id");
+while($peer = mysql_fetch_array($sql)){
+
+ echo("+ Service Down + ".$service['service_type']." + ".truncate($interface['ifAlias'], 20)." +
+ ");
+
+}
+
+
+
foreach($nodes as $node) {
unset($srvpop);
@@ -126,8 +133,9 @@ foreach($nodes as $node) {
$device['device_id'] = $node;
- $errorboxes .= "+ BGP Down + ".$peer['bgpPeerIdentifier']." + AS".$peer['bgpPeerRemoteAs']." ".truncate($peer['astext'], 10)." +
- "; + $errorboxes .= " +
+ "; if(hoststatus($node)) { $errorboxes .= " ".formatuptime($uptime, short)." "; diff --git a/includes/discovery/interfaces.php b/includes/discovery/interfaces.php index 5708b888a..24da15bae 100755 --- a/includes/discovery/interfaces.php +++ b/includes/discovery/interfaces.php @@ -31,7 +31,7 @@ if (preg_match('/ng[0-9]+$/', $if)) { $nullintf = '1'; } if ($nullintf == 0) { if(mysql_result(mysql_query("SELECT COUNT(*) FROM `interfaces` WHERE `device_id` = '".$device['device_id']."' AND `ifIndex` = '$ifIndex'"), 0) == '0') { -# mysql_query("INSERT INTO `interfaces` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('$id','$ifIndex','$ifName')"); + mysql_query("INSERT INTO `interfaces` (`device_id`,`ifIndex`,`ifDescr`) VALUES ('$id','$ifIndex','$ifName')"); echo("+"); } else { # Interface Already Exists diff --git a/includes/functions.php b/includes/functions.php index ab8274dc7..977616903 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -118,15 +118,25 @@ function devicepermitted($device_id) { } function formatRates($rate) { - $sizes = Array('bps', 'Kbps', 'Mbps', 'Gbps', 'Tbps', 'Pbps', 'Ebps'); + $rate = format_si($rate) . "bps"; + return $rate; +} + +function formatstorage($rate) { + $rate = format_bi($rate) . "B"; + return $rate; +} + +function format_si($rate) { + $sizes = Array('', 'K', 'M', 'G', 'T', 'P', 'E'); $round = Array('0','0','0','2','2','2','2','2','2'); $ext = $sizes[0]; for ($i=1; (($i < count($sizes)) && ($rate >= 1000)); $i++) { $rate = $rate / 1000; $ext = $sizes[$i]; } return round($rate, $round[$i]).$ext; } -function formatStorage($size) { - $sizes = Array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'); +function format_bi($size) { + $sizes = Array('', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei'); $ext = $sizes[0]; for ($i=1; (($i < count($sizes)) && ($size >= 1024)); $i++) { $size = $size / 1024; $ext = $sizes[$i]; } return round($size, 2).$ext; diff --git a/includes/polling/interfaces.inc.php b/includes/polling/interfaces.inc.php index 3422ca93b..2f277713c 100644 --- a/includes/polling/interfaces.inc.php +++ b/includes/polling/interfaces.inc.php @@ -82,7 +82,7 @@ while ($interface = mysql_fetch_array($interface_query)) { $update_query = "UPDATE `interfaces` SET "; $update_query .= $update; $update_query .= " WHERE `interface_id` = '" . $interface['interface_id'] . "'"; - echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n"); +# echo("Updating : " . $device['hostname'] . " $ifDescr\nSQL :$update_query\n\n"); $update_result = mysql_query($update_query); } else { # echo("Not Updating : " . $device['hostname'] ." $ifDescr ( " . $interface['ifDescr'] . " )\n\n"); |