Lots of additions.

git-svn-id: http://www.observium.org/svn/observer/trunk@108 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2007-06-24 14:56:47 +00:00
parent 2cd924d0dd
commit 9ca765c285
28 changed files with 521 additions and 400 deletions

View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 594 B

After

Width:  |  Height:  |  Size: 384 B

View File

@@ -22,12 +22,13 @@ if($_GET['logout']) {
$encrypted=$_COOKIE['encrypted'];
}
$sql = "select username, level from users where username='$_SESSION[username]' and password='$encrypted'";
$sql = "select username, level, user_id from users where username='$_SESSION[username]' and password='$encrypted'";
$row = mysql_fetch_row(mysql_query($sql));
if ( $_SESSION['username'] != "" && $row[0] == $_SESSION['username'] ) {
$_SESSION['userlevel'] = $row[1];
$_SESSION['authenticated'] = true;
$_SESSION['user_id'] = $row[2];
setcookie("username", $username);
setcookie("encrypted", $encrypted);
}

View File

@@ -17,10 +17,10 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
<td class=syslog width=140>
$entry[humandate]
</td>");
$if['id'] = $entry[interface];
$if['if'] = makeshortif($interface);
$if['interface_id'] = $entry[interface];
$if['ifDescr'] = makeshortif($interface);
echo("<td class=list-bold width=75>
" . generateiflink($if) . "
" . generateiflink($if) . "
</td>
<td class=syslog>" .
truncate($entry[message], 45)

View File

@@ -1,24 +1,26 @@
<?php
$daily_traffic = "graph.php?if=$iid&type=$graph_type&from=$day&to=$now&width=217&height=100";
$daily_url = "graph.php?if=$iid&type=$graph_type&from=$day&to=$now&width=550&height=175";
if(!$graph_type) { $graph_type = $_GET['type']; }
$weekly_traffic = "graph.php?if=$iid&type=$graph_type&from=$week&to=$now&width=217&height=100";
$weekly_url = "graph.php?if=$iid&type=$graph_type&from=$week&to=$now&width=550&height=175";
$daily_traffic = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=217&height=100";
$daily_url = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
$monthly_traffic = "graph.php?if=$iid&type=$graph_type&from=$month&to=$now&width=217&height=100";
$monthly_url = "graph.php?if=$iid&type=$graph_type&from=$month&to=$now&width=550&height=175";
$weekly_traffic = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=217&height=100";
$weekly_url = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
$yearly_traffic = "graph.php?if=$iid&type=$graph_type&from=$year&to=$now&width=217&height=100";
$yearly_url = "graph.php?if=$iid&type=$graph_type&from=$year&to=$now&width=550&height=175";
$monthly_traffic = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=217&height=100";
$monthly_url = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
echo("<a href='?page=interface&id=$iid' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
$yearly_traffic = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=217&height=100";
$yearly_url = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT, BORDER, 0);\" onmouseout=\"return nd();\">
<img src='$daily_traffic' border=0></a> ");
echo("<a href='?page=interface&id=$iid' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT, BORDER, 0);\" onmouseout=\"return nd();\">
<img src='$weekly_traffic' border=0></a> ");
echo("<a href='?page=interface&id=$iid' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT, BORDER, 0, WIDTH, 350);\" onmouseout=\"return nd();\">
<img src='$monthly_traffic' border=0></a> ");
echo("<a href='?page=interface&id=$iid' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT, BORDER, 0, WIDTH, 350);\" onmouseout=\"return nd();\">
<img src='$yearly_traffic' border=0></a>");
?>

View File

@@ -2,6 +2,11 @@
# This file prints a table row for each interface
$interface['device_id'] = $device['device_id'];
$interface['hostname'] = $device['hostname'];
if(!$_GET['type']) { $_GET['type'] = "bits"; }
$if_id = $interface['interface_id'];
$ifDescr = fixifName($interface['ifDescr']);
$ifIndex = $interface['ifIndex'];
@@ -10,18 +15,22 @@
$ifPhysAddress = $interface['ifPhysAddress'];
$ifType = fixiftype($interface['ifType']);
$ifHardType = $interface['ifHardType'];
# echo($interface['ifHardType']);
# $errors = interface_errors($interface);
# $rates = interface_rates($interface);
if($ifAlias) {$ifAlias = $ifAlias . "</br>";}
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
$error_img = generateiflink($interface,"<img src='/images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
} else { $error_img = ""; }
$graph_url = "graph.php?if=$if_id&from=$twoday&to=$now&width=400&height=120&type=bits";
echo("<tr style=\"background-color: $bg; padding: 5px;\" valign=top>
<td valign=top width=300>
<span class=list-large>
" . generateiflink($interface, "$i. $ifDescr") . "
" . generateiflink($interface, "$i. $ifDescr") . " $error_img
</span><br /><span class=interface-desc>$ifAlias</span>");
unset ($break);
if(!$dographs) {
@@ -31,6 +40,16 @@
$break = " ";
}
echo("</span>");
echo("</td><td width=100>");
if($interface['ifOperStatus'] == "up") {
$in_perc = round($interface['in_rate']/$interface['ifSpeed']*100);
$out_perc = round($interface['in_rate']/$interface['ifSpeed']*100);
echo("<img src='/images/16/arrow_left.png' align=absmiddle> <span style='color: " . percent_colour($in_perc) . "'>" . formatRates($interface['in_rate']) . "</span><br />");
echo("<img align=absmiddle src='/images/16/arrow_out.png'> <span style='color: " . percent_colour($out_perc) . "'>" . formatRates($interface['out_rate']) . "</span>");
}
echo("</td><td width=70>");
if($ifSpeed && $ifSpeed != "") { echo("<span class=box-desc>$ifSpeed</span>"); }
echo("<br />");
@@ -84,7 +103,7 @@ echo("</td>");
$this_ifname = fixifName($new['ifDescr']);
$wq = mysql_query("select count(*) FROM links WHERE dst_if = '$this_ifid' AND src_if = $if_id;");
if (@mysql_result($wq, 0) == '0' && $this_hostname != $hostname) {
$graph_url = "graph.php?if=$this_ifid&from=$twoday&to=$now&width=400&height=120&type=bits";
$graph_url = "graph.php?if=$this_ifid&from=$twoday&to=$now&width=400&height=120&type=bits'";
echo("$br &nbsp;<img src='images/16/bullet_go.png' alt='Same Subnet' align=absmiddle />" . generateiflink($new) . " on " . generatedevicelink($new));
$br = "<br />";
}
@@ -97,15 +116,44 @@ echo("</td>");
// If we're showing graphs, generate the graph and print the img tags
if($dographs && is_file("rrd/" . $hostname . ".". $ifIndex . ".rrd")) {
$daily_traffic = "graph.php?if=$if_id&type=bits&from=$day&to=$now&width=210&height=100";
$weekly_traffic = "graph.php?if=$if_id&type=bits&from=$week&to=$now&width=210&height=100";
$monthly_traffic = "graph.php?if=$if_id&type=bits&from=$month&to=$now&width=210&height=100";
$yearly_traffic = "graph.php?if=$if_id&type=bits&from=$year&to=$now&width=210&height=100";
$type = $_GET['type'];
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=3>");
echo("<img src='$daily_traffic'> <img src='$weekly_traffic'> ");
echo("<img src='$monthly_traffic'> <img src='$yearly_traffic'>");
echo("</td></tr>");
# echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=3>");
# include("includes/print-interface-graphs.php");
# echo("</td></tr>");
$daily_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$day&to=$now&width=210&height=100";
$daily_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$day&to=$now&width=500&height=150";
$weekly_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$week&to=$now&width=210&height=100";
$weekly_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$week&to=$now&width=500&height=150";
$monthly_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$month&to=$now&width=210&height=100";
$monthly_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$month&to=$now&width=500&height=150";
$yearly_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$year&to=$now&width=210&height=100";
$yearly_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$year&to=$now&width=500&height=150";
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=3>");
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT, BORDER, 0);\"
onmouseout=\"return nd();\"> <img src='$daily_traffic' border=0></a>");
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT, BORDER, 0);\"
onmouseout=\"return nd();\"> <img src='$weekly_traffic' border=0></a>");
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT, WIDTH, 350, BORDER, 0);\"
onmouseout=\"return nd();\"> <img src='$monthly_traffic' border=0></a>");
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT, WIDTH, 350, BORDER, 0);\"
onmouseout=\"return nd();\"> <img src='$yearly_traffic' border=0></a>");
echo("</td></tr>");
# echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=3>");
# echo("<img src='$daily_traffic'> <img src='$weekly_traffic'> ");
# echo("<img src='$monthly_traffic'> <img src='$yearly_traffic'>");
# echo("</td></tr>");
}

View File

@@ -19,6 +19,7 @@
unset($this_alert);
}
?>
<div class="menu2">
@@ -28,7 +29,10 @@
<table><tr><td>
<ul>
<li><a href="?page=overview"><img src='/images/16/zoom.png' border=0 align=absmiddle> Overview</a></li>
<li><a href="?page=eventlog"><img src='/images/16/information.png' border=0 align=absmiddle> Eventlog</a></li>
<li><a href="?page=eventlog"><img src='/images/16/report.png' border=0 align=absmiddle> Eventlog</a></li>
<?php if($enable_syslog) {
echo("<li><a href='?page=syslog'><img src='/images/16/page.png' border=0 align=absmiddle> Syslog</a></li>");
} ?>
<li><a href="?page=alerts"><img src='/images/16/exclamation.png' border=0 align=absmiddle> Alerts</a></li>
</ul>
</td></tr></table>
@@ -42,17 +46,25 @@
<table><tr><td>
<ul>
<li><a href='?page=devices'><img src='/images/16/server.png' border=0 align=absmiddle> All Devices</a></li>
<li><hr width=140 /></li>
<li><a href="?page=devices&type=server"><img src='/images/16/server.png' border=0 align=absmiddle> Servers</a></li>
<li><a href="?page=devices&type=network"><img src='/images/16/arrow_switch.png' border=0 align=absmiddle> Network</a></li>
<li><a href="?page=devices&type=firewall"><img src='/images/16/shield.png' border=0 align=absmiddle> Firewalls</a></li>
<?php
echo(" <li><hr width=140 /></li>
<li><a href='?page=devices&status=alerted'><img src='/images/16/server_error.png' border=0 align=absmiddle> Alerts ($device_alerts)</a></li>");
?>
echo("
<li><hr width=140 /></li>
<li><a href="?page=addhost"><img src='/images/16/server_add.png' border=0 align=absmiddle> Add Device</a></li>
<li><a href="?page=delhost"><img src='/images/16/server_delete.png' border=0 align=absmiddle> Delete Device</a></li>
<li><a href='?page=devices&type=server'><img src='/images/16/server.png' border=0 align=absmiddle> Servers</a></li>
<li><a href='?page=devices&type=network'><img src='/images/16/arrow_switch.png' border=0 align=absmiddle> Network</a></li>
<li><a href='?page=devices&type=firewall'><img src='/images/16/shield.png' border=0 align=absmiddle> Firewalls</a></li>");
echo(" <li><hr width=140 /></li>
<li><a href='?page=devices&status=alerted'><img src='/images/16/server_error.png' border=0 align=absmiddle> Alerts ($device_alerts)</a></li>");
if($_SESSION['userlevel'] > '5') {
echo("
<li><hr width=140 /></li>
<li><a href='?page=addhost'><img src='/images/16/server_add.png' border=0 align=absmiddle> Add Device</a></li>
<li><a href='?page=delhost'><img src='/images/16/server_delete.png' border=0 align=absmiddle> Delete Device</a></li>");
}
?>
</ul>
</td></tr></table>
<!--[if lte IE 6]></a><![endif]-->
@@ -66,10 +78,16 @@ echo(" <li><hr width=140 /></li>
echo(" <li><hr width=140 /></li>
<li><a href='?page=services&status=0'><img src='/images/16/cog_error.png' border=0 align=absmiddle> Alerts ($service_alerts)</a></li>");
} ?>
<li><hr width=140 /></li>
<li><a href="?page=addsrv"><img src='/images/16/cog_add.png' border=0 align=absmiddle> Add Service</a></li>
<li><a href="?page=delsrv"><img src='/images/16/cog_delete.png' border=0 align=absmiddle> Delete Service</a></li>
<?php
if($_SESSION['userlevel'] > '5') {
echo("
<li><hr width=140 /></li>
<li><a href='?page=addsrv'><img src='/images/16/cog_add.png' border=0 align=absmiddle> Add Service</a></li>
<li><a href='?page=delsrv'><img src='/images/16/cog_delete.png' border=0 align=absmiddle> Delete Service</a></li>");
}
?>
</ul>
</td></tr></table>
<!--[if lte IE 6]></a><![endif]-->
@@ -84,13 +102,16 @@ echo(" <li><hr width=140 /></li>
<li><a href='?page=interfaces'><img src='/images/16/connect.png' border=0 align=absmiddle> All Ports</a></li>
<li><hr width=140 /></li>
<?php
if($show_if_customers) { echo("<li><a href='?page=customers'><img src='/images/16/group_link.png' border=0 align=absmiddle> Customers</a></li>"); $ifbreak = 1;}
if($show_if_transit) { echo("<li><a href='?page=iftype&type=transit'><img src='/images/16/world_link.png' border=0 align=absmiddle> Transit</a></li>"); $ifbreak = 1; }
if($show_if_peering) { echo("<li><a href='?page=iftype&type=peering'><img src='/images/16/brick_link.png' border=0 align=absmiddle> Peering</a></li>"); $ifbreak = 1; }
if($_SESSION['userlevel'] > '5') {
echo("<li><hr width=140 /></li>");
if($show_if_customers) { echo("<li><a href='?page=customers'><img src='/images/16/group_link.png' border=0 align=absmiddle> Customers</a></li>"); $ifbreak = 1;}
if($show_if_transit) { echo("<li><a href='?page=iftype&type=transit'><img src='/images/16/world_link.png' border=0 align=absmiddle> Transit</a></li>"); $ifbreak = 1; }
if($show_if_peering) { echo("<li><a href='?page=iftype&type=peering'><img src='/images/16/bug_link.png' border=0 align=absmiddle> Peering</a></li>"); $ifbreak = 1; }
if($show_if_core) { echo("<li><a href='?page=iftype&type=core'><img src='/images/16/brick_link.png' border=0 align=absmiddle> Core</a></li>"); $ifbreak = 1;}
}
if($ifbreak && $interface_alerts) { echo("<li><hr width=140 /></li>"); }

View File

@@ -3,8 +3,12 @@
if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
$hostname = gethostbyid($entry['host']);
$interface = fixifname(getifbyid($entry['interface']));
# if($entry['interface']) {
# $interface = fixifname(getifbyid($entry['interface']));
# }
$entry['device_id'] = $entry['host'];
$entry['hostname'] = gethostbyid($entry['host']);
unset($icon);
@@ -12,15 +16,20 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
if($icon) {$icon = "<img src='/images/16/$icon'>"; }
echo("<tr style=\"background-color: $bg\">
<td width=0></td>
<td class=syslog width=150>
" . $entry['datetime'] . "
<td class=syslog width=175>");
if($page == "syslog") {
echo("" . generatedevicelink($entry) . "<br />");
}
echo($entry['datetime'] . "
</td>
<td class=list-bold width=75>
<td class=syslog width=100>
" . $entry['priority'] . "
</td>
<td class=syslog width=175>
<br />
" . $entry['program'] . "
</td>
<td class=syslog>

View File

@@ -1,5 +1,13 @@
<?php
if($_SESSION['userlevel'] < 10) {
echo("<span class='alert'>You are not permitted to perform this function</span>");
exit;
}
if($_POST['hostname'] && $_POST['community']) {
if($_SESSION['userlevel'] > '5') {
$hostname = $_POST['hostname'];

View File

@@ -1,11 +1,11 @@
<?php
if($_SESSION[userlevel] < '5') {
print_error("Insufficient Privileges");
if($_SESSION['userlevel'] < '10') {
echo("<span class='alert'>Insufficient privileges to perform this function.</span>");
} else {
if($_POST['addsrv']) {
if($userlevel > "5") {
if($userlevel == '10') {
include("includes/add-srv.inc");
}
}

View File

@@ -1,9 +1,12 @@
<?php
if($_POST['id'] && $_SESSION['userlevel'] > '9') {
if($_SESSION['userlevel'] < 10) {
echo("<span class='alert'>You are not permitted to perform this function</span>");
exit;
}
if($_POST['id'] {
delHost($id);
} elseif ($_POST['id']) {
echo("<p class='errorbox'><b>Error:</b> You don't have the necessary privileges to remove hosts.</p>");
}
?>

View File

@@ -1,7 +1,16 @@
<?php
echo("
<div style='float: right; text-align: right;'>
<a href='/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=bits'>Bits</a> |
<a href='/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=pkts'>Packets</a> |
<a href='/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=nupkts'>NU Packets</a> |
<a href='/?page=device&id=" . $_GET['id'] . "&section=dev-ifgraphs&type=errors'>Errors</a>
</div>");
$dographs = 1;
if(!$_GET['type']) { $_GET['type'] = "bits"; }
include("pages/device/dev-ifs.inc");
?>

View File

@@ -24,12 +24,13 @@ echo("
<tr><td width=50% valign=top>");
if(file_exists("includes/dev-data-" . strtolower($device[os]) . ".inc")) {
#if(file_exists("includes/dev-data-" . strtolower($device[os]) . ".inc.php")) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p class=sectionhead>Device Data</p><div style='height: 5px;'></div>");
include("includes/dev-data-" . strtolower($device[os]) . ".inc");
# echo("<p class=sectionhead>Device Data</p><div style='height: 5px;'></div>");
# include("includes/dev-data-" . strtolower($device[os]) . ".inc.php");
include("includes/dev-overview-data.inc.php");
echo("</div>");
}
#}
if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE host_id = '" . $device['device_id'] . "'"),0)) {
@@ -38,22 +39,22 @@ if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE host_id
echo("<table width=100%>");
$i = '1';
echo("<tr class=tablehead><td>Mountpoint</td><td width=203>Usage</td><td width=40>%</td><td width=75>Total</td>
echo("<tr class=tablehead><td>Mountpoint</td><td width=203>Usage</td><td width=40></td><td width=75>Total</td>
<td width=75>Used</td></tr>");
$drives = mysql_query("SELECT * FROM `storage` WHERE host_id = '" . $device['device_id'] . "'");
while($drive = mysql_fetch_array($drives)) {
$total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits'];
$used = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
$perc = $drive['storage_perc'];
$perc = round($drive['storage_perc'], 0);
$total = formatStorage($total);
$used = formatStorage($used);
$store_url = "graph.php?id=" . $drive['storage_id'] . "&type=unixfs&from=$month&to=$now&width=400&height=125";
$store_popup = "onmouseover=\"return overlib('<img src=\'$store_url\'>', LEFT);\" onmouseout=\"return nd();\"";
if($perc > '80') { $drv_class='red'; } else { $drvclass=''; }
if($perc > '80') { $drv_colour='#cc0000'; } else { $drvclass='#0000cc'; }
echo("<tr><td class=tablehead>" . $drive['hrStorageDescr'] . "</td><td><a href='#' $store_popup><img src='percentage.php?per=" . $perc . "'></a>
</td><td>" . $perc . "%</td><td>" . $total . "</td><td>" . $used . "</td></tr>");
</td><td style='font-weight: bold; color: $drv_colour'>" . $perc . "%</td><td>" . $total . "</td><td>" . $used . "</td></tr>");
$i++;
}
echo("</table>");
@@ -74,14 +75,12 @@ if(mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE temp_h
while($temp = mysql_fetch_array($temps)) {
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
if($temp['temp_current'] < '30') { $temp_class='';
} elseif($temp['temp_current'] < '40') { $temp_class='blue';
} elseif($temp['temp_current'] < '50') { $temp_class='green';
} elseif($temp['temp_current'] < '60') { $temp_class='orange';
} else { $temp_class='red'; }
$temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
$temp_colour = percent_colour($temp_perc);
$temp['temp_descr'] = truncate($temp['temp_descr'], 25, '');
echo("<tr bgcolor='$row_colour'><td>" . $temp['temp_descr'] . "</td><td width=40 class=tablehead><span class='$temp_class'>" . $temp['temp_current'] . "&deg;C</span></td></tr>");
echo("<tr bgcolor='$row_colour'><td>" . $temp['temp_descr'] . "</td><td width=40 class=tablehead><span style='color: $temp_colour'>" . $temp['temp_current'] . "&deg;C</span></td></tr>");
if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
$i++;
}
@@ -112,7 +111,7 @@ echo("</td><td width=50% valign=top>");
if($interfaces['total']) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>
<p class=sectionhead>Total Traffic</p>" . device_traffic_image($device['device_id'], 490, 100, $day, $now) . "</div>");
<p class=sectionhead>Total Traffic</p>" . device_traffic_image($device['device_id'], 490, 100, $day, '-300s') . "</div>");
}
if($interfaces['total']) {

View File

@@ -1,13 +1,13 @@
<?
if($search) {
$query = "SELECT * FROM `syslog` WHERE `host` = '" . $_GET['id'] . "' AND `msg` LIKE '%" . $_POST['search'] . "%' ORDER BY `seq` desc";
} else {
$query = "SELECT * FROM `syslog` WHERE `host` = '" . $_GET['id'] . "' ORDER BY `seq` desc LIMIT 0,500";
}
$query = "SELECT *, DATE(datetime) AS date, TIME(datetime) AS time ";
$query .= "FROM `syslog` WHERE `host` = '" . $_GET['id'] . "'";
if($search) { $query .= " AND `msg` LIKE '%" . $_POST['search'] . "%'"; }
$query .= " ORDER BY `datetime` desc LIMIT 0,500";
$data = mysql_query($query);
echo("<div align=right><form id='form1' name='form1' method='post' action='" . $_SERVER['REQUEST_URI'] . "'>
<label>
<input type='text' name='search' id='search' />
@@ -18,10 +18,9 @@ echo("<div align=right><form id='form1' name='form1' method='post' action='" . $
echo("<table cellspacing=0 cellpadding=2 width=100%>");
while($entry = mysql_fetch_array($data)) {
include("includes/print-syslog.inc");
include("includes/print-syslog.inc");
}
echo("</table>");
?>
?>

View File

@@ -1,21 +1,23 @@
<?php
if($_GET['location']) { $where = "WHERE location = '$_GET[location]'"; }
if($_GET['location'] == "Unset") { $where = "WHERE location = ''"; }
if($_GET['type']) { $where = "WHERE type = '$_GET[type]'"; }
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 $where ORDER BY `ignore`, `status`, `os`, `hostname`";
if($_GET['status'] == "alerted") { $sql = "select * from devices " . $device_alert_sql . " GROUP BY `device_id` ORDER BY `ignore`, `status`, `os`, `hostname`"; }
$sql = "select * from devices WHERE 1 $where ORDER BY `ignore`, `status`, `os`, `hostname`";
if($_GET['status'] == "alerted") {
$sql = "select * from devices " . $device_alert_sql . " GROUP BY `device_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 `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] ."' AND `attrib_type` = 'uptime'"), 0);
include("includes/hostbox.inc");
if( devicepermitted($device['device_id']) || $_SESSION['userlevel'] == 10 ) {
$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");
}
}
echo("</table>");

View File

@@ -1,6 +1,11 @@
<?
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,250";
if($_SESSION['userlevel'] == '10') {
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,250";
} else {
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host = P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,250";
}
$data = mysql_query($query);

View File

@@ -1,6 +1,11 @@
<?php
$sql = "SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id ORDER BY D.hostname, I.ifDescr";
if ($_SESSION['userlevel'] == '10') {
$sql = "SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id ORDER BY D.hostname, I.ifDescr";
} else {
$sql = "SELECT * FROM `interfaces` AS I, `devices` AS D, `devices_perms` AS P WHERE I.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, I.ifDescr";
}
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>");
@@ -16,9 +21,14 @@ while($interface = mysql_fetch_array($query)) {
$speed = humanspeed($interface['ifSpeed']);
$type = humanmedia($interface['ifType']);
if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
$error_img = generateiflink($interface,"<img src='/images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
} else { $error_img = ""; }
echo("<tr bgcolor=$row_colour>
<td class=list-bold>" . generatedevicelink($interface) . "</td>
<td class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . "</td>
<td class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " $error_img</td>
<td>$speed</td>
<td>$type</td>
<td>" . $interface[ifAlias] . "</td>

View File

@@ -1,17 +1,32 @@
<?
echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
$device_query = mysql_query("select location from devices GROUP BY location ORDER BY location");
if($_SESSION['userlevel'] == '10') {
$sql = "SELECT `location` FROM `devices` GROUP BY `location` ORDER BY `location`";
} else {
$sql = "SELECT `location` FROM `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' GROUP BY `location` ORDER BY `location`";
}
$device_query = mysql_query($sql);
while($device = mysql_fetch_array($device_query)) {
if($bg == "#ffffff") { $bg = "#eeeeee"; } else { $bg="#ffffff"; }
$num = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '$device[location]'"),0);
$net = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '$device[location]' AND type = 'network'"),0);
$srv = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '$device[location]' AND type = 'server'"),0);
$fwl = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '$device[location]' AND type = 'firewall'"),0);
if($_SESSION['userlevel'] == '10') {
$num = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "'"),0);
$net = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND type = 'network'"),0);
$srv = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND type = 'server'"),0);
$fwl = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND type = 'firewall'"),0);
$hostalerts = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '" . $device['location'] . "' AND status = '0'"),0);
} else {
$num = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "'"),0);
$net = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "' AND D.type = 'network'"),0);
$srv = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "' AND type = 'server'"),0);
$fwl = mysql_result(mysql_query("SELECT COUNT(D.device_id) FROM devices AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND location = '" . $device['location'] . "' AND type = 'firewall'"),0);
$hostalerts = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices AS D, devices_perms AS P WHERE location = '" . $device['location'] . "' AND status = '0'"),0);
}
$hostalerts = mysql_result(mysql_query("SELECT COUNT(device_id) FROM devices WHERE location = '$device[location]' AND status = '0'"),0);
if($hostalerts) { $alert = "<img src='/images/16/flag_red.png'>"; }
$loc = $device[location];

View File

@@ -1,12 +1,15 @@
<?php
if($_GET['status'] == '0') { $where = " AND service_status = '0'"; }
if($_GET['status'] == '0') { $where = " AND service_status = '0'"; } else { unset ($where); }
echo("<div style='margin: 5px;'><table cellpadding=7 border=0 cellspacing=0 width=100%>");
//echo("<tr class=interface-desc bgcolor='#e5e5e5'><td>Device</td><td>Service</td><td>Status</td><td>Changed</td><td>Checked</td><td>Message</td></tr>");
if ($_SESSION['userlevel'] == '10') {
$host_sql = "SELECT * FROM devices AS D, services AS S WHERE D.device_id = S.service_host GROUP BY D.hostname ORDER BY D.hostname";
} else {
$host_sql = "SELECT * FROM devices AS D, services AS S, devices_perms AS P WHERE D.device_id = S.service_host AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' $where GROUP BY D.hostname ORDER BY D.hostname";
}
$host_query = mysql_query($host_sql);
while($host_data = mysql_fetch_array($host_query)) {
$device_id = $host_data['device_id'];

View File

@@ -1,121 +1,18 @@
<meta http-equiv="refresh" content="60">
<?
$sql = "select *,DATE_FORMAT(datetime, '%D %M %Y %T') as humandate from syslog ORDER BY datetime DESC LIMIT 1000";
echo("
<table cellspacing=0 cellpadding=2>
<tr class=interface align=center>
<td width=4>
</td>
<td>
Time
</td>
<td width=5>
</td>
<td>
Hostname
</td>
<td width=5>
</td>
<td>
Type
</td>
<td width=5>
</td>
<td>
Message
</td>
<td width=10>
</td>
</tr>");
$sql = "select * from syslog ORDER BY datetime DESC LIMIT 1000";
$query = mysql_query($sql);
while($event = mysql_fetch_array($query))
echo("<table cellspacing=0 cellpadding=2 width=100%>");
while($entry = mysql_fetch_array($query))
{
unset($class);
unset($argh);
$event[msg] = preg_replace("/.*%/", "", $event[msg]);
$event[msg] = preg_replace("/[0-9]+:\ /", "", $event[msg]);
$prefix = preg_replace ("/(.+):\ .*/", "\\1", $event[msg]);
$event[msg] = preg_replace ("/.+:\ /", "", $event[msg]);
if($prefix == $event[msg]) { unset ($prefix); }
$prefix = str_replace("CRYPTO-4-RECVD_PKT_INV_SPI: decaps", "Crypto Invalid SPI", $prefix);
$prefix = str_replace("LINEPROTO-5-UPDOWN", "Lineproto Up/Down", $prefix);
$prefix = str_replace("LINK-3-UPDOWN", "Link Up/Down", $prefix);
$prefix = str_replace("LINEPROTO-SP-5-UPDOWN", "Lineproto Up/Down", $prefix);
$prefix = str_replace("LINK-SP-3-UPDOWN", "Link Up/Down", $prefix);
$prefix = str_replace("PIM-6-INVALID_RP_JOIN", "PIM Invalid RP Join", $prefix);
$prefix = str_replace("BGP-3-NOTIFICATION", "BGP Notification", $prefix);
$prefix = str_replace("LINK-3-UPDOWN", "Link Up/Down", $prefix);
$prefix = str_replace("DIALER-6-UNBIND", "Dialer Unbound", $prefix);
$prefix = str_replace("DIALER-6-BIND", "Dialer Bound", $prefix);
$prefix = str_replace("SYS-5-CONFIG_I", "System Configured", $prefix);
$prefix = str_replace("VPDN-6-CLOSED", "VPDN Closed", $prefix);
$prefix = str_replace("DIALER-6-BIND", "Dialer Bound", $prefix);
$prefix = str_replace("PCMCIAFS-5-DIBERR", "PCMCIA FS Error", $prefix);
$prefix = str_replace("BGP-5-ADJCHANGE", "BGP Adj Change", $prefix);
$prefix = str_replace("MSDP-5-PEER_UPDOWN", "MSDP Peer UP/Down", $prefix);
$prefix = str_replace("SYS-5-CONFIG_I", "System Configured", $prefix);
$prefix = preg_replace("/.*ETHER-3-UNDERFLO/", "Ethernet Underflow", $prefix);
if(strstr($event[msg], "BGP authentication failure") !== false) { $class = "pinkbg"; }
if(strstr($event[msg], "Down BGP Notification received") !== false) { $class = "redbg"; }
if(strstr($event[msg], "DOWN on interface") !== false) { $class = "redbg"; }
if(strstr($event[msg], "from FULL to DOWN") !== false) { $class = "redbg"; }
if(strstr($event[msg], "changed state to down") !== false) { $class = "redbg"; }
if(strstr($event[msg], "(cease)") !== false) { $class = "redbg"; }
if(strstr($event[msg], "(hold time expired)") !== false) { $class = "redbg"; }
if(strstr($event[msg], "Configured from console") !== false) { $class = "bluebg"; }
if(strstr($event[msg], "DR change ") !== false) { $class = "bluebg"; }
if(strstr($event[msg], "Up") !== false) { $class = "greenbg"; }
if(strstr($event[msg], "from LOADING to FULL") !== false) { $class = "greenbg"; }
if(strstr($event[msg], "UP on interface ") !== false) { $class = "greenbg"; }
if(strstr($event[msg], "changed state to up") !== false) { $class = "greenbg"; }
if(strstr($event[msg], "A format in this router is required") !== false) { $class = "greybg"; }
if(strstr($event[msg], "bytes failed from") !== false) { $class = "greybg"; }
if($event[msg] == "Attempted to connect to RSHELL from 195.74.96.24" ) { $argh = 1; }
$event[msg] = str_replace("PCMCIA disk 0 is formatted from a different router or PC. A format in this router is required before an image can be booted from this device", "PCMCIA diak 0 is incorrectly formatted", $event[msg]);
if(!$argh) {
echo ("
<tr class='$class'>
<td width=4>
</td>
<td class=syslog>
$event[humandate]
</td>
<td width=5>
</td>
<td class=syslog>
$event[host]
</td>
<td width=5>
</td>
<td class=syslog>
$prefix
</td>
<td width=5>
</td>
<td class=syslog>
$event[msg]
</td>
<td width=4>
</td>
</tr>
");
include("includes/print-syslog.inc");
}
}
echo("</table>");
?>
</table>

View File

@@ -1,6 +1,11 @@
<?php
$sql = "SELECT * FROM `temperature` AS T, `devices` AS D WHERE T.temp_host = D.device_id ORDER BY D.hostname, T.temp_descr";
if($_SESSION['userlevel'] == '10') {
$sql = "SELECT * FROM `temperature` AS T, `devices` AS D WHERE T.temp_host = D.device_id ORDER BY D.hostname, T.temp_descr";
} else {
$sql = "SELECT * FROM `temperature` AS T, `devices` AS D, devices_perms as P WHERE T.temp_host = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, T.temp_descr";
}
$query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>");
@@ -28,11 +33,15 @@ while($temp = mysql_fetch_array($query)) {
" . $temp['temp_descr'] . "</a> ";
$temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
$temp_colour = percent_colour($temp_perc);
echo("<tr bgcolor=$row_colour>
<td class=list-bold>" . generatedevicelink($temp) . "</td>
<td>$temp_popup</td>
<td>" . print_temperature($temp['temp_current'], $temp['temp_limit']) . "</td>
<td style='color: $temp_colour; font-weight: bold;'>" . $temp['temp_current'] . "</td>
<td>" . $temp['temp_limit'] . "</td>
<td>" . $temp['temp_notes'] . "</td>
</tr>\n");