device subpages cleanup, remove dead code

git-svn-id: http://www.observium.org/svn/observer/trunk@1896 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-03-16 23:10:10 +00:00
parent b3dc4c3129
commit 1a477eebbe
57 changed files with 1072 additions and 1061 deletions

View File

@@ -5,10 +5,12 @@ $query = mysql_query("SELECT * FROM `applications` WHERE `device_id` = '".$devic
print_optionbar_start(); print_optionbar_start();
unset($sep); unset($sep);
while($app = mysql_fetch_array($query)) {
while ($app = mysql_fetch_array($query))
{
echo($sep); echo($sep);
if(!$_GET['opta']) { $_GET['opta'] = $app['app_type']; } if (!$_GET['opta']) { $_GET['opta'] = $app['app_type']; }
if ($_GET['opta'] == $app['app_type']) if ($_GET['opta'] == $app['app_type'])
{ {

View File

@@ -1,14 +1,14 @@
<?php <?php
global $config; global $config;
$graphs = array('apache_bytes' => 'Traffic - Bytes/sec', $graphs = array('apache_bytes' => 'Traffic - Bytes/sec',
'apache_hits' => 'Traffic - Hits', 'apache_hits' => 'Traffic - Hits',
'apache_cpu' => 'CPU Utilisation', 'apache_cpu' => 'CPU Utilisation',
'apache_scoreboard' => 'Scoreboard Statistics'); 'apache_scoreboard' => 'Scoreboard Statistics');
foreach($graphs as $key => $text) { foreach ($graphs as $key => $text)
{
$graph_type = "apache_scoreboard"; $graph_type = "apache_scoreboard";
$graph_array['height'] = "100"; $graph_array['height'] = "100";
@@ -21,14 +21,9 @@ foreach($graphs as $key => $text) {
echo("<tr bgcolor='$row_colour'><td colspan=5>"); echo("<tr bgcolor='$row_colour'><td colspan=5>");
include("includes/print-quadgraphs.inc.php"); include("includes/print-quadgraphs.inc.php");
echo("</td></tr>"); echo("</td></tr>");
} }
?> ?>

View File

@@ -23,7 +23,8 @@ $graphs = array('mysql_command_counters' => 'Command Counters',
'mysql_table_locks' => 'Table Locks', 'mysql_table_locks' => 'Table Locks',
'mysql_temporary_objects' => 'Temporary Objects'); 'mysql_temporary_objects' => 'Temporary Objects');
foreach($graphs as $key => $text) { foreach ($graphs as $key => $text)
{
$graph_type = $key; $graph_type = $key;
$graph_array['height'] = "100"; $graph_array['height'] = "100";
$graph_array['width'] = "215"; $graph_array['width'] = "215";
@@ -34,13 +35,8 @@ foreach($graphs as $key => $text) {
echo("<tr bgcolor='$row_colour'><td colspan=5>"); echo("<tr bgcolor='$row_colour'><td colspan=5>");
include("includes/print-quadgraphs.inc.php"); include("includes/print-quadgraphs.inc.php");
echo("</td></tr>"); echo("</td></tr>");
} }
?> ?>

View File

@@ -1,10 +1,12 @@
<?php <?php
global $config; global $config;
$graphs = array('nginx_connections' => 'nginx Connections', $graphs = array('nginx_connections' => 'nginx Connections',
'nginx_req' => 'nginx requests'); 'nginx_req' => 'nginx requests');
foreach($graphs as $key => $text) { foreach ($graphs as $key => $text)
{
$graph_type = $key; $graph_type = $key;
$graph_array['height'] = "100"; $graph_array['height'] = "100";
$graph_array['width'] = "215"; $graph_array['width'] = "215";
@@ -15,13 +17,8 @@ foreach($graphs as $key => $text) {
echo("<tr bgcolor='$row_colour'><td colspan=5>"); echo("<tr bgcolor='$row_colour'><td colspan=5>");
include("includes/print-quadgraphs.inc.php"); include("includes/print-quadgraphs.inc.php");
echo("</td></tr>"); echo("</td></tr>");
} }
?> ?>

View File

@@ -3,18 +3,21 @@
$sql = "SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.interface_id = M.interface_id AND I.device_id = '".$device['device_id']."'"; $sql = "SELECT * FROM ipv4_mac AS M, ports AS I WHERE I.interface_id = M.interface_id AND I.device_id = '".$device['device_id']."'";
$query = mysql_query($sql); $query = mysql_query($sql);
echo("<table border=0 cellspacing=0 cellpadding=5 width=100%>"); echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
$i = "1"; $i = "1";
while($arp = mysql_fetch_array($query)) { while ($arp = mysql_fetch_array($query))
if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } {
if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$arp['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
if($arp_host) { $arp_name = generate_device_link($arp_host); } else { unset($arp_name); } if ($arp_host) { $arp_name = generate_device_link($arp_host); } else { unset($arp_name); }
if($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); } if ($arp_host) { $arp_if = generate_port_link($arp_host); } else { unset($arp_if); }
if($arp_host['device_id'] == $device['device_id']) { $arp_name = "Localhost"; } if ($arp_host['device_id'] == $device['device_id']) { $arp_name = "Localhost"; }
if($arp_host['interface_id'] == $arp['interface_id']) { $arp_if = "Local Port"; } if ($arp_host['interface_id'] == $arp['interface_id']) { $arp_if = "Local Port"; }
echo(" echo("
<tr bgcolor=$bg_colour> <tr bgcolor=$bg_colour>

View File

@@ -30,6 +30,7 @@ print_optionbar_end();
<?php <?php
$i = "1"; $i = "1";
$peer_query = mysql_query("select * from bgpPeers WHERE device_id = '".$device['device_id']."' ORDER BY bgpPeerRemoteAs, bgpPeerIdentifier"); $peer_query = mysql_query("select * from bgpPeers WHERE device_id = '".$device['device_id']."' ORDER BY bgpPeerRemoteAs, bgpPeerIdentifier");
while ($peer = mysql_fetch_assoc($peer_query)) while ($peer = mysql_fetch_assoc($peer_query))
{ {
$has_macaccounting = mysql_result(mysql_query("SELECT COUNT(*) FROM `ipv4_mac` AS I, mac_accounting AS M WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address"),0); $has_macaccounting = mysql_result(mysql_query("SELECT COUNT(*) FROM `ipv4_mac` AS I, mac_accounting AS M WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address"),0);
@@ -106,7 +107,7 @@ while ($peer = mysql_fetch_assoc($peer_query))
if (isset($_GET['opta']) && $_GET['opta'] != "macaccounting") if (isset($_GET['opta']) && $_GET['opta'] != "macaccounting")
{ {
foreach(explode(" ", $_GET['opta']) as $graph_type) foreach (explode(" ", $_GET['opta']) as $graph_type)
{ {
if ($graph_type == "prefixes") { list($afi, $safi) = explode(".", $_GET['optb']); $afisafi = "&afi=$afi&safi=$safi"; } if ($graph_type == "prefixes") { list($afi, $safi) = explode(".", $_GET['optb']); $afisafi = "&afi=$afi&safi=$safi"; }
if ($graph_type == "updates" || $valid_afi_safi[$afi][$safi]) if ($graph_type == "updates" || $valid_afi_safi[$afi][$safi])

View File

@@ -2,25 +2,28 @@
print_optionbar_start(); print_optionbar_start();
unset ($sep); unset ($sep);
$query = mysql_query("SELECT `entSensorType` FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entSensorType != '' AND entSensorType NOT LIKE 'No%' GROUP BY `entSensorType` ORDER BY `entSensorType`"); $query = mysql_query("SELECT `entSensorType` FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entSensorType != '' AND entSensorType NOT LIKE 'No%' GROUP BY `entSensorType` ORDER BY `entSensorType`");
while($data = mysql_fetch_array($query)) { while ($data = mysql_fetch_array($query))
{
$type = $data['entSensorType']; $type = $data['entSensorType'];
if(!$_GET['opta']) { $_GET['opta'] = $type; } if (!$_GET['opta']) { $_GET['opta'] = $type; }
echo($sep); echo($sep);
if($_GET['opta'] == $type) { echo("<strong>"); } if ($_GET['opta'] == $type) { echo("<strong>"); }
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ciscosensors/" . $type . "/'>" . htmlspecialchars($type) ."</a>\n"); echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ciscosensors/" . $type . "/'>" . htmlspecialchars($type) ."</a>\n");
if($_GET['opta'] == $type) { echo("</strong>"); } if ($_GET['opta'] == $type) { echo("</strong>"); }
$sep = ' | '; $sep = ' | ';
} }
unset ($sep);
unset ($sep);
print_optionbar_end(); print_optionbar_end();
$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' and entSensorType = '".$_GET['opta']."' ORDER BY `entPhysicalName`"); $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' and entSensorType = '".$_GET['opta']."' ORDER BY `entPhysicalName`");
while($data = mysql_fetch_array($query)) { while ($data = mysql_fetch_array($query))
{
if($data['entSensorMeasuredEntity']) { if ($data['entSensorMeasuredEntity'])
{
$measured = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '".$data['entSensorMeasuredEntity']."'")); $measured = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '".$data['entSensorMeasuredEntity']."'"));
} }
@@ -31,8 +34,6 @@ print_optionbar_end();
include("includes/print-device-graph.php"); include("includes/print-device-graph.php");
echo("</div>"); echo("</div>");
}
}
?> ?>

View File

@@ -50,11 +50,11 @@ print_optionbar_start();
$plugins = collectd_list_plugins($device['hostname']); $plugins = collectd_list_plugins($device['hostname']);
foreach ($plugins as &$plugin) { foreach ($plugins as &$plugin) {
if(!$_GET['opta']) { $_GET['opta'] = $plugin; } if (!$_GET['opta']) { $_GET['opta'] = $plugin; }
echo($sep); echo($sep);
if($_GET['opta'] == $plugin) { echo("<strong>"); } if ($_GET['opta'] == $plugin) { echo("<strong>"); }
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/collectd/" . $plugin . "/'>" . htmlspecialchars($plugin) ."</a>\n"); echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/collectd/" . $plugin . "/'>" . htmlspecialchars($plugin) ."</a>\n");
if($_GET['opta'] == $plugin) { echo("</strong>"); } if ($_GET['opta'] == $plugin) { echo("</strong>"); }
$sep = ' | '; $sep = ' | ';
} }
unset ($sep); unset ($sep);
@@ -71,17 +71,17 @@ print_optionbar_end();
$typeinstances = collectd_list_tinsts($device['hostname'], $_GET['opta'], $instance, $type); $typeinstances = collectd_list_tinsts($device['hostname'], $_GET['opta'], $instance, $type);
if($MetaGraphDefs[$type]) { $typeinstances = array($MetaGraphDefs[$type]); } if ($MetaGraphDefs[$type]) { $typeinstances = array($MetaGraphDefs[$type]); }
foreach ($typeinstances as &$tinst) { foreach ($typeinstances as &$tinst) {
$i++; $i++;
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
echo('<div style="background-color: '.$row_colour.';">'); echo('<div style="background-color: '.$row_colour.';">');
echo('<div class="graphhead" style="padding:4px 0px 0px 8px;">'); echo('<div class="graphhead" style="padding:4px 0px 0px 8px;">');
if($tinst) { if ($tinst) {
echo($_GET['opta']." $instance - $type - $tinst"); echo($_GET['opta']." $instance - $type - $tinst");
} else { } else {
echo($_GET['opta']." $instance - $type"); echo($_GET['opta']." $instance - $type");

View File

@@ -1,22 +1,22 @@
<?php <?php
if($_SESSION['userlevel'] < '7') { if ($_SESSION['userlevel'] < '7')
{
print_error("Insufficient Privileges"); print_error("Insufficient Privileges");
} else { } else {
$panes = array('device' => 'Device Settings',
$panes = array('device' => 'Device Settings',
'ports' => 'Port Settings', 'ports' => 'Port Settings',
'apps' => 'Applications', 'apps' => 'Applications',
'services' => 'Services', 'services' => 'Services',
'ipmi' => 'IPMI'); 'ipmi' => 'IPMI');
print_optionbar_start(); print_optionbar_start();
unset($sep); unset($sep);
foreach($panes as $type => $text) { foreach ($panes as $type => $text)
{
if(!isset($_GET['opta'])) { $_GET['opta'] = $type; } if (!isset($_GET['opta'])) { $_GET['opta'] = $type; }
echo($sep); echo($sep);
if ($_GET['opta'] == $type) if ($_GET['opta'] == $type)
{ {
@@ -25,18 +25,18 @@ foreach($panes as $type => $text) {
} else { } else {
echo('<img src="images/icons/greyscale/'.$type.'.png" class="optionicon" />'); echo('<img src="images/icons/greyscale/'.$type.'.png" class="optionicon" />');
} }
echo("<a href='".$config['base_url']."/device/".$device['device_id']."/edit/" . $type . ($_GET['optb'] ? "/" . $_GET['optb'] : ''). "/'> " . $text ."</a>\n"); echo("<a href='".$config['base_url']."/device/".$device['device_id']."/edit/" . $type . ($_GET['optb'] ? "/" . $_GET['optb'] : ''). "/'> " . $text ."</a>\n");
if ($_GET['opta'] == $type) { echo("</strong>"); } if ($_GET['opta'] == $type) { echo("</strong>"); }
$sep = " | "; $sep = " | ";
} }
print_optionbar_end(); print_optionbar_end();
if (is_file("pages/device/edit/".mres($_GET['opta']).".inc.php")) if (is_file("pages/device/edit/".mres($_GET['opta']).".inc.php"))
{ {
include("pages/device/edit/".mres($_GET['opta']).".inc.php"); include("pages/device/edit/".mres($_GET['opta']).".inc.php");
} else { }
}
} }
?>

View File

@@ -1,7 +1,9 @@
<?php <?php
if($_POST['editing']) { if ($_POST['editing'])
if($_SESSION['userlevel'] > "7") { {
if ($_SESSION['userlevel'] > "7")
{
include("includes/device-edit.inc.php"); include("includes/device-edit.inc.php");
} }
} }
@@ -9,7 +11,8 @@ if($_POST['editing']) {
$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'")); $device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'"));
$descr = $device['purpose']; $descr = $device['purpose'];
if($updated && $update_message) { if ($updated && $update_message)
{
print_message($update_message); print_message($update_message);
} elseif ($update_message) { } elseif ($update_message) {
print_error($update_message); print_error($update_message);
@@ -53,11 +56,14 @@ echo("<table cellpadding=0 cellspacing=0><tr><td>
<td width='300'><div align='right'>SNMP Transport</div></td> <td width='300'><div align='right'>SNMP Transport</div></td>
<td colspan='3'> <td colspan='3'>
<select name='transport'>"); <select name='transport'>");
foreach ($config['snmp']['transports'] as $transport) {
foreach ($config['snmp']['transports'] as $transport)
{
echo ("<option value='".$transport."'"); echo ("<option value='".$transport."'");
if ($transport == $device['transport']) { echo (" selected='selected'"); } if ($transport == $device['transport']) { echo (" selected='selected'"); }
echo (">".$transport."</option>"); echo (">".$transport."</option>");
} }
echo(" </select> echo(" </select>
</td> </td>
</tr> </tr>
@@ -102,11 +108,11 @@ echo("
<tr> <tr>
<td><div align='right'>Disable</div></td> <td><div align='right'>Disable</div></td>
<td><input name='disabled' type='checkbox' id='disabled' value='1'"); <td><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><div align='right'>Ignore</div></td> <td><div align='right'>Ignore</div></td>
<td><input name='ignore' type='checkbox' id='disable' value='1'"); <td><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>");
@@ -120,5 +126,4 @@ echo('
</td> </td>
<td width="50"></td><td></td></tr></table>'); <td width="50"></td><td></td></tr></table>');
?> ?>

View File

@@ -1,7 +1,9 @@
<?php <?php
if($_POST['editing']) { if ($_POST['editing'])
if($_SESSION['userlevel'] > "7") { {
if ($_SESSION['userlevel'] > "7")
{
include("includes/device-ipmi-edit.inc.php"); include("includes/device-ipmi-edit.inc.php");
} }
} }
@@ -9,7 +11,8 @@ if($_POST['editing']) {
$device = mysql_fetch_assoc(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'")); $device = mysql_fetch_assoc(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'"));
$descr = $device['purpose']; $descr = $device['purpose'];
if($updated && $update_message) { if ($updated && $update_message)
{
print_message($update_message); print_message($update_message);
} elseif ($update_message) { } elseif ($update_message) {
print_error($update_message); print_error($update_message);

View File

@@ -2,14 +2,16 @@
echo('<div style="padding: 10px;">'); echo('<div style="padding: 10px;">');
if($_POST['ignoreport']) { if ($_POST['ignoreport'])
if($_SESSION['userlevel'] == '10') { {
if ($_SESSION['userlevel'] == '10')
{
include("includes/port-edit.inc.php"); include("includes/port-edit.inc.php");
} }
} }
if ($updated && $update_message)
if($updated && $update_message) { {
print_message($update_message); print_message($update_message);
} elseif ($update_message) { } elseif ($update_message) {
print_error($update_message); print_error($update_message);
@@ -23,7 +25,8 @@ echo("<div style='float: left;'>
<tr><th>Port</th><th>ifDescr</th><th>ifAdminStatus</th><th>ifOperStatus</th><th>Ignore</th></tr>"); <tr><th>Port</th><th>ifDescr</th><th>ifAdminStatus</th><th>ifOperStatus</th><th>Ignore</th></tr>");
$query = mysql_query("SELECT * FROM `ports` WHERE device_id='".$device['device_id']."' ORDER BY `ifIndex` "); $query = mysql_query("SELECT * FROM `ports` WHERE device_id='".$device['device_id']."' ORDER BY `ifIndex` ");
while($device = mysql_fetch_array($query)) { while ($device = mysql_fetch_array($query))
{
echo("<tr>"); echo("<tr>");
echo("<td align=right>". $device['ifIndex']."</td>"); echo("<td align=right>". $device['ifIndex']."</td>");
echo("<td align=left>".$device['ifDescr'] . "</td>"); echo("<td align=left>".$device['ifDescr'] . "</td>");

View File

@@ -2,49 +2,53 @@
echo('<div style="padding: 10px;">'); echo('<div style="padding: 10px;">');
if($_POST['addsrv']) { if ($_POST['addsrv']) {
if($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] == '10') {
include("includes/service-add.inc.php"); include("includes/service-add.inc.php");
} }
} }
if($_POST['delsrv']) { if ($_POST['delsrv']) {
if($_SESSION['userlevel'] == '10') { if ($_SESSION['userlevel'] == '10') {
include("includes/service-delete.inc.php"); include("includes/service-delete.inc.php");
} }
} }
if ($handle = opendir($config['install_dir'] . "/includes/services/"))
if ($handle = opendir($config['install_dir'] . "/includes/services/")) { {
while (false !== ($file = readdir($handle))) { while (false !== ($file = readdir($handle)))
if ($file != "." && $file != ".." && !strstr($file, ".")) { {
if ($file != "." && $file != ".." && !strstr($file, "."))
{
$servicesform .= "<option value='$file'>$file</option>"; $servicesform .= "<option value='$file'>$file</option>";
} }
} }
closedir($handle); closedir($handle);
} }
$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['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"); }
if (mysql_result(mysql_query("SELECT COUNT(*) from `services` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0')
if(mysql_result(mysql_query("SELECT COUNT(*) from `services` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0') { {
$i = "1"; $i = "1";
$service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type"); $service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type");
while($service = mysql_fetch_array($service_query)) { while ($service = mysql_fetch_array($service_query))
{
$existform .= "<option value='" . $service['service_id'] . "'>" . $service['service_type'] . "</option>"; $existform .= "<option value='" . $service['service_id'] . "'>" . $service['service_type'] . "</option>";
} }
} }
if($existform){ if($existform
echo('<div style="float: left;">'); {
echo(" echo('<div style="float: left;">');
echo("
<h1>Remove Service</h1> <h1>Remove Service</h1>
@@ -64,12 +68,10 @@ echo("
</tr> </tr>
</table> </table>
<input type='submit' name='Submit' value='Delete' /> <input type='submit' name='Submit' value='Delete' />
<label><br />
</label> </label>
</form>"); </form>");
echo('</div>');
echo('</div>');
} }
echo('<div style="width: 45%; float: right;">'); echo('<div style="width: 45%; float: right;">');
@@ -95,10 +97,7 @@ echo("
<input type='submit' name='Submit' value='Add' /> <input type='submit' name='Submit' value='Add' />
<label><br /> <label><br />
</label> </label>
</form>"); </form>
</div>");
echo('</div>');
echo('</div>');
?> ?>

View File

@@ -1,77 +1,84 @@
<?php <?php
function printEntPhysical($ent, $level, $class) { function printEntPhysical($ent, $level, $class)
{
global $device; global $device;
$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex"); $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex");
while($ent = mysql_fetch_array($query)) { while ($ent = mysql_fetch_array($query))
{
echo(" echo("
<li class='$class'>"); <li class='$class'>");
if($ent['entPhysicalClass'] == "chassis") { echo("<img src='images/16/server.png' style='vertical-align:middle'/> "); } if ($ent['entPhysicalClass'] == "chassis") { echo("<img src='images/16/server.png' style='vertical-align:middle'/> "); }
if($ent['entPhysicalClass'] == "module") { echo("<img src='images/16/drive.png' style='vertical-align:middle'/> "); } if ($ent['entPhysicalClass'] == "module") { echo("<img src='images/16/drive.png' style='vertical-align:middle'/> "); }
if($ent['entPhysicalClass'] == "port") { echo("<img src='images/16/connect.png' style='vertical-align:middle'/> "); } if ($ent['entPhysicalClass'] == "port") { echo("<img src='images/16/connect.png' style='vertical-align:middle'/> "); }
if($ent['entPhysicalClass'] == "container") { echo("<img src='images/16/box.png' style='vertical-align:middle'/> "); } if ($ent['entPhysicalClass'] == "container") { echo("<img src='images/16/box.png' style='vertical-align:middle'/> "); }
if($ent['entPhysicalClass'] == "sensor") { if ($ent['entPhysicalClass'] == "sensor")
{
echo("<img src='images/16/contrast.png' style='vertical-align:middle'/> "); echo("<img src='images/16/contrast.png' style='vertical-align:middle'/> ");
$link = " href='".$config['base_url'] . "/device/".$device['device_id']."/ciscosensors/".$ent['entSensorType']."/' onmouseover=\"return overlib('<img src=\'graph.php?host=49&type=cisco_entity_sensor&from=-2d&to=now&width=400&height=150&a=".$ent['entPhysical_id']."\'><img src=\'graph.php?host=49&type=cisco_entity_sensor&from=-2w&to=now&width=400&height=150&a=".$ent['entPhysical_id']."\'>', LEFT,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\""; $link = " href='".$config['base_url'] . "/device/".$device['device_id']."/ciscosensors/".$ent['entSensorType']."/' onmouseover=\"return overlib('<img src=\'graph.php?host=49&type=cisco_entity_sensor&from=-2d&to=now&width=400&height=150&a=".$ent['entPhysical_id']."\'><img src=\'graph.php?host=49&type=cisco_entity_sensor&from=-2w&to=now&width=400&height=150&a=".$ent['entPhysical_id']."\'>', LEFT,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"";
} else { unset ($link); } } else { unset ($link); }
if($ent['entPhysicalClass'] == "backplane") { echo("<img src='images/16/brick.png' style='vertical-align:middle'/> "); }
if($ent['entPhysicalParentRelPos'] > '-1') {echo("<strong>".$ent['entPhysicalParentRelPos'].".</strong> ");}
if($link) {echo("<a $link>");} if ($ent['entPhysicalClass'] == "backplane") { echo("<img src='images/16/brick.png' style='vertical-align:middle'/> "); }
if ($ent['entPhysicalParentRelPos'] > '-1') {echo("<strong>".$ent['entPhysicalParentRelPos'].".</strong> "); }
if($ent['ifIndex']) { if ($link) {echo("<a $link>"); }
if ($ent['ifIndex'])
{
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'")); $interface = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'"));
$ent['entPhysicalName'] = generate_port_link($interface); $ent['entPhysicalName'] = generate_port_link($interface);
} }
if ($ent['entPhysicalModelName'] && $ent['entPhysicalName']) { if ($ent['entPhysicalModelName'] && $ent['entPhysicalName'])
{
echo("<strong>".$ent['entPhysicalModelName'] . "</strong> (".$ent['entPhysicalName'].")"); echo("<strong>".$ent['entPhysicalModelName'] . "</strong> (".$ent['entPhysicalName'].")");
} elseif($ent['entPhysicalModelName']) { } elseif ($ent['entPhysicalModelName']) {
echo("<strong>".$ent['entPhysicalModelName'] . "</strong>"); echo("<strong>".$ent['entPhysicalModelName'] . "</strong>");
} elseif($ent['entPhysicalName']) { } elseif ($ent['entPhysicalName']) {
echo("<strong>".$ent['entPhysicalName']."</strong>"); echo("<strong>".$ent['entPhysicalName']."</strong>");
} elseif($ent['entPhysicalDescr']) { } elseif ($ent['entPhysicalDescr']) {
echo("<strong>".$ent['entPhysicalDescr']."</strong>"); echo("<strong>".$ent['entPhysicalDescr']."</strong>");
} }
if($ent['entPhysicalClass'] == "sensor") { if ($ent['entPhysicalClass'] == "sensor")
{
echo(" (".$ent['entSensorValue'] ." ". $ent['entSensorType'].")"); echo(" (".$ent['entSensorValue'] ." ". $ent['entSensorType'].")");
} }
echo("<br /><div class='interface-desc' style='margin-left: 20px;'>" . $ent['entPhysicalDescr']); echo("<br /><div class='interface-desc' style='margin-left: 20px;'>" . $ent['entPhysicalDescr']);
if($link) {echo("</a>");} if ($link) { echo("</a>"); }
if($ent['entPhysicalSerialNum']) { if ($ent['entPhysicalSerialNum'])
{
echo(" <br /><span style='color: #000099;'>Serial No. ".$ent['entPhysicalSerialNum']."</span> "); echo(" <br /><span style='color: #000099;'>Serial No. ".$ent['entPhysicalSerialNum']."</span> ");
} }
echo("</div>"); echo("</div>");
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"),0); $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"),0);
if($count) { if ($count)
{
echo("<ul>"); echo("<ul>");
printEntPhysical($ent['entPhysicalIndex'], $level+1, ''); printEntPhysical($ent['entPhysicalIndex'], $level+1, '');
echo("</ul>"); echo("</ul>");
} }
echo("</li>"); echo("</li>");
} }
} }
echo("<div style='float: right;'> echo("<div style='float: right;'>
<a href='#' class='button' onClick=\"expandTree('enttree');return false;\"><img src='images/16/bullet_toggle_plus.png'>Expand All Nodes</a> <a href='#' class='button' onClick=\"expandTree('enttree');return false;\"><img src='images/16/bullet_toggle_plus.png'>Expand All Nodes</a>
<a href='#' class='button' onClick=\"collapseTree('enttree');return false;\"><img src='images/16/bullet_toggle_minus.png'>Collapse All Nodes</a> <a href='#' class='button' onClick=\"collapseTree('enttree');return false;\"><img src='images/16/bullet_toggle_minus.png'>Collapse All Nodes</a>
</div>"); </div>");
echo("<div style='clear: both;'><UL CLASS='mktree' id='enttree'>"); echo("<div style='clear: both;'><UL CLASS='mktree' id='enttree'>");
$level = "0"; $level = "0";
$ent['entPhysicalIndex'] = "0"; $ent['entPhysicalIndex'] = "0";
printEntPhysical($ent['entPhysicalIndex'], $level, "liOpen"); printEntPhysical($ent['entPhysicalIndex'], $level, "liOpen");
echo("</ul></div>"); echo("</ul></div>");
?> ?>

View File

@@ -4,9 +4,11 @@ $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `even
$data = mysql_query($query); $data = mysql_query($query);
echo('<table cellspacing="0" cellpadding="2" width="100%">'); echo('<table cellspacing="0" cellpadding="2" width="100%">');
while($entry = mysql_fetch_array($data)) { while ($entry = mysql_fetch_array($data))
{
include("includes/print-event.inc"); include("includes/print-event.inc");
} }
echo('</table>'); echo('</table>');
?> ?>

View File

@@ -11,18 +11,19 @@ print_optionbar_start('', '');
$sep = ""; $sep = "";
$query = mysql_query("SELECT * FROM device_graphs WHERE device_id = '".$device['device_id']."'"); $query = mysql_query("SELECT * FROM device_graphs WHERE device_id = '".$device['device_id']."'");
while($graph = mysql_fetch_assoc($query))
while ($graph = mysql_fetch_assoc($query))
{ {
$section = $config['graph_types']['device'][$graph['graph']]['section']; $section = $config['graph_types']['device'][$graph['graph']]['section'];
$graph_enable[$section][$graph['graph']] = $graph['graph']; $graph_enable[$section][$graph['graph']] = $graph['graph'];
} }
foreach($config['graph_sections'] as $section) foreach ($config['graph_sections'] as $section)
{ {
if(isset($graph_enable) && is_array($graph_enable[$section])) if (isset($graph_enable) && is_array($graph_enable[$section]))
{ {
$type = strtolower($section); $type = strtolower($section);
if(!$_GET['opta']) { $_GET['opta'] = $type; } if (!$_GET['opta']) { $_GET['opta'] = $type; }
echo($sep); echo($sep);
if ($_GET['opta'] == $type) if ($_GET['opta'] == $type)
{ {
@@ -33,24 +34,21 @@ foreach($config['graph_sections'] as $section)
{ {
echo('<img src="images/icons/greyscale/'.$type.'.png" class="optionicon" />'); echo('<img src="images/icons/greyscale/'.$type.'.png" class="optionicon" />');
} }
echo("<a href='".$config['base_url']."/device/".$device['device_id']."/graphs/" . $type . ($_GET['optb'] ? "/" . $_GET['optb'] : ''). "/'> " . $type ."</a>\n"); echo("<a href='".$config['base_url']."/device/".$device['device_id']."/graphs/" . $type . ($_GET['optb'] ? "/" . $_GET['optb'] : ''). "/'> " . $type ."</a>\n");
if ($_GET['opta'] == $type) { echo("</strong>"); } if ($_GET['opta'] == $type) { echo("</strong>"); }
$sep = " | "; $sep = " | ";
} }
} }
unset ($sep); unset ($sep);
print_optionbar_end(); print_optionbar_end();
#echo("<pre>");
#print_r($_GET['opta']);
#print_r($graph_enable);
#echo("</pre>");
$graph_enable = $graph_enable[$_GET['opta']]; $graph_enable = $graph_enable[$_GET['opta']];
foreach($config['graph_types']['device'] as $graph => $entry) foreach ($config['graph_types']['device'] as $graph => $entry)
{ {
if($graph_enable[$graph]) if ($graph_enable[$graph])
{ {
$graph_title = $config['graph_types']['device'][$graph]['descr']; $graph_title = $config['graph_types']['device'][$graph]['descr'];
$graph_type = "device_" . $graph; $graph_type = "device_" . $graph;
@@ -59,4 +57,3 @@ foreach($config['graph_types']['device'] as $graph => $entry)
} }
?> ?>

View File

@@ -1,7 +1,10 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/ucd_cpu.rrd")) {
if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/ucd_cpu.rrd"))
{
$graph_title = "Processor Utilisation"; $graph_title = "Processor Utilisation";
$graph_type = "device_cpu"; $graph_type = "device_cpu";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,9 +1,10 @@
<?php <?php
if($device['os'] == "fortigate" || $device['os_group'] == "fortigate") { if ($device['os'] == "fortigate" || $device['os_group'] == "fortigate")
{
$graph_title = "Firewall Sessions"; $graph_title = "Firewall Sessions";
$graph_type = "fortigate_sessions"; $graph_type = "fortigate_sessions";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,7 +1,10 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/hrSystem.rrd")) {
if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/hrSystem.rrd"))
{
$graph_title = "Running Processes"; $graph_title = "Running Processes";
$graph_type = "device_hrprocesses"; $graph_type = "device_hrprocesses";
include ("includes/print-device-graph.php"); include ("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,11 +1,10 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/hrSystem.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/hrSystem.rrd"))
{
$graph_title = "Users Logged On"; $graph_title = "Users Logged On";
$graph_type = "device_hrusers"; $graph_type = "device_hrusers";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,7 +1,10 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/ucd_mem.rrd")) {
if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/ucd_mem.rrd"))
{
$graph_title = "Memory Utilisation"; $graph_title = "Memory Utilisation";
$graph_type = "device_memory"; $graph_type = "device_memory";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,63 +1,68 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/ipSystemStats-ipv6.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/ipSystemStats-ipv6.rrd"))
{
$graph_title = "IPv6 IP Packet Statistics"; $graph_title = "IPv6 IP Packet Statistics";
$graph_type = "device_ipSystemStats_v6"; $graph_type = "device_ipSystemStats_v6";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
$graph_title = "IPv6 IP Fragmentation Statistics"; $graph_title = "IPv6 IP Fragmentation Statistics";
$graph_type = "device_ipSystemStats_v6_frag"; $graph_type = "device_ipSystemStats_v6_frag";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
}
} if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/ipSystemStats-ipv4.rrd"))
{
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/ipSystemStats-ipv4.rrd")) {
$graph_title = "IPv4 IP Packet Statistics"; $graph_title = "IPv4 IP Packet Statistics";
$graph_type = "device_ipSystemStats_v4"; $graph_type = "device_ipSystemStats_v4";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-ip.rrd"))
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-ip.rrd")) { {
$graph_title = "IP Statistics"; $graph_title = "IP Statistics";
$graph_type = "device_ip"; $graph_type = "device_ip";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
$graph_title = "IP Fragmented Statistics"; $graph_title = "IP Fragmented Statistics";
$graph_type = "device_ip_fragmented"; $graph_type = "device_ip_fragmented";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-tcp.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-tcp.rrd"))
{
$graph_title = "TCP Statistics"; $graph_title = "TCP Statistics";
$graph_type = "device_tcp"; $graph_type = "device_tcp";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-udp.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-udp.rrd"))
{
$graph_title = "UDP Statistics"; $graph_title = "UDP Statistics";
$graph_type = "device_udp"; $graph_type = "device_udp";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-snmp.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-snmp.rrd"))
{
$graph_title = "SNMP Packets Statistics"; $graph_title = "SNMP Packets Statistics";
$graph_type = "device_snmp_packets"; $graph_type = "device_snmp_packets";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
$graph_title = "SNMP Message Type Statistics"; $graph_title = "SNMP Message Type Statistics";
$graph_type = "device_snmp_statistics"; $graph_type = "device_snmp_statistics";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-icmp.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-icmp.rrd"))
{
$graph_title = "ICMP Statistics"; $graph_title = "ICMP Statistics";
$graph_type = "device_icmp"; $graph_type = "device_icmp";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
$graph_title = "ICMP Informational Statistics"; $graph_title = "ICMP Informational Statistics";
$graph_type = "device_icmp_informational"; $graph_type = "device_icmp_informational";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,9 +1,10 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-icmp.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-icmp.rrd"))
{
$graph_title = "ICMP Informational Statistics"; $graph_title = "ICMP Informational Statistics";
$graph_type = "device_icmp_informational"; $graph_type = "device_icmp_informational";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,9 +1,10 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-icmp.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-icmp.rrd"))
{
$graph_title = "ICMP Statistics"; $graph_title = "ICMP Statistics";
$graph_type = "device_icmp"; $graph_type = "device_icmp";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,13 +1,14 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-ip.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-ip.rrd"))
{
$graph_title = "IP Statistics"; $graph_title = "IP Statistics";
$graph_type = "device_ip"; $graph_type = "device_ip";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
$graph_title = "IP Fragmented Statistics"; $graph_title = "IP Fragmented Statistics";
$graph_type = "device_ip_fragmented"; $graph_type = "device_ip_fragmented";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,13 +1,14 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-snmp.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-snmp.rrd"))
{
$graph_title = "SNMP Packets Statistics"; $graph_title = "SNMP Packets Statistics";
$graph_type = "device_snmp_packets"; $graph_type = "device_snmp_packets";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
$graph_title = "SNMP Message Type Statistics"; $graph_title = "SNMP Message Type Statistics";
$graph_type = "device_snmp_statistics"; $graph_type = "device_snmp_statistics";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,9 +1,10 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-tcp.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-tcp.rrd"))
{
$graph_title = "TCP Statistics"; $graph_title = "TCP Statistics";
$graph_type = "device_tcp"; $graph_type = "device_tcp";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,9 +1,10 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-udp.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/netstats-udp.rrd"))
{
$graph_title = "UDP Statistics"; $graph_title = "UDP Statistics";
$graph_type = "device_udp"; $graph_type = "device_udp";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,10 +1,10 @@
<?php <?php
if($device['os'] == "netscreen" || $device['os_group'] == "netscreen") { if ($device['os'] == "netscreen" || $device['os_group'] == "netscreen")
{
$graph_title = "Firewall Sessions"; $graph_title = "Firewall Sessions";
$graph_type = "netscreen_sessions"; include ("includes/print-device-graph.php"); $graph_type = "netscreen_sessions";
include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,9 +1,10 @@
<?php <?php
if($device['os'] == "screenos" && is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/screenos-sessions.rrd")) { if ($device['os'] == "screenos" && is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/screenos-sessions.rrd"))
{
$graph_title = "Firewall Sessions"; $graph_title = "Firewall Sessions";
$graph_type = "screenos_sessions"; $graph_type = "screenos_sessions";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -1,9 +1,10 @@
<?php <?php
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/wificlients-radio1.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] ."/wificlients-radio1.rrd"))
{
$graph_title = "Wireless clients"; $graph_title = "Wireless clients";
$graph_type = "device_wificlients"; $graph_type = "device_wificlients";
include ("includes/print-device-graph.php"); include("includes/print-device-graph.php");
} }
?> ?>

View File

@@ -24,7 +24,6 @@ if ($volts) { $datas[] = 'voltages'; }
if ($freqs) { $datas[] = 'frequencies'; } if ($freqs) { $datas[] = 'frequencies'; }
if ($current) { $datas[] = 'current'; } if ($current) { $datas[] = 'current'; }
$type_text['overview'] = "Overview"; $type_text['overview'] = "Overview";
$type_text['temperatures'] = "Temperatures"; $type_text['temperatures'] = "Temperatures";
$type_text['humidity'] = "Humidity"; $type_text['humidity'] = "Humidity";
@@ -39,11 +38,11 @@ $type_text['current'] = "Current";
print_optionbar_start(); print_optionbar_start();
if(!$_GET['opta']) { $_GET['opta'] = "overview"; } if (!$_GET['opta']) { $_GET['opta'] = "overview"; }
unset($sep); unset($sep);
foreach ($datas as $type) { foreach ($datas as $type)
{
echo($sep); echo($sep);
if ($_GET['opta'] == $type) if ($_GET['opta'] == $type)
@@ -64,8 +63,10 @@ if (is_file("pages/device/health/".mres($_GET['opta']).".inc.php"))
{ {
include("pages/device/health/".mres($_GET['opta']).".inc.php"); include("pages/device/health/".mres($_GET['opta']).".inc.php");
} else { } else {
foreach ($datas as $type) { foreach ($datas as $type)
if($type != "overview") { {
if ($type != "overview")
{
$graph_title = $type_text[$type]; $graph_title = $type_text[$type];
$graph_type = "device_".$type; $graph_type = "device_".$type;
include ("includes/print-device-graph.php"); include ("includes/print-device-graph.php");
@@ -73,5 +74,4 @@ if (is_file("pages/device/health/".mres($_GET['opta']).".inc.php"))
} }
} }
?> ?>

View File

@@ -3,7 +3,7 @@
$sql = "SELECT * FROM `ucd_diskio` WHERE device_id = '" . mres($_GET['id']) . "' ORDER BY diskio_descr"; $sql = "SELECT * FROM `ucd_diskio` WHERE device_id = '" . mres($_GET['id']) . "' ORDER BY diskio_descr";
$query = mysql_query($sql); $query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=5 width=100%>"); echo('<table cellspacing="0" cellpadding="5" width="100%">');
#echo("<tr class=tablehead> #echo("<tr class=tablehead>
# <th width=250>Drive</th> # <th width=250>Drive</th>
@@ -14,9 +14,9 @@ echo("<table cellspacing=0 cellpadding=5 width=100%>");
$row = 1; $row = 1;
while($drive = mysql_fetch_array($query)) { while ($drive = mysql_fetch_array($query))
{
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$fs_url = "device/".$device['device_id']."/health/diskio/"; $fs_url = "device/".$device['device_id']."/health/diskio/";
@@ -24,18 +24,18 @@ while($drive = mysql_fetch_array($query)) {
$fs_popup .= "</div><img src=\'graph.php?id=" . $drive['diskio_id'] . "&type=diskio_ops&from=$month&to=$now&width=400&height=125\'>"; $fs_popup .= "</div><img src=\'graph.php?id=" . $drive['diskio_id'] . "&type=diskio_ops&from=$month&to=$now&width=400&height=125\'>";
$fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\""; $fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"";
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; }
} elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; }
} elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; }
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; }
} else { $left_background='9abf5b'; $right_background='bbd392'; } else { $left_background='9abf5b'; $right_background='bbd392'; }
echo("<tr bgcolor='$row_colour'><th><a href='$fs_url' $fs_popup>" . $drive['diskio_descr'] . "</a></td></tr>"); echo("<tr bgcolor='$row_colour'><th><a href='$fs_url' $fs_popup>" . $drive['diskio_descr'] . "</a></td></tr>");
$types = array("diskio_bits", "diskio_ops"); $types = array("diskio_bits", "diskio_ops");
foreach($types as $graph_type) { foreach ($types as $graph_type)
{
echo('<tr bgcolor="'.$row_colour.'"><td colspan=5>'); echo('<tr bgcolor="'.$row_colour.'"><td colspan=5>');
$graph_array['id'] = $drive['diskio_id']; $graph_array['id'] = $drive['diskio_id'];
@@ -44,13 +44,11 @@ while($drive = mysql_fetch_array($query)) {
include("includes/print-quadgraphs.inc.php"); include("includes/print-quadgraphs.inc.php");
echo("</td></tr>"); echo("</td></tr>");
} }
$row++; $row++;
} }
echo("</table>"); echo("</table>");
?> ?>

View File

@@ -2,12 +2,15 @@
$graph_type = "mempool_usage"; $graph_type = "mempool_usage";
echo("<div style='margin-top: 5px; padding: 0px;'>"); echo("<div style='margin-top: 5px; padding: 0px;'>");
echo("<table width=100% cellpadding=6 cellspacing=0>"); echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1';
$mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'"); $i = '1';
while($mempool = mysql_fetch_array($mempools)) { $mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'");
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
while ($mempool = mysql_fetch_array($mempools))
{
if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$text_descr = rewrite_entity_descr($mempool['mempool_descr']); $text_descr = rewrite_entity_descr($mempool['mempool_descr']);
@@ -24,11 +27,11 @@ $graph_type = "mempool_usage";
$perc = round($mempool['mempool_used'] / $mempool['mempool_total'] * 100); $perc = round($mempool['mempool_used'] / $mempool['mempool_total'] * 100);
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; }
} elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; }
} elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; }
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; }
} else { $left_background='9abf5b'; $right_background='bbd392'; } else { $left_background='9abf5b'; $right_background='bbd392'; }
echo("<tr bgcolor=$row_colour><td class=tablehead><a href='".$mempool_url."' $mempool_popup>" . $text_descr . "</a></td> echo("<tr bgcolor=$row_colour><td class=tablehead><a href='".$mempool_url."' $mempool_popup>" . $text_descr . "</a></td>
<td width=90><a href='".$mempool_url."' $mempool_popup><img src='$mini_url'></a></td> <td width=90><a href='".$mempool_url."' $mempool_popup><img src='$mini_url'></a></td>
@@ -38,23 +41,19 @@ $graph_type = "mempool_usage";
<td width=50>".$perc."%</td> <td width=50>".$perc."%</td>
</tr>"); </tr>");
echo("<tr bgcolor='$row_colour'><td colspan=5>"); echo("<tr bgcolor='$row_colour'><td colspan=5>");
$graph_array['id'] = $mempool['mempool_id']; $graph_array['id'] = $mempool['mempool_id'];
$graph_array['type'] = $graph_type; $graph_array['type'] = $graph_type;
include("includes/print-quadgraphs.inc.php"); include("includes/print-quadgraphs.inc.php");
echo("</td></tr>"); echo("</td></tr>");
$i++; $i++;
} }
echo("</table>");
echo("</div>");
echo("</table>");
echo("</div>");
?> ?>

View File

@@ -4,10 +4,11 @@ $graph_type = "processor_usage";
echo("<div style='margin-top: 5px; padding: 0px;'>"); echo("<div style='margin-top: 5px; padding: 0px;'>");
echo("<table width=100% cellpadding=6 cellspacing=0>"); echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1'; $i = '1';
$procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "'"); $procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "'");
while($proc = mysql_fetch_array($procs)) { while ($proc = mysql_fetch_array($procs))
{
$proc_url = "device/".$device['device_id']."/health/processors/"; $proc_url = "device/".$device['device_id']."/health/processors/";
$mini_url = "graph.php?id=".$proc['processor_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; $mini_url = "graph.php?id=".$proc['processor_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4";
@@ -22,10 +23,10 @@ while($proc = mysql_fetch_array($procs)) {
$perc = round($proc['processor_usage']); $perc = round($proc['processor_usage']);
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73';
} elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392';
} elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92';
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3';
} else { $left_background='9abf5b'; $right_background='bbd392'; } } else { $left_background='9abf5b'; $right_background='bbd392'; }
echo("<tr bgcolor=$row_colour> echo("<tr bgcolor=$row_colour>
@@ -42,11 +43,9 @@ while($proc = mysql_fetch_array($procs)) {
$graph_array['type'] = $graph_type; $graph_array['type'] = $graph_type;
include("includes/print-quadgraphs.inc.php"); include("includes/print-quadgraphs.inc.php");
} }
echo("</table>"); echo("</table>");
echo("</div>"); echo("</div>");
?> ?>

View File

@@ -7,9 +7,9 @@ echo("<table cellspacing=0 cellpadding=5 width=100%>");
$row = 1; $row = 1;
while($temp = mysql_fetch_array($query)) { while ($temp = mysql_fetch_array($query))
{
if(!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if (!is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
echo("<tr class=list-large style=\"background-color: $row_colour; padding: 5px;\"> echo("<tr class=list-large style=\"background-color: $row_colour; padding: 5px;\">
<td width=500>" . $temp['sensor_descr'] . "</td> <td width=500>" . $temp['sensor_descr'] . "</td>
@@ -27,12 +27,9 @@ while($temp = mysql_fetch_array($query)) {
echo("</td></tr>"); echo("</td></tr>");
$row++; $row++;
} }
echo("</table>"); echo("</table>");
?> ?>

View File

@@ -16,9 +16,9 @@ echo("<tr class=tablehead>
$row = 1; $row = 1;
while($drive = mysql_fetch_array($query)) { while ($drive = mysql_fetch_array($query))
{
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$total = $drive['storage_size']; $total = $drive['storage_size'];
$used = $drive['storage_used']; $used = $drive['storage_used'];
@@ -34,11 +34,11 @@ while($drive = mysql_fetch_array($query)) {
$fs_popup .= "</div><img src=\'graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=125\'>"; $fs_popup .= "</div><img src=\'graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=125\'>";
$fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\""; $fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"";
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; }
} elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; }
} elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; }
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; }
} else { $left_background='9abf5b'; $right_background='bbd392'; } else { $left_background='9abf5b'; $right_background='bbd392'; }
echo("<tr bgcolor='$row_colour'><th><a href='$fs_url' $fs_popup>" . $drive['storage_descr'] . "</a></td><td> echo("<tr bgcolor='$row_colour'><th><a href='$fs_url' $fs_popup>" . $drive['storage_descr'] . "</a></td><td>
<a href='$fs_url' $fs_popup>".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)."</a> <a href='$fs_url' $fs_popup>".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $left_background, $perc . "%", "ffffff", $right_background)."</a>
@@ -53,11 +53,9 @@ while($drive = mysql_fetch_array($query)) {
echo("</td></tr>"); echo("</td></tr>");
$row++; $row++;
} }
echo("</table>"); echo("</table>");
?> ?>

View File

@@ -3,11 +3,13 @@
echo("<table width=100%>"); echo("<table width=100%>");
$hrdevices = mysql_query("SELECT * FROM `hrDevice` WHERE `device_id` = '".$device['device_id']."' ORDER BY `hrDeviceIndex`"); $hrdevices = mysql_query("SELECT * FROM `hrDevice` WHERE `device_id` = '".$device['device_id']."' ORDER BY `hrDeviceIndex`");
while($hrdevice = mysql_fetch_array($hrdevices)) { while ($hrdevice = mysql_fetch_array($hrdevices))
{
echo("<tr><td>".$hrdevice['hrDeviceIndex']."</td>"); echo("<tr><td>".$hrdevice['hrDeviceIndex']."</td>");
if($hrdevice['hrDeviceType'] == "hrDeviceProcessor") { if ($hrdevice['hrDeviceType'] == "hrDeviceProcessor")
{
$proc_id = mysql_result(mysql_query("SELECT processor_id FROM processors WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrdevice['hrDeviceIndex']."'"),0); $proc_id = mysql_result(mysql_query("SELECT processor_id FROM processors WHERE device_id = '".$device['device_id']."' AND hrDeviceIndex = '".$hrdevice['hrDeviceIndex']."'"),0);
$proc_url = $config['base_url'] . "/device/".$device['device_id']."/health/processors/"; $proc_url = $config['base_url'] . "/device/".$device['device_id']."/health/processors/";
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$hrdevice['hrDeviceDescr']; $proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$hrdevice['hrDeviceDescr'];
@@ -25,12 +27,11 @@ if($hrdevice['hrDeviceType'] == "hrDeviceProcessor") {
$mini_graph = overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); $mini_graph = overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
echo('<td>'.$mini_graph.'</td>'); echo('<td>'.$mini_graph.'</td>');
} elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork") { } elseif ($hrdevice['hrDeviceType'] == "hrDeviceNetwork") {
$int = str_replace("network interface ", "", $hrdevice['hrDeviceDescr']); $int = str_replace("network interface ", "", $hrdevice['hrDeviceDescr']);
$interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'")); $interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE device_id = '".$device['device_id']."' AND ifDescr = '".$int."'"));
if($interface['ifIndex']) { if ($interface['ifIndex']) {
echo("<td>".generate_port_link($interface)."</td>"); echo("<td>".generate_port_link($interface)."</td>");
$graph_array['height'] = "20"; $graph_array['height'] = "20";
@@ -48,10 +49,10 @@ if($hrdevice['hrDeviceType'] == "hrDeviceProcessor") {
echo("<td>".$hrdevice['hrDeviceDescr']."</td>"); echo("<td>".$hrdevice['hrDeviceDescr']."</td>");
echo("<td></td>"); echo("<td></td>");
} }
} else { } else {
echo("<td>".$hrdevice['hrDeviceDescr']."</td>"); echo("<td>".$hrdevice['hrDeviceDescr']."</td>");
echo("<td></td>"); echo("<td></td>");
} }
echo("<td>".$hrdevice['hrDeviceType']."</td><td>".$hrdevice['hrDeviceStatus']."</td>"); echo("<td>".$hrdevice['hrDeviceType']."</td><td>".$hrdevice['hrDeviceStatus']."</td>");
echo("<td>".$hrdevice['hrDeviceErrors']."</td><td>".$hrdevice['hrProcessorLoad']."</td>"); echo("<td>".$hrdevice['hrDeviceErrors']."</td><td>".$hrdevice['hrProcessorLoad']."</td>");
@@ -62,4 +63,3 @@ if($hrdevice['hrDeviceType'] == "hrDeviceProcessor") {
echo("</table>"); echo("</table>");
?> ?>

View File

@@ -1,52 +1,57 @@
<?php <?php
if( !isset($_GET['optb']) ) { $_GET['optb'] = "graphs"; } if (!isset($_GET['optb']) ) { $_GET['optb'] = "graphs"; }
$interface_query = mysql_query("select * from ports WHERE interface_id = '".$_GET['opta']."'"); $interface_query = mysql_query("select * from ports WHERE interface_id = '".$_GET['opta']."'");
$interface = mysql_fetch_assoc($interface_query); $interface = mysql_fetch_assoc($interface_query);
$port_details = 1; $port_details = 1;
$hostname = $device['hostname']; $hostname = $device['hostname'];
$hostid = $device['interface_id']; $hostid = $device['interface_id'];
$ifname = $interface['ifDescr']; $ifname = $interface['ifDescr'];
$ifIndex = $interface['ifIndex']; $ifIndex = $interface['ifIndex'];
$speed = humanspeed($interface['ifSpeed']); $speed = humanspeed($interface['ifSpeed']);
$ifalias = $interface['name']; $ifalias = $interface['name'];
if($interface['ifPhysAddress']) { $mac = "$interface[ifPhysAddress]"; } if ($interface['ifPhysAddress']) { $mac = "$interface[ifPhysAddress]"; }
$color = "black"; $color = "black";
if ($interface['ifAdminStatus'] == "down") { $status = "<span class='grey'>Disabled</span>"; } if ($interface['ifAdminStatus'] == "down") { $status = "<span class='grey'>Disabled</span>"; }
if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "down") { $status = "<span class='red'>Enabled / Disconnected</span>"; } if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "down") { $status = "<span class='red'>Enabled / Disconnected</span>"; }
if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "up") { $status = "<span class='green'>Enabled / Connected</span>"; } if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "up") { $status = "<span class='green'>Enabled / Connected</span>"; }
$i = 1; $i = 1;
$inf = fixifName($ifname); $inf = fixifName($ifname);
$bg="#ffffff"; $bg="#ffffff";
$show_all = 1; $show_all = 1;
echo("<div class=ifcell style='margin: 0px;'><table width=100% cellpadding=10 cellspacing=0>"); echo("<div class=ifcell style='margin: 0px;'><table width=100% cellpadding=10 cellspacing=0>");
include("includes/print-interface.inc.php"); include("includes/print-interface.inc.php");
echo("</table></div>"); echo("</table></div>");
$pos = strpos(strtolower($ifname), "vlan"); $pos = strpos(strtolower($ifname), "vlan");
if( $pos !== false ) { if ($pos !== false )
{
$broke = yes; $broke = yes;
} }
$pos = strpos(strtolower($ifname), "loopback");
if( $pos !== false ) {
$broke = yes;
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"),0)) { $pos = strpos(strtolower($ifname), "loopback");
if ($pos !== false )
{
$broke = yes;
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"),0))
{
$pagp = " | <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/pagp/'>PAgP</a>"; $pagp = " | <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/pagp/'>PAgP</a>";
} }
echo("<div style='clear: both;'>"); echo("<div style='clear: both;'>");
@@ -54,37 +59,35 @@ print_optionbar_start();
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/'>Graphs</a> | "); echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/'>Graphs</a> | ");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `ports_adsl` WHERE `interface_id` = '".$interface['interface_id']."'"),0)) if (mysql_result(mysql_query("SELECT COUNT(*) FROM `ports_adsl` WHERE `interface_id` = '".$interface['interface_id']."'"),0))
{ {
echo("<a href='".$config['base_url']."/device/".$device['device_id']."/interface/".$interface['interface_id']."/adsl/'>ADSL</a> | "); echo("<a href='".$config['base_url']."/device/".$device['device_id']."/interface/".$interface['interface_id']."/adsl/'>ADSL</a> | ");
} }
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/arp/'>ARP Table</a>$pagp"); echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/arp/'>ARP Table</a>$pagp");
if (mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0) > "0")
{
if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0) > "0"){
echo(" | Mac Accounting : echo(" | Mac Accounting :
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/bits/'>Bits</a> <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/bits/'>Bits</a>
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/bits/thumbs/'>Mini</a>|<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/bits/top10/'>Top10</a>) | (<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/bits/thumbs/'>Mini</a>|<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/bits/top10/'>Top10</a>) |
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/pkts/'>Packets</a> <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/pkts/'>Packets</a>
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/pkts/thumbs/'>Mini</a>)"); (<a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/macaccounting/pkts/thumbs/'>Mini</a>)");
} }
if (mysql_result(mysql_query("SELECT COUNT(*) FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'"),0) > "0")
if(mysql_result(mysql_query("SELECT COUNT(*) FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'"),0) > "0"){ {
echo(" | ATM VPs :"); echo(" | ATM VPs :");
echo(" <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/junose-atm-vp/bits/'>Bits</a>"); echo(" <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/junose-atm-vp/bits/'>Bits</a>");
echo(" | <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/junose-atm-vp/packets/'>Packets</a>"); echo(" | <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/junose-atm-vp/packets/'>Packets</a>");
echo(" | <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/junose-atm-vp/cells/'>Cells</a>"); echo(" | <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/junose-atm-vp/cells/'>Cells</a>");
echo(" | <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/junose-atm-vp/errors/'>Errors</a>"); echo(" | <a href='".$config['base_url']."/device/" . $device['device_id'] . "/interface/".$interface['interface_id']."/junose-atm-vp/errors/'>Errors</a>");
}
}
print_optionbar_end(); print_optionbar_end();
echo("<div style='margin: 5px;'>"); echo("<div style='margin: 5px;'>");
include("pages/device/port/".mres($_GET['optb']).".inc.php"); include("pages/device/port/".mres($_GET['optb']).".inc.php");
echo("</div>"); echo("</div>");
?> ?>

View File

@@ -1,34 +0,0 @@
<?php
### Connect to database
$nagios_host = mysql_fetch_array( mysql_query("SELECT * FROM nagios_hosts WHERE address = '".$device['hostname']."'", $nagios_link) );
$nagios_hoststatus = mysql_fetch_array( mysql_query("SELECT * FROM nagios_hoststatus WHERE '".$nagios_host['host_object_id']."'", $nagios_link) );
$i = 0;
$service_text = array ('0' => 'Up', '1' => 'Down', '2' => 'Critical', '3' => 'Unknown');
$host_text = array ('0' => 'Up', '1' => 'Down', '2' => 'Unreachable');
$host_colour = array ('0' => '#99ff99', '1' => '#ff9999', '2' => '#ff6666');
$service_colour = array ('0' => '#99ff99', '1' => '#ff9999', '2' => '#ff6666', '3' => '#ffaa99');
echo("<div style='font-size: 20px; padding:5px; margin:5px; background: ".$host_colour[$nagios_hoststatus[current_state]]."'>Status : " . $host_text[$nagios_hoststatus[current_state]] . " ".$nagios_hoststatus['output']."</div>");
echo("<table cellspacing=0 cellpadding=3>");
$nagios_services = mysql_query("SELECT * FROM nagios_services AS N, nagios_servicestatus AS S WHERE N.host_object_id = '".$nagios_host['host_object_id']."' AND S.service_object_id = N.service_object_id", $nagios_link);
while ($nagios_service = mysql_fetch_array($nagios_services)) {
if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
echo("<tr bgcolor=$bg_colour>");
$service_state = $nagios_service['current_state'];
echo("<td>" . $nagios_service['display_name'] . "</td><td bgcolor=".$service_colour[$service_state].">".$service_text[$service_state]."</td><td>" . $nagios_service['output'] . "</td>");
echo("</tr>");
$i++;
}
echo("</table>");
?>

View File

@@ -2,10 +2,6 @@
$overview = 1; $overview = 1;
#$id = $_GET['id'];
#$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '$_GET[id]'"));
$ports['total'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "'"),0); $ports['total'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "'"),0);
$ports['up'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'up'"),0); $ports['up'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'up'"),0);
$ports['down'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0); $ports['down'] = mysql_result(mysql_query("SELECT count(*) FROM ports WHERE device_id = '" . $device['device_id'] . "' AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0);
@@ -16,12 +12,12 @@ $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 device_id = '" . $device['device_id'] . "' AND service_status = '0' AND service_ignore = '0'"),0); $services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE device_id = '" . $device['device_id'] . "' AND service_status = '0' AND service_ignore = '0'"),0);
$services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE device_id = '" . $device['device_id'] . "' AND service_ignore = '1'"),0); $services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE device_id = '" . $device['device_id'] . "' AND service_ignore = '1'"),0);
if($services['down']) { $services_colour = $warn_colour_a; } else { $services_colour = $list_colour_a; } if ($services['down']) { $services_colour = $warn_colour_a; } else { $services_colour = $list_colour_a; }
if($ports['down']) { $ports_colour = $warn_colour_a; } else { $ports_colour = $list_colour_a; } if ($ports['down']) { $ports_colour = $warn_colour_a; } else { $ports_colour = $list_colour_a; }
echo("<div style='width: 50%; float: left;'>"); echo("<div style='width: 50%; float: left;'>");
#if(file_exists("includes/dev-data-" . strtolower($device[os]) . ".inc.php")) { #if (file_exists("includes/dev-data-" . strtolower($device[os]) . ".inc.php")) {
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>"); echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
# echo("<p class=sectionhead>Device Data</p><div style='height: 5px;'></div>"); # echo("<p class=sectionhead>Device Data</p><div style='height: 5px;'></div>");
# include("includes/dev-data-" . strtolower($device[os]) . ".inc.php"); # include("includes/dev-data-" . strtolower($device[os]) . ".inc.php");
@@ -29,15 +25,14 @@ echo("<div style='width: 50%; float: left;'>");
echo("</div>"); echo("</div>");
#} #}
include("overview/ports.inc.php"); include("overview/ports.inc.php");
if($services['total']) { if ($services['total'])
{
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>"); echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/16/cog.png'> Services</p><div style='height: 5px;'></div>"); echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/16/cog.png'> Services</p><div style='height: 5px;'></div>");
echo(" echo("
<table class=tablehead cellpadding=2 cellspacing=0 width=100%> <table class=tablehead cellpadding=2 cellspacing=0 width=100%>
<tr bgcolor=$services_colour align=center><td></td> <tr bgcolor=$services_colour align=center><td></td>
<td width=25%><img src='images/16/cog.png' align=absmiddle> $services[total]</td> <td width=25%><img src='images/16/cog.png' align=absmiddle> $services[total]</td>
@@ -50,7 +45,8 @@ echo("
$sql = "SELECT * FROM services WHERE device_id = '" . $device['device_id'] . "' ORDER BY service_type"; $sql = "SELECT * FROM services WHERE device_id = '" . $device['device_id'] . "' ORDER BY service_type";
$query = mysql_query($sql); $query = mysql_query($sql);
while($data = mysql_fetch_array($query)) { while ($data = mysql_fetch_array($query))
{
if ($data[service_status] == "0" && $data[service_ignore] == "1") { $status = "grey"; } if ($data[service_status] == "0" && $data[service_ignore] == "1") { $status = "grey"; }
if ($data[service_status] == "1" && $data[service_ignore] == "1") { $status = "green"; } if ($data[service_status] == "1" && $data[service_ignore] == "1") { $status = "green"; }
if ($data[service_status] == "0" && $data[service_ignore] == "0") { $status = "red"; } if ($data[service_status] == "0" && $data[service_ignore] == "0") { $status = "red"; }
@@ -60,20 +56,19 @@ echo("
} }
echo("</div>"); echo("</div>");
echo("</div>"); echo("</div>");
} }
$sql = "SELECT *, DATE_FORMAT(timestamp, '%d/%b/%y %T') AS date from syslog WHERE device_id = '" . $_GET['id'] . "' $where"; $sql = "SELECT *, DATE_FORMAT(timestamp, '%d/%b/%y %T') AS date from syslog WHERE device_id = '" . $_GET['id'] . "' $where";
$sql .= " ORDER BY timestamp DESC LIMIT 20"; $sql .= " ORDER BY timestamp DESC LIMIT 20";
$query = mysql_query($sql); $query = mysql_query($sql);
if(mysql_affected_rows() > "0"){ if (mysql_affected_rows() > "0")
{
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>"); echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/16/printer.png'> Recent Syslog</p>"); echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/16/printer.png'> Recent Syslog</p>");
echo("<table cellspacing=0 cellpadding=2 width=100%>"); echo("<table cellspacing=0 cellpadding=2 width=100%>");
while($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); }
echo("</table>"); echo("</table>");
echo("</div>"); echo("</div>");
} }
@@ -82,7 +77,6 @@ echo("</div>");
echo("<div style='float:right; width: 50%;'>"); echo("<div style='float:right; width: 50%;'>");
### Right Pane ### Right Pane
include("overview/processors.inc.php"); include("overview/processors.inc.php");
include("overview/mempools.inc.php"); include("overview/mempools.inc.php");
@@ -105,11 +99,12 @@ $data = mysql_query($query);
echo("<table cellspacing=0 cellpadding=2 width=100%>"); echo("<table cellspacing=0 cellpadding=2 width=100%>");
while($entry = mysql_fetch_array($data)) { while ($entry = mysql_fetch_array($data))
{
include("includes/print-event-short.inc"); include("includes/print-event-short.inc");
} }
echo("</table>"); echo("</table>");
echo("</div>"); echo("</div>");
?> ?>

View File

@@ -2,16 +2,16 @@
$results = mysql_query("SELECT * FROM sensors WHERE sensor_class='" . $sensor_class . "' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index"); $results = mysql_query("SELECT * FROM sensors WHERE sensor_class='" . $sensor_class . "' AND device_id = '" . $device['device_id'] . "' ORDER BY sensor_index");
if(mysql_num_rows($results)) if (mysql_num_rows($results))
{ {
$rows = round(mysql_num_rows($results) / 2,0); $rows = round(mysql_num_rows($results) / 2,0);
echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">'); echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">');
echo('<p style="padding: 0px 5px 5px;" class="sectionhead"><a class="sectionhead" href="device/'.$device['device_id'].'/health/' . strtolower($sensor_type) . '/"><img align="absmiddle" src="'.$config['base_url'].'/images/icons/' . strtolower($sensor_type) . '.png"> ' . $sensor_type . '</p>'); echo('<p style="padding: 0px 5px 5px;" class="sectionhead"><a class="sectionhead" href="device/'.$device['device_id'].'/health/' . strtolower($sensor_type) . '/"><img align="absmiddle" src="'.$config['base_url'].'/images/icons/' . strtolower($sensor_type) . '.png"> ' . $sensor_type . '</p>');
$i = '1'; $i = '1';
echo('<table width="100%" valign="top">'); echo('<table width="100%" valign="top">');
while($sensor = mysql_fetch_array($results)) while ($sensor = mysql_fetch_array($results))
{ {
if(is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if (is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$graph_colour = str_replace("#", "", $row_colour); $graph_colour = str_replace("#", "", $row_colour);
@@ -33,6 +33,7 @@ if(mysql_num_rows($results))
echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$sensor_link_a</strong></td><td width=80 align=right class=tablehead>$sensor_link_b<td width=80 align=right class=tablehead>$sensor_link_c</td></tr>"); echo("<tr bgcolor='$row_colour'><td class=tablehead><strong>$sensor_link_a</strong></td><td width=80 align=right class=tablehead>$sensor_link_b<td width=80 align=right class=tablehead>$sensor_link_c</td></tr>");
$i++; $i++;
} }
echo("</table>"); echo("</table>");
echo("</div>"); echo("</div>");
} }

View File

@@ -2,14 +2,17 @@
$graph_type = "mempool_usage"; $graph_type = "mempool_usage";
if(mysql_result(mysql_query("SELECT count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"),0)) { if (mysql_result(mysql_query("SELECT count(*) from mempools WHERE device_id = '" . $device['device_id'] . "'"),0))
{
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>"); echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/memory.png'> Memory Pools</p>"); echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/memory.png'> Memory Pools</p>");
echo("<table width=100% cellspacing=0 cellpadding=5>"); echo("<table width=100% cellspacing=0 cellpadding=5>");
$mempool_rows = '1'; $mempool_rows = '1';
$mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'"); $mempools = mysql_query("SELECT * FROM `mempools` WHERE device_id = '" . $device['device_id'] . "'");
while($mempool = mysql_fetch_array($mempools)) {
if(is_integer($mempool_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } while ($mempool = mysql_fetch_array($mempools))
{
if (is_integer($mempool_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$perc = round($mempool['mempool_used'] / ($mempool['mempool_total']) * 100,2); $perc = round($mempool['mempool_used'] / ($mempool['mempool_total']) * 100,2);
$text_descr = rewrite_entity_descr($mempool['mempool_descr']); $text_descr = rewrite_entity_descr($mempool['mempool_descr']);
@@ -25,11 +28,11 @@ if(mysql_result(mysql_query("SELECT count(*) from mempools WHERE device_id = '"
$used = formatStorage($mempool['mempool_used']); $used = formatStorage($mempool['mempool_used']);
$free = formatStorage($mempool['mempool_free']); $free = formatStorage($mempool['mempool_free']);
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; }
} elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; }
} elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; }
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; }
} else { $left_background='9abf5b'; $right_background='bbd392'; } else { $left_background='9abf5b'; $right_background='bbd392'; }
echo("<tr bgcolor=$row_colour><td class=tablehead><a href='".$mempool_url."' $mempool_popup>" . $text_descr . "</a></td> echo("<tr bgcolor=$row_colour><td class=tablehead><a href='".$mempool_url."' $mempool_popup>" . $text_descr . "</a></td>
<td width=90><a href='".$mempool_url."' $mempool_popup><img src='$mini_url'></a></td> <td width=90><a href='".$mempool_url."' $mempool_popup><img src='$mini_url'></a></td>
@@ -38,12 +41,11 @@ if(mysql_result(mysql_query("SELECT count(*) from mempools WHERE device_id = '"
</a></td> </a></td>
</tr>"); </tr>");
$mempool_rows++; $mempool_rows++;
} }
echo("</table>"); echo("</table>");
echo("</div>"); echo("</div>");
} }
?> ?>

View File

@@ -1,6 +1,7 @@
<?php <?php
if($ports['total']) { if ($ports['total'])
{
echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">'); echo('<div style="background-color: #eeeeee; margin: 5px; padding: 5px;">');
# ' . device_traffic_image($device['device_id'], 490, 100, $day, '-300s')); # ' . device_traffic_image($device['device_id'], 490, 100, $day, '-300s'));
@@ -13,7 +14,6 @@ if($ports['total']) {
$graph_array['legend'] = "no"; $graph_array['legend'] = "no";
$graph = generate_graph_tag($graph_array); $graph = generate_graph_tag($graph_array);
$content = "<div class=list-large>".$device['hostname']." - Device Traffic</div>"; $content = "<div class=list-large>".$device['hostname']." - Device Traffic</div>";
$content .= "<div style=\'width: 850px\'>"; $content .= "<div style=\'width: 850px\'>";
$graph_array['legend'] = "yes"; $graph_array['legend'] = "yes";
@@ -30,10 +30,8 @@ if($ports['total']) {
$link = $config['base_url'] . "/graphs/" . $graph_array['id'] . "/" . $graph_array['type'] . "/" . $day . "/" . $config['now'] . "/"; $link = $config['base_url'] . "/graphs/" . $graph_array['id'] . "/" . $graph_array['type'] . "/" . $day . "/" . $config['now'] . "/";
echo(overlib_link($link, $graph, $content, NULL)); echo(overlib_link($link, $graph, $content, NULL));
echo(' <div style="height: 5px;"></div>'); echo(' <div style="height: 5px;"></div>');
echo(' <table class="tablehead" cellpadding="2" cellspacing="0" width="100%"> echo(' <table class="tablehead" cellpadding="2" cellspacing="0" width="100%">
@@ -50,14 +48,18 @@ if($ports['total']) {
$sql = "SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'"; $sql = "SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'";
$query = mysql_query($sql); $query = mysql_query($sql);
$ifsep = ""; $ifsep = "";
while($data = mysql_fetch_array($query)) {
while ($data = mysql_fetch_array($query))
{
$data = ifNameDescr($data); $data = ifNameDescr($data);
$data = array_merge($data, $device); $data = array_merge($data, $device);
echo("$ifsep" . generate_port_link($data, makeshortif(strtolower($data['label'])))); echo("$ifsep" . generate_port_link($data, makeshortif(strtolower($data['label']))));
$ifsep = ", "; $ifsep = ", ";
} }
unset($ifsep); unset($ifsep);
echo(" </div>"); echo(" </div>");
echo("</div>"); echo("</div>");
} }
?> ?>

View File

@@ -2,15 +2,17 @@
$graph_type = "processor_usage"; $graph_type = "processor_usage";
if(mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"),0)) { if (mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"),0))
{
$processor_rows = 0; $processor_rows = 0;
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>"); echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/processors.png'> Processors</p>"); echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/processors.png'> Processors</p>");
echo("<table width=100% cellspacing=0 cellpadding=5>"); echo("<table width=100% cellspacing=0 cellpadding=5>");
$i = '1'; $i = '1';
$procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "' ORDER BY processor_descr ASC"); $procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "' ORDER BY processor_descr ASC");
while($proc = mysql_fetch_array($procs)) { while ($proc = mysql_fetch_array($procs))
if(is_integer($processor_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } {
if (is_integer($processor_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$proc_url = $config['base_url'] . "/device/".$device['device_id']."/health/processors/"; $proc_url = $config['base_url'] . "/device/".$device['device_id']."/health/processors/";
@@ -29,12 +31,11 @@ if(mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id = '
$perc = $proc['processor_usage']; $perc = $proc['processor_usage'];
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; }
} elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; }
} elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; }
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; }
} else { $left_background='9abf5b'; $right_background='bbd392'; } else { $left_background='9abf5b'; $right_background='bbd392'; }
echo("<tr bgcolor=$row_colour><td class=tablehead><a href='".$proc_url."' $proc_popup>" . $text_descr . "</a></td> echo("<tr bgcolor=$row_colour><td class=tablehead><a href='".$proc_url."' $proc_popup>" . $text_descr . "</a></td>
<td width=90><a href='".$proc_url."' $proc_popup><img src='$mini_url'></a></td> <td width=90><a href='".$proc_url."' $proc_popup><img src='$mini_url'></a></td>
@@ -44,6 +45,7 @@ if(mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id = '
</tr>"); </tr>");
$processor_rows++; $processor_rows++;
} }
echo("</table>"); echo("</table>");
echo("</div>"); echo("</div>");
} }

View File

@@ -2,36 +2,43 @@
$graph_type = "storage_usage"; $graph_type = "storage_usage";
if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device_id = '" . $device['device_id'] . "'"),0)) { if (mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device_id = '" . $device['device_id'] . "'"),0))
{
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>"); echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/storage.png'> Storage</p>"); echo("<p style='padding: 0px 5px 5px;' class=sectionhead><img align='absmiddle' src='".$config['base_url']."/images/icons/storage.png'> Storage</p>");
echo("<table width=100% cellspacing=0 cellpadding=5>"); echo("<table width=100% cellspacing=0 cellpadding=5>");
$drive_rows = '0'; $drive_rows = '0';
$drives = mysql_query("SELECT * FROM `storage` WHERE device_id = '" . $device['device_id'] . "' ORDER BY storage_descr ASC"); $drives = mysql_query("SELECT * FROM `storage` WHERE device_id = '" . $device['device_id'] . "' ORDER BY storage_descr ASC");
while($drive = mysql_fetch_array($drives)) { while ($drive = mysql_fetch_array($drives))
{
$skipdrive = 0; $skipdrive = 0;
if ($device["os"] == "junos") { if ($device["os"] == "junos")
foreach ($config['ignore_junos_os_drives'] as $jdrive) { {
if (preg_match($jdrive, $drive["storage_descr"])) { foreach ($config['ignore_junos_os_drives'] as $jdrive)
{
if (preg_match($jdrive, $drive["storage_descr"]))
{
$skipdrive = 1; $skipdrive = 1;
} }
} }
$drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]); $drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]);
} }
if ($device['os'] == "freebsd") { if ($device['os'] == "freebsd")
foreach ($config['ignore_bsd_os_drives'] as $jdrive) { {
if (preg_match($jdrive, $drive["storage_descr"])) { foreach ($config['ignore_bsd_os_drives'] as $jdrive)
{
if (preg_match($jdrive, $drive["storage_descr"]))
{
$skipdrive = 1; $skipdrive = 1;
} }
} }
} }
if ($skipdrive) { continue; } if ($skipdrive) { continue; }
if(is_integer($drive_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } if (is_integer($drive_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$perc = round($drive['storage_perc'], 0); $perc = round($drive['storage_perc'], 0);
$total = formatStorage($drive['storage_size']); $total = formatStorage($drive['storage_size']);
$free = formatStorage($drive['storage_free']); $free = formatStorage($drive['storage_free']);
@@ -45,13 +52,11 @@ if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device_
$mini_graph = $config['base_url'] . "/graph.php?id=".$drive['storage_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; $mini_graph = $config['base_url'] . "/graph.php?id=".$drive['storage_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4";
if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; }
elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; }
if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; }
} elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; }
} elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; else { $left_background='9abf5b'; $right_background='bbd392'; }
} elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3';
} else { $left_background='9abf5b'; $right_background='bbd392'; }
echo("<tr bgcolor=$row_colour><td class=tablehead><a href='".$fs_url."' $fs_popup>" . $drive['storage_descr'] . "</a></td> echo("<tr bgcolor=$row_colour><td class=tablehead><a href='".$fs_url."' $fs_popup>" . $drive['storage_descr'] . "</a></td>
<td width=90><a href='".$fs_url."' $fs_popup><img src='$mini_graph' /></a></td> <td width=90><a href='".$fs_url."' $fs_popup><img src='$mini_graph' /></a></td>
@@ -59,6 +64,7 @@ if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device_
</tr>"); </tr>");
$drive_rows++; $drive_rows++;
} }
echo("</table>"); echo("</table>");
echo("</div>"); echo("</div>");
} }

View File

@@ -1,7 +1,7 @@
<?php <?php
if(file_exists($config['rrd_dir'] . "/" . $hostname . "/port-". $ifIndex . "-adsl.rrd")) { if (file_exists($config['rrd_dir'] . "/" . $hostname . "/port-". $ifIndex . "-adsl.rrd"))
{
$iid = $id; $iid = $id;
echo("<div class=graphhead>ADSL Line Speed</div>"); echo("<div class=graphhead>ADSL Line Speed</div>");
$graph_type = "port_adsl_speed"; $graph_type = "port_adsl_speed";
@@ -18,22 +18,6 @@
echo("<div class=graphhead>ADSL Output Powers</div>"); echo("<div class=graphhead>ADSL Output Powers</div>");
$graph_type = "port_adsl_power"; $graph_type = "port_adsl_power";
include("includes/print-interface-graphs.inc.php"); include("includes/print-interface-graphs.inc.php");
}
}
# $graph_array['height'] = "100";
# $graph_array['width'] = "385";
# $graph_array['to'] = $now;
# $graph_array['port'] = $ports['fileserver'];
# $graph_array['type'] = "port_bits";
# $graph_array['from'] = $day;
# $graph_array['legend'] = "no";
# $graph_array['popup_title'] = "Central Fileserver";
# print_graph_popup($graph_array);
?> ?>

View File

@@ -1,7 +1,7 @@
<?php <?php
if(file_exists($config['rrd_dir'] . "/" . $hostname . "/port-". $ifIndex . ".rrd")) { if (file_exists($config['rrd_dir'] . "/" . $hostname . "/port-". $ifIndex . ".rrd"))
{
$iid = $id; $iid = $id;
echo("<div class=graphhead>Interface Traffic</div>"); echo("<div class=graphhead>Interface Traffic</div>");
$graph_type = "port_bits"; $graph_type = "port_bits";
@@ -19,12 +19,12 @@
$graph_type = "port_errors"; $graph_type = "port_errors";
include("includes/print-interface-graphs.inc.php"); include("includes/print-interface-graphs.inc.php");
if(is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . $interface['ifIndex'] . "-dot3.rrd")) { if (is_file($config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . $interface['ifIndex'] . "-dot3.rrd"))
{
echo("<div class=graphhead>Ethernet Errors</div>"); echo("<div class=graphhead>Ethernet Errors</div>");
$graph_type = "port_etherlike"; $graph_type = "port_etherlike";
include("includes/print-interface-graphs.inc.php"); include("includes/print-interface-graphs.inc.php");
} }
} }
?> ?>

View File

@@ -1,15 +1,16 @@
<?php <?php
$row = 0; $row = 0;
if($_GET['optc']) { $graph_type = "atmvp_".$_GET['optc']; } if ($_GET['optc']) { $graph_type = "atmvp_".$_GET['optc']; }
if(!$graph_type) { $graph_type = "atmvp_bits"; } if (!$graph_type) { $graph_type = "atmvp_bits"; }
echo("<table cellspacing=0 cellpadding=5 border=0>"); echo('<table cellspacing="0" cellpadding="5" border="0">');
$vps = mysql_query("SELECT * FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'"); $vps = mysql_query("SELECT * FROM juniAtmVp WHERE interface_id = '".$interface['interface_id']."'");
while($vp = mysql_fetch_array($vps)) { while ($vp = mysql_fetch_array($vps))
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } {
if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
echo('<tr bgcolor="'.$row_colour.'">'); echo('<tr bgcolor="'.$row_colour.'">');
echo('<td><span class=list-bold>'.$row.'. VP'.$vp['vp_id'].' '.$vp['vp_descr'].'</span></td>'); echo('<td><span class=list-bold>'.$row.'. VP'.$vp['vp_id'].' '.$vp['vp_descr'].'</span></td>');
echo('</tr>'); echo('</tr>');
@@ -23,17 +24,19 @@
$periods = array('day', 'week', 'month', 'year'); $periods = array('day', 'week', 'month', 'year');
echo('<tr bgcolor="'.$row_colour.'"><td>'); echo('<tr bgcolor="'.$row_colour.'"><td>');
foreach($periods as $period) {
foreach ($periods as $period)
{
$graph_array['from'] = $$period; $graph_array['from'] = $$period;
$graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400";
echo(overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); echo(overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL));
} }
echo("</td></tr>");
echo('</td></tr>');
$row++; $row++;
}
} echo('</table>');
echo("</table>");
?> ?>

View File

@@ -1,38 +1,43 @@
<?php <?php
$hostname = $device['hostname']; $hostname = $device['hostname'];
$hostid = $device['interface_id']; $hostid = $device['interface_id'];
$ifname = $interface['ifDescr']; $ifname = $interface['ifDescr'];
$ifIndex = $interface['ifIndex']; $ifIndex = $interface['ifIndex'];
$speed = humanspeed($interface['ifSpeed']); $speed = humanspeed($interface['ifSpeed']);
$ifalias = $interface['name']; $ifalias = $interface['name'];
if($interface['ifPhysAddress']) { $mac = "$interface[ifPhysAddress]"; } if ($interface['ifPhysAddress']) { $mac = "$interface[ifPhysAddress]"; }
$color = "black"; $color = "black";
if ($interface['ifAdminStatus'] == "down") { $status = "<span class='grey'>Disabled</span>"; } if ($interface['ifAdminStatus'] == "down") { $status = "<span class='grey'>Disabled</span>"; }
if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "down") { $status = "<span class='red'>Enabled / Disconnected</span>"; } if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "down") { $status = "<span class='red'>Enabled / Disconnected</span>"; }
if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "up") { $status = "<span class='green'>Enabled / Connected</span>"; } if ($interface['ifAdminStatus'] == "up" && $interface['ifOperStatus'] == "up") { $status = "<span class='green'>Enabled / Connected</span>"; }
$i = 1; $i = 1;
$inf = fixifName($ifname); $inf = fixifName($ifname);
echo("<div style='clear: both;'>"); echo("<div style='clear: both;'>");
if($_GET['optd'] == "top10") { if ($_GET['optd'] == "top10")
if($_GET['opte']) { {
if ($_GET['opte'])
{
$period = $_GET['opte']; $period = $_GET['opte'];
} else { $period = "1day"; } } else { $period = "1day"; }
$from = "-" . $period; $from = "-" . $period;
if($_GET['optc']) { if ($_GET['optc'])
{
$stat = $_GET['optc']; $stat = $_GET['optc'];
} else { $stat = "bits"; } } else { $stat = "bits"; }
if($_GET['optf']) {
if ($_GET['optf'])
{
$sort = $_GET['optf']; $sort = $_GET['optf'];
} else { $sort = "in"; } } else { $sort = "in"; }
echo("<div style='margin: 0px 0px 0px 0px'> echo("<div style='margin: 0px 0px 0px 0px'>
<div style=' margin:0px; float: left;';> <div style=' margin:0px; float: left;';>
<div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'> <div style='margin: 0px 10px 5px 0px; padding:5px; background: #e5e5e5;'>
@@ -114,38 +119,47 @@
</div> </div>
"); ");
unset($query); unset($query);
} else { }
else
{
$query = mysql_query("SELECT *, (M.cipMacHCSwitchedBytes_input_rate + M.cipMacHCSwitchedBytes_output_rate) as bps FROM `mac_accounting` AS M, $query = mysql_query("SELECT *, (M.cipMacHCSwitchedBytes_input_rate + M.cipMacHCSwitchedBytes_output_rate) as bps FROM `mac_accounting` AS M,
`ports` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id `ports` AS I, `devices` AS D WHERE M.interface_id = '".$interface['interface_id']."' AND I.interface_id = M.interface_id
AND I.device_id = D.device_id ORDER BY bps DESC"); AND I.device_id = D.device_id ORDER BY bps DESC");
while($acc = mysql_fetch_array($query)) { while ($acc = mysql_fetch_array($query))
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } {
if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'")); $addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'"));
$name = gethostbyaddr($addy['ipv4_address']); $name = gethostbyaddr($addy['ipv4_address']);
$arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$addy['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); $arp_host = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = '".$addy['ipv4_address']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
if($arp_host) { $arp_name = generate_device_link($arp_host); $arp_name .= " ".generate_port_link($arp_host); } else { unset($arp_if); } if ($arp_host) { $arp_name = generate_device_link($arp_host); $arp_name .= " ".generate_port_link($arp_host); } else { unset($arp_if); }
if($name == $addy['ipv4_address']) { unset ($name); } if ($name == $addy['ipv4_address']) { unset ($name); }
if(mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"),0)) { if (mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"),0))
{
$peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'"); $peer_query = mysql_query("SELECT * FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".$addy['ipv4_address']."'");
$peer_info = mysql_fetch_array($peer_query); $peer_info = mysql_fetch_array($peer_query);
} else { unset ($peer_info); } } else { unset ($peer_info); }
if($peer_info) { $asn = "AS".$peer_info['bgpPeerRemoteAs']; $astext = $peer_info['astext']; } else {
if ($peer_info)
{
$asn = "AS".$peer_info['bgpPeerRemoteAs']; $astext = $peer_info['astext'];
} else {
unset ($as); unset ($astext); unset($asn); unset ($as); unset ($astext); unset($asn);
} }
if($_GET['optc']) { if ($_GET['optc'])
{
$graph_type = "port_mac_acc_" . $_GET['optc']; $graph_type = "port_mac_acc_" . $_GET['optc'];
} else { } else {
$graph_type = "port_mac_acc_bits"; $graph_type = "port_mac_acc_bits";
} }
if($_GET['optd'] == "thumbs") { if ($_GET['optd'] == "thumbs")
{
if(!$asn) { $asn = "No Session"; } if (!$asn) { $asn = "No Session"; }
echo("<div style='display: block; padding: 3px; margin: 3px; min-width: 221px; max-width:221px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e5e5e5;'> echo("<div style='display: block; padding: 3px; margin: 3px; min-width: 221px; max-width:221px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e5e5e5;'>
".$addy['ipv4_address']." - ".$asn." ".$addy['ipv4_address']." - ".$asn."
@@ -158,8 +172,9 @@
<span style='font-size: 10px;'>".$name."</span> <span style='font-size: 10px;'>".$name."</span>
</div>"); </div>");
} else { }
else
{
echo("<div style='background-color: $row_colour; padding: 0px;'>"); echo("<div style='background-color: $row_colour; padding: 0px;'>");
echo(" echo("
@@ -197,8 +212,7 @@
echo("</div>"); echo("</div>");
$i++; $i++;
} }
} }
} }
?> ?>

View File

@@ -1,37 +1,35 @@
<?php <?php
global $config; global $config;
if(!$graph_type) { $graph_type = "pagp_bits"; } if (!$graph_type) { $graph_type = "pagp_bits"; }
$daily_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100"; $daily_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=215&height=100";
$daily_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150"; $daily_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
$weekly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100"; $weekly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=215&height=100";
$weekly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150"; $weekly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
$monthly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100"; $monthly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=215&height=100";
$monthly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150"; $monthly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
$yearly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100"; $yearly_traffic = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=215&height=100";
$yearly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150"; $yearly_url = $config['base_url'] . "/graph.php?port=" . $interface['interface_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
echo("<a href='/device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> echo("<a href='/device/".$device['device_id']."/interface/".$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='/device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> echo("<a href='/device/".$device['device_id']."/interface/".$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='/device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> echo("<a href='/device/".$device['device_id']."/interface/".$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='/device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> echo("<a href='/device/".$device['device_id']."/interface/".$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>");
$members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'");
while ($member = mysql_fetch_array($members))
$members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'"); {
while($member = mysql_fetch_array($members)) {
echo("$br<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generate_port_link($member) . " (PAgP)</strong>"); echo("$br<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generate_port_link($member) . " (PAgP)</strong>");
$br = "<br />"; $br = "<br />";
} }
?> ?>

View File

@@ -1,7 +1,8 @@
<?php <?php
if($_GET['opta'] == graphs ) { if ($_GET['opta'] == graphs )
if($_GET['optb']) { $graph_type = "port_" . $_GET['optb']; } else { $graph_type = "port_bits"; } {
if ($_GET['optb']) { $graph_type = "port_" . $_GET['optb']; } else { $graph_type = "port_bits"; }
} }
print_optionbar_start(); print_optionbar_start();
@@ -18,25 +19,26 @@ $graph_types = array("bits" => "Bits",
"errors" => "Errors", "errors" => "Errors",
"etherlike" => "Etherlike"); "etherlike" => "Etherlike");
foreach ($graph_types as $type => $descr) { foreach ($graph_types as $type => $descr)
{
echo("$type_sep echo("$type_sep
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/$type/'>$descr</a> <a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/$type/'>$descr</a>
(<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/$type/thumbs/'>Mini</a>) "); (<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ports/graphs/$type/thumbs/'>Mini</a>) ");
$type_sep = " | "; $type_sep = " | ";
} }
print_optionbar_end(); print_optionbar_end();
if($_GET['optc'] == thumbs) { if ($_GET['optc'] == thumbs)
{
$timeperiods = array('-1day','-1week','-1month','-1year'); $timeperiods = array('-1day','-1week','-1month','-1year');
$from = '-1day'; $from = '-1day';
echo("<div style='display: block; clear: both; margin: auto;'>"); echo("<div style='display: block; clear: both; margin: auto;'>");
$sql = "select * from ports WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex"; $sql = "select * from ports WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex";
$query = mysql_query($sql); $query = mysql_query($sql);
unset ($seperator); unset ($seperator);
while($interface = mysql_fetch_assoc($query)) { while ($interface = mysql_fetch_assoc($query))
{
echo("<div style='display: block; padding: 3px; margin: 3px; min-width: 183px; max-width:183px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e9e9e9;'> echo("<div style='display: block; padding: 3px; margin: 3px; min-width: 183px; max-width:183px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e9e9e9;'>
<div style='font-weight: bold;'>".makeshortif($interface['ifDescr'])."</div> <div style='font-weight: bold;'>".makeshortif($interface['ifDescr'])."</div>
<a href='device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('\ <a href='device/".$device['device_id']."/interface/".$interface['interface_id']."/' onmouseover=\"return overlib('\
@@ -51,26 +53,29 @@ if($_GET['optc'] == thumbs) {
} }
echo("</div>"); echo("</div>");
} else { } else {
if($_GET['opta'] == "arp" ) { if ($_GET['opta'] == "arp" )
{
include("arp.inc.php"); include("arp.inc.php");
} elseif($_GET['opta'] == "adsl") { } elseif ($_GET['opta'] == "adsl") {
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>"); echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
echo("<tr><th>Port</th><th>Traffic</th><th>Sync Speed</th><th>Attainable Speed</th><th>Attenuation</th><th>SNR Margin</th><th>Output Powers</th></tr>"); echo("<tr><th>Port</th><th>Traffic</th><th>Sync Speed</th><th>Attainable Speed</th><th>Attenuation</th><th>SNR Margin</th><th>Output Powers</th></tr>");
$i = "0"; $i = "0";
$interface_query = mysql_query("select * from `ports` AS P, `ports_adsl` AS A WHERE P.device_id = '".$device['device_id']."' AND A.interface_id = P.interface_id AND P.deleted = '0' ORDER BY `ifIndex` ASC"); $interface_query = mysql_query("select * from `ports` AS P, `ports_adsl` AS A WHERE P.device_id = '".$device['device_id']."' AND A.interface_id = P.interface_id AND P.deleted = '0' ORDER BY `ifIndex` ASC");
while($interface = mysql_fetch_assoc($interface_query)) { while ($interface = mysql_fetch_assoc($interface_query))
{
include("includes/print-interface-adsl.inc.php"); include("includes/print-interface-adsl.inc.php");
$i++; $i++;
} }
echo("</table></div>"); echo("</table></div>");
echo("<div style='min-height: 150px;'></div>"); echo("<div style='min-height: 150px;'></div>");
} else { } else {
if($_GET['opta'] == "details" ) { $port_details = 1; } if ($_GET['opta'] == "details" ) { $port_details = 1; }
echo("<div style='margin: 0px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>"); echo("<div style='margin: 0px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
$i = "1"; $i = "1";
$interface_query = mysql_query("select * from ports WHERE device_id = '".$device['device_id']."' AND deleted = '0' ORDER BY `ifIndex` ASC"); $interface_query = mysql_query("select * from ports WHERE device_id = '".$device['device_id']."' AND deleted = '0' ORDER BY `ifIndex` ASC");
while($interface = mysql_fetch_assoc($interface_query)) { while ($interface = mysql_fetch_assoc($interface_query))
{
include("includes/print-interface.inc.php"); include("includes/print-interface.inc.php");
$i++; $i++;
} }

View File

@@ -2,13 +2,14 @@
include("includes/geshi/geshi.php"); include("includes/geshi/geshi.php");
if($_SESSION['userlevel'] >= "7") { if ($_SESSION['userlevel'] >= "7")
{
if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); }
if(!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); } foreach ($config['rancid_configs'] as $configs)
{
foreach($config['rancid_configs'] as $configs) {
if ($configs[strlen($configs)-1] != '/') { $configs .= '/'; } if ($configs[strlen($configs)-1] != '/') { $configs .= '/'; }
if(is_file($configs . $device['hostname'])) { $file = $configs . $device['hostname']; } if (is_file($configs . $device['hostname'])) { $file = $configs . $device['hostname']; }
} }
$fh = fopen($file, 'r') or die("Can't open file"); $fh = fopen($file, 'r') or die("Can't open file");
@@ -24,6 +25,7 @@ if($_SESSION['userlevel'] >= "7") {
} }
$text = join("\n",$lines); $text = join("\n",$lines);
} }
$language = "ios"; $language = "ios";
$geshi = new GeSHi($text, $language); $geshi = new GeSHi($text, $language);
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS); $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);

View File

@@ -1,22 +1,20 @@
<?php <?php
if(mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '".$device['device_id']."'"), 0) > '0') { if (mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '".$device['device_id']."'"), 0) > '0')
{
echo("<div style='margin: 5px;'><table cellpadding=7 border=0 cellspacing=0 width=100%>"); echo("<div style='margin: 5px;'><table cellpadding=7 border=0 cellspacing=0 width=100%>");
$i = "1"; $i = "1";
$service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type"); $service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type");
while($service = mysql_fetch_array($service_query)) { while ($service = mysql_fetch_array($service_query))
{
include("includes/print-service.inc"); include("includes/print-service.inc");
} }
echo("</table></div>"); echo("</table></div>");
}
} else { else
{
echo("No Services"); echo("No Services");
} }
?> ?>

View File

@@ -14,9 +14,9 @@ print_optionbar_start('25');
<option value="">All Programs</option> <option value="">All Programs</option>
<?php <?php
$query = mysql_query("SELECT `program` FROM `syslog` WHERE device_id = '" . $_GET['id'] . "' GROUP BY `program` ORDER BY `program`"); $query = mysql_query("SELECT `program` FROM `syslog` WHERE device_id = '" . $_GET['id'] . "' GROUP BY `program` ORDER BY `program`");
while($data = mysql_fetch_array($query)) { while ($data = mysql_fetch_array($query)) {
echo("<option value='".$data['program']."'"); echo("<option value='".$data['program']."'");
if($data['program'] == $_POST['program']) { echo("selected"); } if ($data['program'] == $_POST['program']) { echo("selected"); }
echo(">".$data['program']."</option>"); echo(">".$data['program']."</option>");
} }
?> ?>
@@ -29,11 +29,13 @@ print_optionbar_start('25');
print_optionbar_end(); print_optionbar_end();
if($_POST['string']) { if ($_POST['string'])
{
$where = " AND msg LIKE '%".$_POST['string']."%'"; $where = " AND msg LIKE '%".$_POST['string']."%'";
} }
if($_POST['program']) { if ($_POST['program'])
{
$where .= " AND program = '".$_POST['program']."'"; $where .= " AND program = '".$_POST['program']."'";
} }
@@ -41,7 +43,7 @@ $sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog WHERE
$sql .= " ORDER BY timestamp DESC LIMIT 1000"; $sql .= " ORDER BY timestamp DESC LIMIT 1000";
$query = mysql_query($sql); $query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=2 width=100%>"); echo("<table cellspacing=0 cellpadding=2 width=100%>");
while($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); }
echo("</table>"); echo("</table>");
?> ?>

View File

@@ -11,14 +11,17 @@ echo("<div style='margin: auto; text-align: left; padding: 2px 5px; padding-left
print_optionbar_end(); print_optionbar_end();
echo('<table border="0" cellspacing="0" cellpadding="5" width="100%">');
echo("<table border=0 cellspacing=0 cellpadding=5 width=100%>"); $i = "1";
$i = "1"; $vlan_query = mysql_query("select * from vlans WHERE device_id = '".mres($_GET['id'])."' ORDER BY 'vlan_vlan'");
$vlan_query = mysql_query("select * from vlans WHERE device_id = '".$_GET['id']."' ORDER BY 'vlan_vlan'");
while($vlan = mysql_fetch_array($vlan_query)) { while ($vlan = mysql_fetch_array($vlan_query))
{
include("includes/print-vlan.inc.php"); include("includes/print-vlan.inc.php");
$i++; $i++;
} }
echo("</table>");
echo("</table>");
?> ?>

View File

@@ -11,14 +11,15 @@ echo("
"); ");
print_optionbar_end(); print_optionbar_end();
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>"); $i = "0";
$i = "0"; $vrf_query = mysql_query("select * from vrfs WHERE device_id = '".$_GET['id']."' ORDER BY 'vrf_name'");
$vrf_query = mysql_query("select * from vrfs WHERE device_id = '".$_GET['id']."' ORDER BY 'vrf_name'"); while ($vrf = mysql_fetch_array($vrf_query))
while($vrf = mysql_fetch_array($vrf_query)) { {
include("includes/print-vrf.inc"); include("includes/print-vrf.inc");
$i++; $i++;
} }
echo("</table></div>");
echo("</table></div>");
?> ?>