mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Changes!
git-svn-id: http://www.observium.org/svn/observer/trunk@117 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -9,3 +9,4 @@ RewriteCond %{REQUEST_URI} !^(.*)\.gif$
|
|||||||
RewriteCond %{REQUEST_URI} !^(.*)\.png$
|
RewriteCond %{REQUEST_URI} !^(.*)\.png$
|
||||||
|
|
||||||
RewriteRule ^([a-z]+)$ ?page=$1
|
RewriteRule ^([a-z]+)$ ?page=$1
|
||||||
|
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
# ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
# ini_set('display_startup_errors', 1);
|
ini_set('display_startup_errors', 1);
|
||||||
# ini_set('log_errors', 1);
|
ini_set('log_errors', 1);
|
||||||
ini_set('allow_url_fopen', 0);
|
ini_set('allow_url_fopen', 0);
|
||||||
# ini_set('error_reporting', E_ALL);
|
# ini_set('error_reporting', E_ALL);
|
||||||
|
|
||||||
@@ -31,12 +31,15 @@
|
|||||||
|
|
||||||
$type = $_GET['type'];
|
$type = $_GET['type'];
|
||||||
|
|
||||||
$graphfile = $hostname . ".". $ifIndex . "-" . $type . ".png";
|
$graphfile = strgen() . ".png";
|
||||||
|
|
||||||
$os = gethostosbyid($device_id);
|
$os = gethostosbyid($device_id);
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
|
||||||
|
case 'multi_bits':
|
||||||
|
$graph = graph_multi_bits ($_GET['interfaces'], $graphfile, $from, $to, $width, $height);
|
||||||
|
break;
|
||||||
case 'global_bits':
|
case 'global_bits':
|
||||||
$graph = graph_global_bits ("global_bits.png", $from, $to, $width, $height);
|
$graph = graph_global_bits ("global_bits.png", $from, $to, $width, $height);
|
||||||
break;
|
break;
|
||||||
@@ -137,10 +140,12 @@
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'postfix':
|
case 'postfix':
|
||||||
|
case 'mail':
|
||||||
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
|
||||||
$graph = mailsgraphUnix ($hostname . "-mail.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
$graph = mailsgraphUnix ($hostname . "-mailstats.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'mailerrors':
|
||||||
case 'postfixerrors':
|
case 'postfixerrors':
|
||||||
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
|
||||||
$graph = mailerrorgraphUnix ($hostname, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
$graph = mailerrorgraphUnix ($hostname, $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
@@ -148,7 +153,7 @@
|
|||||||
break;
|
break;
|
||||||
case 'courier':
|
case 'courier':
|
||||||
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
|
if($os == "Linux" || $os == "FreeBSD" || $os == "DragonFly" || $os == "OpenBSD") {
|
||||||
$graph = couriergraphUnix ($hostname . "-courier.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
$graph = couriergraphUnix ($hostname . "-courierstats.rrd", $graphfile, $from, $to, $width, $height, $title, $vertical);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'apachehits':
|
case 'apachehits':
|
||||||
@@ -165,9 +170,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($graph) {
|
if($graph) {
|
||||||
|
header('Content-type: image/png');
|
||||||
echo(`cat graphs/$graphfile`);
|
echo(`cat graphs/$graphfile`);
|
||||||
} else {
|
} else {
|
||||||
# echo(`cat images/no-graph.png`);
|
header('Content-type: image/png');
|
||||||
|
echo(`cat images/no-graph.png`);
|
||||||
}
|
}
|
||||||
|
|
||||||
$delete = `rm graphs/$graphfile`;
|
$delete = `rm graphs/$graphfile`;
|
||||||
|
@@ -15,14 +15,13 @@ if($_GET['logout']) {
|
|||||||
if($_POST['username'] && $_POST['password']){
|
if($_POST['username'] && $_POST['password']){
|
||||||
$_SESSION['username']=$_POST['username'];
|
$_SESSION['username']=$_POST['username'];
|
||||||
$_SESSION['password']=$_POST['password'];
|
$_SESSION['password']=$_POST['password'];
|
||||||
$password = $_SESSION['password'];
|
$_SESSION['encrypted'] = md5($_SESSION['password']);
|
||||||
$encrypted = md5($password);
|
|
||||||
} elseif($_COOKIE['username'] && $_COOKIE['encrypted'] && !$_SESSION['authenticated']) {
|
} elseif($_COOKIE['username'] && $_COOKIE['encrypted'] && !$_SESSION['authenticated']) {
|
||||||
$_SESSION['username']=$_COOKIE['username'];
|
$_SESSION['username']=$_COOKIE['username'];
|
||||||
$encrypted=$_COOKIE['encrypted'];
|
$_SESSION['encrypted']=$_COOKIE['encrypted'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "select username, level, user_id from users where username='$_SESSION[username]' and password='$encrypted'";
|
$sql = "select username, level, user_id from users where username='" . $_SESSION['username'] . "' and password='" . $_SESSION['encrypted'] . "'";
|
||||||
$row = mysql_fetch_row(mysql_query($sql));
|
$row = mysql_fetch_row(mysql_query($sql));
|
||||||
|
|
||||||
if ( $_SESSION['username'] != "" && $row[0] == $_SESSION['username'] ) {
|
if ( $_SESSION['username'] != "" && $row[0] == $_SESSION['username'] ) {
|
||||||
|
@@ -5,8 +5,9 @@
|
|||||||
$temp = $_POST['temp'];
|
$temp = $_POST['temp'];
|
||||||
$ignore = $_POST['ignore'];
|
$ignore = $_POST['ignore'];
|
||||||
$type = $_POST['type'];
|
$type = $_POST['type'];
|
||||||
|
$disabled = $_POST['disabled'];
|
||||||
|
|
||||||
$sql = "UPDATE `devices` SET `purpose` = '$descr', `apache` = '$apache', `type` = '$type', `ignore` = '$ignore' WHERE `device_id` = '$_GET[id]'";
|
$sql = "UPDATE `devices` SET `purpose` = '$descr', `apache` = '$apache', `type` = '$type', `ignore` = '$ignore', `disabled` = '$disabled' WHERE `device_id` = '$_GET[id]'";
|
||||||
$query = mysql_query($sql);
|
$query = mysql_query($sql);
|
||||||
|
|
||||||
$rows_updated = mysql_affected_rows();
|
$rows_updated = mysql_affected_rows();
|
||||||
|
@@ -12,13 +12,13 @@
|
|||||||
$yearly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
$yearly_traffic = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
||||||
$yearly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
$yearly_url = "graph.php?host=" . $device['device_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
||||||
|
|
||||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||||
<img src='$daily_traffic' border=0></a> ");
|
<img src='$daily_traffic' border=0></a> ");
|
||||||
echo("<a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
echo("<a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||||
<img src='$weekly_traffic' border=0></a> ");
|
<img src='$weekly_traffic' border=0></a> ");
|
||||||
echo("<a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
echo("<a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||||
<img src='$monthly_traffic' border=0></a> ");
|
<img src='$monthly_traffic' border=0></a> ");
|
||||||
echo("<a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
echo("<a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||||
<img src='$yearly_traffic' border=0></a>");
|
<img src='$yearly_traffic' border=0></a>");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -15,15 +15,15 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
|
|||||||
echo("<tr style=\"background-color: $bg\">
|
echo("<tr style=\"background-color: $bg\">
|
||||||
<td width=0></td>
|
<td width=0></td>
|
||||||
<td class=syslog width=140>
|
<td class=syslog width=140>
|
||||||
$entry[humandate]
|
".$entry['humandate']."
|
||||||
</td>");
|
</td>");
|
||||||
$if['interface_id'] = $entry[interface];
|
$if['interface_id'] = $entry['interface'];
|
||||||
$if['ifDescr'] = makeshortif($interface);
|
$if['ifDescr'] = makeshortif($interface);
|
||||||
echo("<td class=list-bold width=75>
|
echo("<td class=list-bold width=75>
|
||||||
" . generateiflink($if) . "
|
" . generateiflink($if) . "
|
||||||
</td>
|
</td>
|
||||||
<td class=syslog>" .
|
<td class=syslog>" .
|
||||||
truncate($entry[message], 45)
|
htmlspecialchars(truncate($entry['message'], 45))
|
||||||
. "</td>
|
. "</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>");
|
</tr>");
|
||||||
|
@@ -35,7 +35,7 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
|
|||||||
echo("</td>
|
echo("</td>
|
||||||
<td width=20>$icon</td>
|
<td width=20>$icon</td>
|
||||||
<td class=syslog>
|
<td class=syslog>
|
||||||
" . $entry['message'] . "
|
" . htmlspecialchars($entry['message']) . "
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>");
|
</tr>");
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
global $config;
|
||||||
|
|
||||||
if(!$graph_type) { $graph_type = $_GET['type']; }
|
if(!$graph_type) { $graph_type = $_GET['type']; }
|
||||||
|
|
||||||
$daily_traffic = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=217&height=100";
|
$daily_traffic = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=217&height=100";
|
||||||
@@ -14,13 +16,13 @@
|
|||||||
$yearly_traffic = "graph.php?if=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=217&height=100";
|
$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";
|
$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();\">
|
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||||
<img src='$daily_traffic' border=0></a> ");
|
<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();\">
|
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
|
||||||
<img src='$weekly_traffic' border=0></a> ");
|
<img src='$weekly_traffic' border=0></a> ");
|
||||||
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT, BORDER, 0, WIDTH, 350);\" onmouseout=\"return nd();\">
|
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
|
||||||
<img src='$monthly_traffic' border=0></a> ");
|
<img src='$monthly_traffic' border=0></a> ");
|
||||||
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT, BORDER, 0, WIDTH, 350);\" onmouseout=\"return nd();\">
|
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
|
||||||
<img src='$yearly_traffic' border=0></a>");
|
<img src='$yearly_traffic' border=0></a>");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -117,12 +117,8 @@ echo("</td>");
|
|||||||
// If we're showing graphs, generate the graph and print the img tags
|
// If we're showing graphs, generate the graph and print the img tags
|
||||||
if($dographs && is_file("rrd/" . $hostname . ".". $ifIndex . ".rrd")) {
|
if($dographs && is_file("rrd/" . $hostname . ".". $ifIndex . ".rrd")) {
|
||||||
|
|
||||||
$type = $_GET['type'];
|
$type = $_GET['type'];
|
||||||
|
|
||||||
# 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_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";
|
$daily_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$day&to=$now&width=500&height=150";
|
||||||
|
|
||||||
@@ -137,23 +133,19 @@ echo("</td>");
|
|||||||
|
|
||||||
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=3>");
|
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);\"
|
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\"
|
||||||
onmouseout=\"return nd();\"> <img src='$daily_traffic' border=0></a>");
|
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);\"
|
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT".$config['overlib_defaults'].");\"
|
||||||
onmouseout=\"return nd();\"> <img src='$weekly_traffic' border=0></a>");
|
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);\"
|
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT, WIDTH, 350".$config['overlib_defaults'].");\"
|
||||||
onmouseout=\"return nd();\"> <img src='$monthly_traffic' border=0></a>");
|
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);\"
|
echo("<a href='?page=interface&id=" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT, WIDTH, 350".$config['overlib_defaults'].");\"
|
||||||
onmouseout=\"return nd();\"> <img src='$yearly_traffic' border=0></a>");
|
onmouseout=\"return nd();\"> <img src='$yearly_traffic' border=0></a>");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo("</td></tr>");
|
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>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@
|
|||||||
echo(" <li><hr width=140 /></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>");
|
<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') {
|
if($_SESSION['userlevel'] >= '10') {
|
||||||
echo("
|
echo("
|
||||||
<li><hr width=140 /></li>
|
<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=addhost'><img src='/images/16/server_add.png' border=0 align=absmiddle> Add Device</a></li>
|
||||||
@@ -80,7 +80,7 @@ echo(" <li><hr width=140 /></li>
|
|||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if($_SESSION['userlevel'] > '5') {
|
if($_SESSION['userlevel'] >= '10') {
|
||||||
echo("
|
echo("
|
||||||
|
|
||||||
<li><hr width=140 /></li>
|
<li><hr width=140 /></li>
|
||||||
@@ -105,11 +105,14 @@ if($_SESSION['userlevel'] > '5') {
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($_SESSION['userlevel'] > '5') {
|
if($_SESSION['userlevel'] >= '5') {
|
||||||
echo("<li><hr width=140 /></li>");
|
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_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_l2tp) { echo("<li><a href='?page=iftype&type=l2tp'><img src='/images/16/user.png'border=0 align=absmiddle> L2TP</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_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_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($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;}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +140,7 @@ echo("<li><a href='?page=interfaces&status=0'><img src='/images/16/link_error.pn
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="?page=preferences"><img src='/images/16/wrench_orange.png' border=0 align=absmiddle> My Settings</a></li>
|
<li><a href="?page=preferences"><img src='/images/16/wrench_orange.png' border=0 align=absmiddle> My Settings</a></li>
|
||||||
<li><a href="?page=preferences"><img src='/images/16/key.png' border=0 align=absmiddle> Change Password</a></li>
|
<li><a href="?page=preferences"><img src='/images/16/key.png' border=0 align=absmiddle> Change Password</a></li>
|
||||||
<?php if($userlevel == '10') {
|
<?php if($_SESSION['userlevel'] >= '10') {
|
||||||
echo("
|
echo("
|
||||||
<li><hr /></li>
|
<li><hr /></li>
|
||||||
<li><a href='?page=settings'><img src='/images/16/report.png' border=0 align=absmiddle> System Settings</a></li>
|
<li><a href='?page=settings'><img src='/images/16/report.png' border=0 align=absmiddle> System Settings</a></li>
|
||||||
|
@@ -29,7 +29,7 @@ if($device_id) {
|
|||||||
if(!$samehost) {
|
if(!$samehost) {
|
||||||
$device['device_id'] = $device_id;
|
$device['device_id'] = $device_id;
|
||||||
$device['hostname'] = $device_hostname;
|
$device['hostname'] = $device_hostname;
|
||||||
echo("<td valign=top width=200><span style='font-weight:bold;'>" . generatedevicelink($device) . "</span></td>");
|
echo("<td valign=top width=250><span style='font-weight:bold;'>" . generatedevicelink($device) . "</span></td>");
|
||||||
} else {
|
} else {
|
||||||
echo("<td></td>");
|
echo("<td></td>");
|
||||||
}
|
}
|
||||||
|
@@ -27,9 +27,7 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
|
|||||||
|
|
||||||
echo($entry['datetime'] . "
|
echo($entry['datetime'] . "
|
||||||
</td>
|
</td>
|
||||||
<td class=syslog width=100>
|
<td class=syslog width=200>
|
||||||
" . $entry['priority'] . "
|
|
||||||
<br />
|
|
||||||
" . $entry['program'] . "
|
" . $entry['program'] . "
|
||||||
</td>
|
</td>
|
||||||
<td class=syslog>
|
<td class=syslog>
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
if($_SESSION['userlevel'] >= '5') {
|
||||||
|
|
||||||
$devices['count'] = mysql_result(mysql_query("SELECT count(*) FROM devices"),0);
|
$devices['count'] = mysql_result(mysql_query("SELECT count(*) FROM devices"),0);
|
||||||
$devices['up'] = mysql_result(mysql_query("SELECT count(*) FROM devices WHERE status = '1' AND `ignore` = '0'"),0);
|
$devices['up'] = mysql_result(mysql_query("SELECT count(*) FROM devices WHERE status = '1' AND `ignore` = '0'"),0);
|
||||||
$devices['down'] = mysql_result(mysql_query("SELECT count(*) FROM devices WHERE status = '0' AND `ignore` = '0'"),0);
|
$devices['down'] = mysql_result(mysql_query("SELECT count(*) FROM devices WHERE status = '0' AND `ignore` = '0'"),0);
|
||||||
@@ -15,12 +17,29 @@ $services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM servic
|
|||||||
$services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0' AND service_ignore = '0'"),0);
|
$services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0' AND service_ignore = '0'"),0);
|
||||||
$services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_ignore = '1'"),0);
|
$services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_ignore = '1'"),0);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$devices['count'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id"),0);
|
||||||
|
$devices['up'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND D.status = '1' AND D.ignore = '0'"),0);
|
||||||
|
$devices['down'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND D.status = '0' AND D.ignore = '0'"),0);
|
||||||
|
$devices['disabled'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND D.ignore = '1'"),0);
|
||||||
|
|
||||||
|
$interfaces['count'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id"),0);
|
||||||
|
$interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'up'"),0);
|
||||||
|
$interfaces['down'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0);
|
||||||
|
$interfaces['disabled'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifAdminStatus = 'down'"),0);
|
||||||
|
|
||||||
|
$services['count'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id"),0);
|
||||||
|
$services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id AND service_status = '1' AND service_ignore ='0'"),0);
|
||||||
|
$services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id AND service_status = '0' AND service_ignore = '0'"),0);
|
||||||
|
$services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id AND service_ignore = '1'"),0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if($devices['down']) { $devices['bgcolour'] = "#ffcccc"; } else { $devices['bgcolour'] = ""; }
|
if($devices['down']) { $devices['bgcolour'] = "#ffcccc"; } else { $devices['bgcolour'] = ""; }
|
||||||
if($interfaces['down']) { $interfaces['bgcolour'] = "#ffcccc"; } else { $interfaces['bgcolour'] = "#e5e5e5"; }
|
if($interfaces['down']) { $interfaces['bgcolour'] = "#ffcccc"; } else { $interfaces['bgcolour'] = "#e5e5e5"; }
|
||||||
if($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['bgcolour'] = ""; }
|
if($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['bgcolour'] = ""; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -30,7 +30,9 @@ if($_GET[debug]) {
|
|||||||
<!-- <meta http-equiv="refresh" content="300"> -->
|
<!-- <meta http-equiv="refresh" content="300"> -->
|
||||||
<link href="<?php echo($stylesheet); ?>" rel="stylesheet" type="text/css">
|
<link href="<?php echo($stylesheet); ?>" rel="stylesheet" type="text/css">
|
||||||
<link rel="shortcut icon" href="<?php echo($favicon); ?>" />
|
<link rel="shortcut icon" href="<?php echo($favicon); ?>" />
|
||||||
|
<link rel="stylesheet" href="css/mktree.css" type="text/css">
|
||||||
</head>
|
</head>
|
||||||
|
<script type="text/javascript" src="js/mktree.js"></script>
|
||||||
<SCRIPT LANGUAGE="JavaScript">
|
<SCRIPT LANGUAGE="JavaScript">
|
||||||
<!-- Begin
|
<!-- Begin
|
||||||
function popUp(URL) {
|
function popUp(URL) {
|
||||||
@@ -105,10 +107,11 @@ function popUp(URL) {
|
|||||||
$end = utime(); $run = $end - $start;
|
$end = utime(); $run = $end - $start;
|
||||||
$gentime = substr($run, 0, 5);
|
$gentime = substr($run, 0, 5);
|
||||||
echo("<br /> <center>Generated in $gentime seconds
|
echo("<br /> <center>Generated in $gentime seconds
|
||||||
<br /> <a href='http://www.project-observer.org'>Project Observer $observer_version</a> © 2006-2007 Adam Armstrong
|
<br /> <a href='http://www.project-observer.org'>Project Observer " . $config['version'] . "</a> © 2006-2007 Adam Armstrong");
|
||||||
<br /> Development Sponsored by <a href='http://www.vostron.net'>Vostron</a>.");
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
@@ -7,7 +7,6 @@ exit;
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if($_POST['hostname'] && $_POST['community']) {
|
if($_POST['hostname'] && $_POST['community']) {
|
||||||
if($_SESSION['userlevel'] > '5') {
|
if($_SESSION['userlevel'] > '5') {
|
||||||
$hostname = $_POST['hostname'];
|
$hostname = $_POST['hostname'];
|
||||||
|
@@ -5,7 +5,7 @@ if($_SESSION['userlevel'] < '10') {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if($_POST['addsrv']) {
|
if($_POST['addsrv']) {
|
||||||
if($userlevel == '10') {
|
if($_SESSION['userlevel'] == '10') {
|
||||||
include("includes/add-srv.inc");
|
include("includes/add-srv.inc");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ if ($handle = opendir($installdir . "/includes/services/")) {
|
|||||||
|
|
||||||
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
|
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
|
||||||
while($device = mysql_fetch_array($query)) {
|
while($device = mysql_fetch_array($query)) {
|
||||||
$devicesform .= "<option value='" . $device[id] . "'>" . $device['hostname'] . "</option>";
|
$devicesform .= "<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($updated) { print_message("Device Settings Saved"); }
|
if($updated) { print_message("Device Settings Saved"); }
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = "SELECT * FROM `interfaces` AS I, `devices` AS D";
|
$sql = "SELECT * FROM `interfaces` AS I, `devices` AS D";
|
||||||
$sql .= " WHERE `ifAlias` like 'Cust: %' AND I.device_id = D.device_id AND D.hostname LIKE '%" . $mydomain . "' ORDER BY I.ifAlias";
|
$sql .= " WHERE `ifAlias` like 'Cust: %' AND I.device_id = D.device_id AND D.hostname LIKE '%" . $config['mydomain'] . "' ORDER BY I.ifAlias";
|
||||||
$query = mysql_query($sql);
|
$query = mysql_query($sql);
|
||||||
|
|
||||||
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||||
|
@@ -1,20 +1,28 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS U WHERE D.device_id = U.device_id AND U.attrib_type = 'uptime' AND U.attrib_value > '0' AND U.attrib_value < '86400'");
|
<table border=0 cellpadding=10 cellspacing=10 width=100%>
|
||||||
while($device = mysql_fetch_array($sql)){
|
|
||||||
$rebooted[] = "$device[device_id]";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<table border=0 cellpadding=15 cellspacing=10 width=100%>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor=#e5e5e5 width=50% valign=top>
|
<td bgcolor=#e5e5e5 valign=top>
|
||||||
<div class=graphhead>Nodes with Outages</div>
|
<table width=100% border=0><tr><td><div style="margin-bottom: 5px; font-size: 18px; font-weight: bold;">Devices with Alerts</div></td><td width=35 align=center><div class=tablehead>Host</div></td><td align=center width=35><div class=tablehead>Int</div></td><td align=center width=35><div class=tablehead>Srv</div></tr>
|
||||||
<table width=100% border=0><tr><td></td><td width=35 align=center><div class=tablehead>Host</div></td><td align=center width=35><div class=tablehead>Int</div></td><td align=center width=35><div class=tablehead>Srv</div></tr>
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$nodes = array();
|
$nodes = array();
|
||||||
|
|
||||||
|
$sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'");
|
||||||
|
|
||||||
|
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 `devices` WHERE `status` = '0'");
|
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0'");
|
||||||
while($device = mysql_fetch_array($sql)){
|
while($device = mysql_fetch_array($sql)){
|
||||||
unset($already);
|
unset($already);
|
||||||
@@ -68,6 +76,9 @@ foreach($nodes as $node) {
|
|||||||
|
|
||||||
$intlist = array();
|
$intlist = array();
|
||||||
$sql = mysql_query("SELECT `ifDescr`, `ifAlias` FROM interfaces WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND `device_id` = '$node'");
|
$sql = mysql_query("SELECT `ifDescr`, `ifAlias` FROM interfaces WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND `device_id` = '$node'");
|
||||||
|
|
||||||
|
$rebooted = mysql_result(mysql_query("SELECT attrib_value FROM `devices` AS D, `devices_attribs` AS A WHERE D.device_id = '$node' AND D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'"),0);
|
||||||
|
|
||||||
while($int = mysql_fetch_row($sql)) { $intlist[] = "<b>$int[0]</b> - $int[1]"; }
|
while($int = mysql_fetch_row($sql)) { $intlist[] = "<b>$int[0]</b> - $int[1]"; }
|
||||||
foreach ($intlist as $intname) { $intpop .= "$br $intname"; $br = "<br />"; }
|
foreach ($intlist as $intname) { $intpop .= "$br $intname"; $br = "<br />"; }
|
||||||
unset($br);
|
unset($br);
|
||||||
@@ -88,24 +99,103 @@ foreach($nodes as $node) {
|
|||||||
|
|
||||||
if(hoststatus($node)) { $statimg = "<img align=absmiddle src=images/16/lightbulb.png alt='Host Up'>"; }
|
if(hoststatus($node)) { $statimg = "<img align=absmiddle src=images/16/lightbulb.png alt='Host Up'>"; }
|
||||||
else { $statimg = "<img align=absmiddle src=images/16/lightbulb_off.png alt='Host Down'>";}
|
else { $statimg = "<img align=absmiddle src=images/16/lightbulb_off.png alt='Host Down'>";}
|
||||||
|
if($rebooted) { $statimg = "<img align=absmiddle src=images/16/lightning.png alt='Host Rebooted'>"; }
|
||||||
|
|
||||||
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||||
|
|
||||||
|
if(devicepermitted($node)) {
|
||||||
|
|
||||||
echo("<tr bgcolor=$bg>
|
echo("<tr bgcolor=$bg>
|
||||||
<td><a href='?page=device&id=$node' $mouseover>$host</a></td>
|
<td><a href='?page=device&id=$node' $mouseover>$host</a></td>
|
||||||
<td align=center>$statimg</td>
|
<td align=center>$statimg</td>
|
||||||
<td align=center><a $intpop>$ints</a></td>
|
<td align=center><a $intpop>$ints</a></td>
|
||||||
<td align=center><a $srvpop>$services</a></td></tr>");
|
<td align=center><a $srvpop>$services</a></td></tr>");
|
||||||
|
|
||||||
|
}
|
||||||
unset($int, $ints, $intlist, $intpop, $srv, $srvlist, $srvname, $srvpop);
|
unset($int, $ints, $intlist, $intpop, $srv, $srvlist, $srvname, $srvpop);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo("</table>");
|
echo("</table>");
|
||||||
|
|
||||||
|
echo(" </td>
|
||||||
|
<td bgcolor=#e5e5e5 width=400 valign=top>
|
||||||
|
");
|
||||||
|
|
||||||
|
if($_SESSION['userlevel'] >= '5') {
|
||||||
|
echo("
|
||||||
|
<div style='font-size: 18px; font-weight: bold;'>Network Infrastructure Diagram</div>
|
||||||
|
<img style='margin-top: 10px;' src='network.png' alt='Auto-generated network diagram'>
|
||||||
|
");
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
|
||||||
<td bgcolor=#e5e5e5 width=50% valign=top>
|
|
||||||
<div class=graphhead>Network Infrastructure Diagram</div>
|
|
||||||
<img src="network.png" alt="Auto-generated network diagram">
|
|
||||||
</td>
|
</td>
|
||||||
|
<td bgcolor=#e5e5e5 width=275 valign=top>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/// VOSTRON
|
||||||
|
|
||||||
|
if($_SESSION['userlevel'] >= '5') {
|
||||||
|
|
||||||
|
$sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'L2TP: %' AND I.device_id = D.device_id AND D.hostname LIKE '%";
|
||||||
|
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
|
||||||
|
$query = mysql_query($sql);
|
||||||
|
unset ($seperator);
|
||||||
|
while($interface = mysql_fetch_array($query)) {
|
||||||
|
$interfaces['l2tp'] .= $seperator . $interface['interface_id'];
|
||||||
|
$seperator = ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id AND D.hostname LIKE '%";
|
||||||
|
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
|
||||||
|
$query = mysql_query($sql);
|
||||||
|
unset ($seperator);
|
||||||
|
while($interface = mysql_fetch_array($query)) {
|
||||||
|
$interfaces['transit'] .= $seperator . $interface['interface_id'];
|
||||||
|
$seperator = ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Server: thlon-pbx%' AND I.device_id = D.device_id AND D.hostname LIKE '%";
|
||||||
|
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
|
||||||
|
$query = mysql_query($sql);
|
||||||
|
unset ($seperator);
|
||||||
|
while($interface = mysql_fetch_array($query)) {
|
||||||
|
$interfaces['voip'] .= $seperator . $interface['interface_id'];
|
||||||
|
$seperator = ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
if($interfaces['transit']) {
|
||||||
|
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||||
|
"&from=".$day."&to=".$now."&width=400&height=150\'>', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||||
|
"<div style='font-size: 18px; font-weight: bold;'>Internet Transit</div>".
|
||||||
|
"<img src='http://network.vostron.net/graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||||
|
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||||
|
}
|
||||||
|
|
||||||
|
if($interfaces['l2tp']) {
|
||||||
|
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['l2tp'].
|
||||||
|
"&from=".$day."&to=".$now."&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||||
|
"<div style='font-size: 18px; font-weight: bold;'>L2TP ADSL</div>".
|
||||||
|
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['l2tp'].
|
||||||
|
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||||
|
}
|
||||||
|
|
||||||
|
if($interfaces['voip']) {
|
||||||
|
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['voip'].
|
||||||
|
"&from=".$day."&to=".$now."&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||||
|
"<div style='font-size: 18px; font-weight: bold;'>VoIP to PSTN</div>".
|
||||||
|
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['voip'].
|
||||||
|
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// END VOSTRON
|
||||||
|
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
<tr>
|
||||||
|
</tr></table>
|
||||||
|
@@ -5,8 +5,8 @@ if($_SESSION['userlevel'] < 10) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_POST['id'] {
|
if($_POST['id']) {
|
||||||
delHost($id);
|
delHost($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -17,11 +17,11 @@ if($_POST['id'] {
|
|||||||
<p><select name="id">
|
<p><select name="id">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$query = mysql_query("SELECT id,hostname FROM `devices` ORDER BY `hostname`");
|
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
|
||||||
|
|
||||||
while($data = mysql_fetch_array($query)) {
|
while($data = mysql_fetch_array($query)) {
|
||||||
|
|
||||||
echo("<option value='$data[id]'>$data[hostname]</option>");
|
echo("<option value='".$data['device_id']."'>".$data['hostname']."</option>");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ if($_SESSION[userlevel] < '5') {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if($_POST['delsrv']) {
|
if($_POST['delsrv']) {
|
||||||
if($userlevel > "5") {
|
if($_SESSION['userlevel'] > "5") {
|
||||||
include("includes/del-srv.inc");
|
include("includes/del-srv.inc");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
<?
|
<?
|
||||||
|
|
||||||
|
if(devicepermitted($_GET['id'])) {
|
||||||
|
|
||||||
$selected['iface'] = "selected";
|
$selected['iface'] = "selected";
|
||||||
|
|
||||||
if(!$_GET['section']) {
|
if(!$_GET['section']) {
|
||||||
@@ -55,16 +57,40 @@ echo("<li class=" . $select['dev-graphs'] . ">
|
|||||||
</li>
|
</li>
|
||||||
");
|
");
|
||||||
|
|
||||||
|
if(mysql_result(mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."'"), 0) > '0') {
|
||||||
|
|
||||||
|
echo("
|
||||||
|
<li class=" . $select['dev-enyphysical'] . ">
|
||||||
|
<a href='?page=device&id=" . $device['device_id'] . "§ion=dev-entphysical'>
|
||||||
|
<img src='images/16/bricks.png' align=absmiddle border=0> Inventory
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if(mysql_result(mysql_query("select count(temp_id) from temperature WHERE temp_host = '" . $device['device_id'] . "'"), 0) > '0') {
|
if(mysql_result(mysql_query("select count(temp_id) from temperature WHERE temp_host = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||||
echo("
|
echo("
|
||||||
<li class=" . $select['dev-temp'] . ">
|
<li class=" . $select['dev-temp'] . ">
|
||||||
<a href='?page=device&id=" . $device['device_id'] . "§ion=dev-temp'>
|
<a href='?page=device&id=" . $device['device_id'] . "§ion=dev-temp'>
|
||||||
<img src='images/16/weather_sun.png' align=absmiddle border=0> Temps
|
<img src='images/16/flame.png' align=absmiddle border=0> Temps
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mysql_result(mysql_query("select count(storage_id) from storage WHERE host_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||||
|
echo("
|
||||||
|
<li class=" . $select['dev-storage'] . ">
|
||||||
|
<a href='?page=device&id=" . $device['device_id'] . "§ion=dev-storage'>
|
||||||
|
<img src='images/16/database.png' align=absmiddle border=0> Storage
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(mysql_result(mysql_query("select count(service_id) from services WHERE service_host = '" . $device['device_id'] . "'"), 0) > '0') {
|
if(mysql_result(mysql_query("select count(service_id) from services WHERE service_host = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||||
echo("
|
echo("
|
||||||
<li class=" . $select['dev-srv'] . ">
|
<li class=" . $select['dev-srv'] . ">
|
||||||
@@ -90,7 +116,7 @@ echo("
|
|||||||
</li>
|
</li>
|
||||||
");
|
");
|
||||||
|
|
||||||
if($_SESSION[userlevel] > "5") {
|
if($_SESSION[userlevel] >= "5") {
|
||||||
echo("
|
echo("
|
||||||
<li class=" . $select['dev-edit'] . ">
|
<li class=" . $select['dev-edit'] . ">
|
||||||
<a href='?page=device&id=" . $device['device_id'] . "§ion=dev-edit'>
|
<a href='?page=device&id=" . $device['device_id'] . "§ion=dev-edit'>
|
||||||
@@ -110,5 +136,7 @@ include("pages/$page/$section.inc");
|
|||||||
echo("</div>
|
echo("</div>
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else { echo("<span class=alert>You do not have the necessary access permissions to view this device.</span>"); }
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ if($_SESSION['userlevel'] < '5') {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
if($_POST['editing']) {
|
if($_POST['editing']) {
|
||||||
if($userlevel > "5") {
|
if($_SESSION['userlevel'] > "5") {
|
||||||
include("includes/edit-host.inc");
|
include("includes/edit-host.inc");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,8 +19,6 @@ if($updated && $update_message) {
|
|||||||
print_error($update_message);
|
print_error($update_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($device['type'] == 'server') { $server_select = "selected"; }
|
if($device['type'] == 'server') { $server_select = "selected"; }
|
||||||
if($device['type'] == 'network') { $network_select = "selected"; }
|
if($device['type'] == 'network') { $network_select = "selected"; }
|
||||||
if($device['type'] == 'firewall') { $firewall_select = "selected"; }
|
if($device['type'] == 'firewall') { $firewall_select = "selected"; }
|
||||||
@@ -54,12 +52,12 @@ echo("<table cellpadding=0 cellspacing=0><tr><td>
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td width='300'><div align='right'>Disable</div></td>
|
<td width='300'><div align='right'>Disable</div></td>
|
||||||
<td width='300'><input name='disable' type='checkbox' id='disable' value='1'");
|
<td width='300'><input name='disabled' type='checkbox' id='disabled' value='1'");
|
||||||
if($device['disabled']) {echo("checked=checked");}
|
if($device['disabled']) { echo("checked=checked"); }
|
||||||
echo("/></td>
|
echo("/></td>
|
||||||
<td width='300'><div align='right'>Ignore</div></td>
|
<td width='300'><div align='right'>Ignore</div></td>
|
||||||
<td width='300'><input name='ignore' type='checkbox' id='disable' value='1'");
|
<td width='300'><input name='ignore' type='checkbox' id='disable' value='1'");
|
||||||
if($device['ignore']) {echo("checked=checked");}
|
if($device['ignore']) { echo("checked=checked"); }
|
||||||
echo("/></td>
|
echo("/></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
@@ -92,15 +92,15 @@ while($device = mysql_fetch_array($device_query)) {
|
|||||||
$graph_type = "procs"; include ("includes/print-device-graph.php");
|
$graph_type = "procs"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
if($device[postfix] == '1') {
|
if($device[postfix] == '1') {
|
||||||
echo("<div class=graphhead>Postfix Mail Statistics</div>");
|
echo("<div class=graphhead>Postfix Messages</div>");
|
||||||
$graph_type = "postfix"; include ("includes/print-device-graph.php");
|
$graph_type = "postfix"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
echo("<div class=graphhead>Postfix Mail Error Statistics</div>");
|
echo("<div class=graphhead>Postfix Errors</div>");
|
||||||
$graph_type = "postfixerrors"; include ("includes/print-device-graph.php");
|
$graph_type = "postfixerrors"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
}
|
}
|
||||||
if($device[courier] == '1') {
|
if($device[courier] == '1') {
|
||||||
echo("<div class=graphhead>Postfix Mail Statistics</div>");
|
echo("<div class=graphhead>Courier IMAP/POP3</div>");
|
||||||
$graph_type = "courier"; include ("includes/print-device-graph.php");
|
$graph_type = "courier"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
}
|
}
|
||||||
@@ -119,8 +119,8 @@ while($device = mysql_fetch_array($device_query)) {
|
|||||||
case "IOS":
|
case "IOS":
|
||||||
echo("<div class=graphhead>CPU Usage</div>");
|
echo("<div class=graphhead>CPU Usage</div>");
|
||||||
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
||||||
echo("<div class=graphhead>Memory Usage</div>");
|
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
|
echo("<div class=graphhead>Memory Usage</div>");
|
||||||
$graph_type = "mem"; include ("includes/print-device-graph.php");
|
$graph_type = "mem"; include ("includes/print-device-graph.php");
|
||||||
echo("<br />");
|
echo("<br />");
|
||||||
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
|
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '" . $device['device_id'] . "'"),0)) {
|
||||||
|
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
$overview = 1;
|
$overview = 1;
|
||||||
|
|
||||||
$id = $_GET[id];
|
#$id = $_GET['id'];
|
||||||
|
|
||||||
$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '$_GET[id]'"));
|
#$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '$_GET[id]'"));
|
||||||
|
|
||||||
$interfaces['total'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "'"),0);
|
$interfaces['total'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "'"),0);
|
||||||
$interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'up'"),0);
|
$interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'up'"),0);
|
||||||
@@ -45,16 +45,24 @@ if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE host_id
|
|||||||
while($drive = mysql_fetch_array($drives)) {
|
while($drive = mysql_fetch_array($drives)) {
|
||||||
$total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits'];
|
$total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits'];
|
||||||
$used = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
|
$used = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
|
||||||
$perc = round($drive['storage_perc'], 0);
|
$drive['perc'] = round($drive['storage_perc'], 0);
|
||||||
$total = formatStorage($total);
|
$total = formatStorage($total);
|
||||||
$used = formatStorage($used);
|
$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();\"";
|
$fs_url = "?page=device&id=".$device['device_id']."§ion=dev-storage";
|
||||||
|
|
||||||
|
$fs_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr'];
|
||||||
|
$fs_popup .= "</div><img src=\'graph.php?id=" . $drive['storage_id'] . "&type=unixfs&from=$month&to=$now&width=400&height=125\'>";
|
||||||
|
$fs_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
|
||||||
|
|
||||||
if($perc > '80') { $drv_colour='#cc0000'; } else { $drvclass='#0000cc'; }
|
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>
|
echo("<tr><td class=tablehead><a href='".$fs_url."' $fs_popup>" . $drive['hrStorageDescr'] . "</a></td>
|
||||||
</td><td style='font-weight: bold; color: $drv_colour'>" . $perc . "%</td><td>" . $total . "</td><td>" . $used . "</td></tr>");
|
<td><a href='#' $fs_popup><img src='percentage.php?per=" . $drive['perc'] . "'></a></td>
|
||||||
|
<td style='font-weight: bold; color: $drv_colour'>" . $drive['perc'] . "%</td>
|
||||||
|
<td>" . $total . "</td>
|
||||||
|
<td>" . $used . "</td>
|
||||||
|
</tr>");
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
echo("</table>");
|
echo("</table>");
|
||||||
@@ -78,9 +86,14 @@ if(mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE temp_h
|
|||||||
$temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
|
$temp_perc = $temp['temp_current'] / $temp['temp_limit'] * 100;
|
||||||
|
|
||||||
$temp_colour = percent_colour($temp_perc);
|
$temp_colour = percent_colour($temp_perc);
|
||||||
|
$temp_url = "graph.php?id=" . $temp['temp_id'] . "&type=temp&from=$month&to=$now&width=400&height=125";
|
||||||
|
$temp_link = "<a href='?page=device&id=".$device['device_id']."§ion=dev-temp' onmouseover=\"return ";
|
||||||
|
$temp_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$temp['temp_descr'];
|
||||||
|
$temp_link .= "</div><img src=\'$temp_url\'>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
|
||||||
|
$temp_link .= $temp['temp_descr'] . "</a>";
|
||||||
|
|
||||||
$temp['temp_descr'] = truncate($temp['temp_descr'], 25, '');
|
$temp['temp_descr'] = truncate($temp['temp_descr'], 25, '');
|
||||||
echo("<tr bgcolor='$row_colour'><td>" . $temp['temp_descr'] . "</td><td width=40 class=tablehead><span style='color: $temp_colour'>" . $temp['temp_current'] . "°C</span></td></tr>");
|
echo("<tr bgcolor='$row_colour'><td><strong>$temp_link</strong></td><td width=40 class=tablehead><span style='color: $temp_colour'>" . $temp['temp_current'] . "°C</span></td></tr>");
|
||||||
if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
|
if($i == $rows) { echo("</table></td><td valign=top><table width=100% cellspacing=0 cellpadding=2>"); }
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@@ -132,6 +145,7 @@ echo("
|
|||||||
$sql = "SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "'";
|
$sql = "SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "'";
|
||||||
$query = mysql_query($sql);
|
$query = mysql_query($sql);
|
||||||
while($data = mysql_fetch_array($query)) {
|
while($data = mysql_fetch_array($query)) {
|
||||||
|
$data['hostname'] = $device['hostname'];
|
||||||
echo("$ifsep" . generateiflink($data, makeshortif(strtolower($data['ifDescr']))));
|
echo("$ifsep" . generateiflink($data, makeshortif(strtolower($data['ifDescr']))));
|
||||||
$ifsep = ", ";
|
$ifsep = ", ";
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ $device_query = mysql_query($sql);
|
|||||||
echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
||||||
|
|
||||||
while($device = mysql_fetch_array($device_query)) {
|
while($device = mysql_fetch_array($device_query)) {
|
||||||
if( devicepermitted($device['device_id']) || $_SESSION['userlevel'] == 10 ) {
|
if( devicepermitted($device['device_id']) || $_SESSION['userlevel'] >= '5' ) {
|
||||||
$device['uptime'] = @mysql_result(mysql_query("SELECT `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] ."' AND `attrib_type` = 'uptime'"), 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");
|
include("includes/hostbox.inc");
|
||||||
}
|
}
|
||||||
|
@@ -4,23 +4,22 @@ echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
|||||||
|
|
||||||
if($_GET['type']) {
|
if($_GET['type']) {
|
||||||
$type = $_GET['type'];
|
$type = $_GET['type'];
|
||||||
$sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like '$type: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
|
$sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like '$type: %' AND I.device_id = D.device_id AND D.hostname LIKE '%" . $config['mydomain'] . "' ORDER BY I.ifAlias";
|
||||||
$query = mysql_query($sql);
|
$query = mysql_query($sql);
|
||||||
while($data = mysql_fetch_array($query)) {
|
while($interface = mysql_fetch_array($query)) {
|
||||||
$done = "yes";
|
$done = "yes";
|
||||||
unset($class);
|
unset($class);
|
||||||
$data['ifAlias'] = str_replace($type . ": ", "", $data['ifAlias']);
|
$interface['ifAlias'] = str_replace($type . ": ", "", $interface['ifAlias']);
|
||||||
$data['ifAlias'] = str_replace("[PNI]", "Private", $data['ifAlias']);
|
$interface['ifAlias'] = str_replace("[PNI]", "Private", $interface['ifAlias']);
|
||||||
$ifclass = ifclass($data['ifOperStatus'], $data['ifAdminStatus']);
|
$ifclass = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']);
|
||||||
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||||
echo("<tr bgcolor='$bg'>
|
echo("<tr bgcolor='$bg'>
|
||||||
<td><span class=interface><a href='?page=interface&id=" . $data['interface_id'] . "'>" . $data['ifAlias'] . "</a></span><br />
|
<td><span class=list-large>" . generateiflink($interface,$interface['ifAlias']) . "</span><br />
|
||||||
<span class=interface-desc><a href='?page=device&id=" . $data['device_id'] . "'>" . $data['hostname'] . "</a> <a href='?page=interface&id=" . $data['interface_id'] . "'>" . $data['ifDescr'] . "</a></span></td></tr><tr bgcolor='$bg'><td>");
|
<span class=interface-desc>".generatedevicelink($interface)." ".generateiflink($interface)." </span></td></tr><tr bgcolor='$bg'><td>");
|
||||||
|
|
||||||
if(file_exists("rrd/" . $data['hostname'] . "." . $data['ifIndex'] . ".rrd")) {
|
if(file_exists("rrd/" . $interface['hostname'] . "." . $interface['ifIndex'] . ".rrd")) {
|
||||||
|
|
||||||
$graph_type = "bits";
|
$graph_type = "bits";
|
||||||
$iid = $data['interface_id'];
|
|
||||||
include("includes/print-interface-graphs.php");
|
include("includes/print-interface-graphs.php");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ($_SESSION['userlevel'] == '10') {
|
if ($_SESSION['userlevel'] >= '5') {
|
||||||
$sql = "SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id ORDER BY D.hostname, I.ifDescr";
|
$sql = "SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id ORDER BY D.hostname, I.ifDescr";
|
||||||
} else {
|
} 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";
|
$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";
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($_SESSION['userlevel'] == '10') {
|
if($_SESSION['userlevel'] >= '5') {
|
||||||
$sql = "SELECT * FROM `temperature` AS T, `devices` AS D WHERE T.temp_host = D.device_id ORDER BY D.hostname, T.temp_descr";
|
$sql = "SELECT * FROM `temperature` AS T, `devices` AS D WHERE T.temp_host = D.device_id ORDER BY D.hostname, T.temp_descr";
|
||||||
} else {
|
} 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";
|
$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";
|
||||||
|
@@ -1,16 +1,67 @@
|
|||||||
<?php
|
<?php
|
||||||
// returns a PNG graph from the $_GET['per'] variable
|
|
||||||
if(!$_GET['width']) { $width = '201'; } else { $width =$_GET['width']; }
|
if (isset($_GET["dir"])) {
|
||||||
$height = '7';
|
$dir = $_GET["dir"];
|
||||||
$per = imagecreate($width,$height);
|
} else {
|
||||||
$background = imagecolorallocate($per, 0xFF, 0xFF, 0xFF);
|
$dir = "h";
|
||||||
$foreground = imagecolorallocate($per, 0x00, 0x8A, 0x01);
|
};
|
||||||
$border = imagecolorallocate($per, 0x99, 0x99, 0x99);
|
|
||||||
if ($_GET['per'] > 0) {
|
if (isset($_GET["width"])) {
|
||||||
$grad = imagecreatefrompng("images/grad.png");
|
$length = $_GET["width"];
|
||||||
$per2 = imagecopy($per, $grad, 1, 1, 0, 0, ($_GET['per'] * $width / 100), 5);
|
} else {
|
||||||
imagerectangle($per, 0, 0, $width-1, $height-1 , $border);
|
$length = 200;
|
||||||
}
|
};
|
||||||
header("Content-type: image/png");
|
|
||||||
imagepng($per, '', 100);
|
if (isset($_GET["per"])) {
|
||||||
|
$percent = $_GET["per"];
|
||||||
|
} else {
|
||||||
|
$percent = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
//calculate length of percent full
|
||||||
|
$percentlength = round(($percent / 100) * $length);
|
||||||
|
|
||||||
|
//send headers
|
||||||
|
Header("Content-Type: image/png");
|
||||||
|
|
||||||
|
if ($dir == "v") {
|
||||||
|
//create image
|
||||||
|
$image = ImageCreate(6, $length);
|
||||||
|
} else {
|
||||||
|
//dir == h
|
||||||
|
//create image
|
||||||
|
$image = ImageCreate($length, 6);
|
||||||
|
};
|
||||||
|
|
||||||
|
//Make colours
|
||||||
|
$grey = ImageColorAllocate($image, 200, 200, 200);
|
||||||
|
if($percent < '40') {
|
||||||
|
$colour = ImageColorAllocate($image, 0, 128, 0);
|
||||||
|
} elseif($percent < '70') {
|
||||||
|
$colour = ImageColorAllocate($image, 0, 0, 128);
|
||||||
|
} else {
|
||||||
|
$colour = ImageColorAllocate($image, 128, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Fill image with grey
|
||||||
|
ImageFill($image, 0, 0, $grey);
|
||||||
|
|
||||||
|
if ($dir == "v") {
|
||||||
|
//create colour percent bar
|
||||||
|
ImageFilledRectangle($image, 0, $length - $percentlength, 6, $length , $colour);
|
||||||
|
} else {
|
||||||
|
//dir == h
|
||||||
|
//create colour percent bar
|
||||||
|
ImageFilledRectangle($image, 0, 0, $percentlength, 6, $colour);
|
||||||
|
};
|
||||||
|
|
||||||
|
//send picture to browser
|
||||||
|
$border = imagecolorallocate($per, 0x99, 0x99, 0x99);
|
||||||
|
imagerectangle($image, 0, 0, $length, 6, $border);
|
||||||
|
|
||||||
|
ImagePNG($image);
|
||||||
|
|
||||||
|
//clean up image as to not to crash the server
|
||||||
|
@imagedestroy($image);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user