mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Initial Import
git-svn-id: http://www.observium.org/svn/observer/trunk@2 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
<?
|
||||
|
||||
$updated = '1';
|
||||
|
||||
$sql = "INSERT INTO `services` (`service_host`,`service_ip`,`service_type`,`service_desc`,`service_param`,`service_ignore`)
|
||||
VALUES ('" . $_POST['device']. "','" . $_POST['ip'] . "','" . $_POST['type'] . "',
|
||||
'" . $_POST['descr'] . "','" . $_POST['params'] . "','0')";
|
||||
|
||||
$query = mysql_query($sql);
|
||||
$affected = mysql_affected_rows() . "records affected";
|
||||
|
||||
$message .= $message_break . "Service added!";
|
||||
$message_break .= "<br />"
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,9 @@
|
||||
<script type="text/javascript" src="ajaxtabs/ajaxtabs.js">
|
||||
|
||||
/***********************************************
|
||||
* Ajax Tabs Content script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
|
||||
* This notice MUST stay intact for legal use
|
||||
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
|
||||
***********************************************/
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
if($_GET['logout']) {
|
||||
session_start();
|
||||
session_destroy();
|
||||
header('Location: /');
|
||||
setcookie ("username", "", time() - 3600);
|
||||
setcookie ("encrypted", "", time() - 3600);
|
||||
echo("$_COOKIE[username]");
|
||||
|
||||
} else {
|
||||
|
||||
session_start();
|
||||
|
||||
if($_POST['username'] && $_POST['password']){
|
||||
$_SESSION['username']=$_POST['username'];
|
||||
$_SESSION['password']=$_POST['password'];
|
||||
$password = $_SESSION['password'];
|
||||
$encrypted = md5($password);
|
||||
} elseif($_COOKIE['username'] && $_COOKIE['encrypted'] && !$_SESSION['authenticated']) {
|
||||
$_SESSION['username']=$_COOKIE['username'];
|
||||
$encrypted=$_COOKIE['encrypted'];
|
||||
}
|
||||
|
||||
$sql = "select username, level from users where username='$_SESSION[username]' and password='$encrypted'";
|
||||
$row = mysql_fetch_row(mysql_query($sql));
|
||||
|
||||
if ( $_SESSION['username'] != "" && $row[0] == $_SESSION['username'] ) {
|
||||
$_SESSION['userlevel'] = $row[1];
|
||||
$_SESSION['authenticated'] = true;
|
||||
setcookie("username", $username);
|
||||
setcookie("encrypted", $encrypted);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
if($device['uptime'] < '86400') { $uptime_colour = $warn_colour_a; }
|
||||
|
||||
echo("
|
||||
<table width=100% cellspacing=0 cellpadding=0>
|
||||
<tr><td class=tablehead>Operating System</td><td>$device[os] $device[version] ($device[features])</td></tr>
|
||||
<tr><td class=tablehead>Hardware </td><td>$device[hardware]</td></tr>
|
||||
<tr><td class=tablehead>Uptime </td><td bgcolor=$uptime_colour>" . formatuptime($device[uptime]) . "</td></tr>
|
||||
</table>
|
||||
");
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
if($_SESSION[userlevel] < '5') {
|
||||
print_error("Insufficient Privileges");
|
||||
} else {
|
||||
|
||||
if($_POST['editing']) {
|
||||
if($userlevel > "5") {
|
||||
include("includes/edit-host.inc");
|
||||
}
|
||||
}
|
||||
|
||||
if($_POST['addsrv']) {
|
||||
if($userlevel > "5") {
|
||||
include("includes/add-srv.inc");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `id` = '$_GET[id]'"));
|
||||
$descr = $device['purpose'];
|
||||
|
||||
if($updated) { print_message("Device Settings Saved"); }
|
||||
|
||||
if($device['type'] == 'server') { $server_select = "selected"; }
|
||||
if($device['type'] == 'network') { $network_select = "selected"; }
|
||||
if($device['type'] == 'firewall') { $firewall_select = "selected"; }
|
||||
if($device['type'] == 'workstation') { $workstation_select = "selected"; }
|
||||
if($device['type'] == 'other') { $other_select = "selected"; }
|
||||
|
||||
echo("<table cellpadding=0 cellspacing=0><tr><td>
|
||||
|
||||
<h4>Edit Device</h4>
|
||||
|
||||
<form id='edit' name='edit' method='post' action=''>
|
||||
<input type=hidden name='editing' value='yes'>
|
||||
<table width='200' border='0'>
|
||||
<tr>
|
||||
<td width='300'><div align='right'>Description</div></td>
|
||||
<td colspan='3'><textarea name='descr' cols='50'>$descr</textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Type
|
||||
</td>
|
||||
<td>
|
||||
<select name='type'>
|
||||
<option value='server' $server_select>Server</option>
|
||||
<option value='network' $network_select>Network</option>
|
||||
<option value='firewall' $firewall_select>Firewall</option>
|
||||
<option value='workstation' $workstation_select>Workstation</option>
|
||||
<option value='other' $other_select>Other</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='300'><div align='right'>Disable</div></td>
|
||||
<td width='300'><input name='disable' type='checkbox' id='disable' value='1'");
|
||||
if($device['disabled']) {echo("checked=checked");}
|
||||
echo("/></td>
|
||||
<td width='300'><div align='right'>Ignore</div></td>
|
||||
<td width='300'><input name='ignore' type='checkbox' id='disable' value='1'");
|
||||
if($device['ignore']) {echo("checked=checked");}
|
||||
echo("/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='300'><div align='right'>Apache</div></td>
|
||||
<td width='300'><label>
|
||||
<input name='apache' type='checkbox' id='apache' value='1'");
|
||||
|
||||
if($device['apache']) {echo("checked=checked");}
|
||||
|
||||
echo("/>
|
||||
</label></td>
|
||||
<td width='300'><div align='right'>Temp</div></td>
|
||||
<td width='300'><input name='temp' type='checkbox' id='temp' value='1'");
|
||||
if($device['temp']) {echo("checked=checked");}
|
||||
echo("/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type='submit' name='Submit' value='Save' />
|
||||
<label><br />
|
||||
</label>
|
||||
</form></td>
|
||||
<td width=50></td><td>");
|
||||
|
||||
$srvdir = $installdir . "/includes/services/";
|
||||
|
||||
if ($handle = opendir($srvdir)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != "..") {
|
||||
$services[] = $file;
|
||||
$servicesform .= "<option value='$file'>$file</option>";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
echo("
|
||||
|
||||
<h4>Add Service</h4>
|
||||
|
||||
<form id='addsrv' name='addsrv' method='post' action=''>
|
||||
<input type=hidden name='addsrv' value='yes'>
|
||||
<table width='200' border='0'>
|
||||
<td>
|
||||
Type
|
||||
</td>
|
||||
<td>
|
||||
<select name='type'>
|
||||
$servicesform
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='300'><div align='right'>Description</div></td>
|
||||
<td colspan='2'><textarea name='descr' cols='50'></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='300'><div align='right'>IP Address</div></td>
|
||||
<td colspan='2'><input name='ip'></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='300'><div align='right'>Parameters</div></td>
|
||||
<td colspan='2'><input name='params'></textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
</table>
|
||||
<input type='submit' name='Submit' value='Add' />
|
||||
<label><br />
|
||||
</label>
|
||||
</form>");
|
||||
|
||||
echo("</td></tr></table>");
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?
|
||||
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` WHERE `host` = '$_GET[id]' ORDER BY `datetime` DESC LIMIT 0,250";
|
||||
$data = mysql_query($query);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=1 width=100%>");
|
||||
|
||||
while($entry = mysql_fetch_array($data)) {
|
||||
|
||||
include("includes/print-event.inc");
|
||||
|
||||
}
|
||||
echo("</table>");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,189 @@
|
||||
<?
|
||||
|
||||
$device_query = mysql_query("select * from devices WHERE id = '$_GET[id]'");
|
||||
while($device = mysql_fetch_array($device_query)) {
|
||||
$hostname = $device[hostname];
|
||||
$bg="#ffffff";
|
||||
|
||||
|
||||
echo("<div style='clear: both;'>");
|
||||
|
||||
switch ($device['os']) {
|
||||
case "ProCurve":
|
||||
echo("<div class=graphhead>Processor Utilisation</div>");
|
||||
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>Memory Usage</div>");
|
||||
$graph_type = "mem"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>Device Uptime</div>");
|
||||
$graph_type = "uptime"; include ("includes/print-device-graph.php"); break;
|
||||
echo("<br />");
|
||||
|
||||
break;
|
||||
case "Windows":
|
||||
$graph_type = "cpu";
|
||||
include ("includes/print-device-graph.php");
|
||||
|
||||
$memgraph = memgraphWin ($device[hostname] . "-mem.rrd", $device[hostname] . "-mem.png", $day, $now, 335, 100);
|
||||
$loadgraph = loadgraphWin ($device[hostname] . "-load.rrd", $device[hostname] . "-load.png", $day, $now, 335, 100);
|
||||
$cpugraphm = cpugraphWin ($device[hostname] . "-cpu.rrd", $device[hostname] . "-cpu-m.png", $month, $now, 335, 100);
|
||||
$memgraphm = memgraphWin ($device[hostname] . "-mem.rrd", $device[hostname] . "-mem-m.png", $month, $now, 335, 100);
|
||||
$loadgraphm = loadgraphWin ($device[hostname] . "-load.rrd", $device[hostname] . "-load-m.png", $month, $now, 335, 100);
|
||||
$usersgraph = usersgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-users.png", $day, $now, 335, 100);
|
||||
$usersgraphm = usersgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-users-m.png", $month, $now, 335, 100);
|
||||
$procsgraph = procsgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-procs.png", $day, $now, 335, 100);
|
||||
$procsgraphm = procsgraphWin ($device[hostname] . "-sys.rrd", $device[hostname] . "-procs-m.png", $month, $now, 335, 100);
|
||||
break;
|
||||
case "FreeBSD":
|
||||
case "NetBSD":
|
||||
case "Linux":
|
||||
case "m0n0wall":
|
||||
case "Voswall":
|
||||
case "DragonFly":
|
||||
case "OpenBSD":
|
||||
case "pfSense":
|
||||
echo("<div class=graphhead>Processor Utilisation</div>");
|
||||
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
if($device[os] == "m0n0wall" || $device[os] == "pfSense" || $device[os] == "Voswall" || $device[monowall]) {
|
||||
echo("<div class=graphhead>Device Uptime</div>");
|
||||
$graph_type = "uptime"; include ("includes/print-device-graph.php"); break;
|
||||
echo("<br />");
|
||||
}
|
||||
if($device['os'] != "NetBSD") {
|
||||
echo("<div class=graphhead>Memory Utilisation</div>");
|
||||
$graph_type = "mem"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
}
|
||||
|
||||
if(mysql_result(mysql_query("SELECT count(storage_id) FROM storage WHERE host_id = '$device[id]'"),0)) {
|
||||
echo("<div class=graphhead>Storage</div>");
|
||||
$graph_type = "unixfs"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
}
|
||||
|
||||
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '$device[id]'"),0)) {
|
||||
echo("<div class=graphhead>Temperatures</div>");
|
||||
$graph_type = "temp"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
}
|
||||
echo("<div class=graphhead>IP Statistics</div>");
|
||||
$graph_type = "ip_graph"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>TCP Statistics</div>");
|
||||
$graph_type = "tcp_graph"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>UDP Statistics</div>");
|
||||
$graph_type = "udp_graph"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>ICMP Statistics</div>");
|
||||
$graph_type = "icmp_graph"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>System Load</div>");
|
||||
$graph_type = "load"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>Users Logged On</div>");
|
||||
$graph_type = "users"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>Running Processes</div>");
|
||||
$graph_type = "procs"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
if($device[postfix] == '1') {
|
||||
echo("<div class=graphhead>Postfix Mail Statistics</div>");
|
||||
$graph_type = "postfix"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>Postfix Mail Error Statistics</div>");
|
||||
$graph_type = "postfixerrors"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
}
|
||||
if($device[courier] == '1') {
|
||||
echo("<div class=graphhead>Postfix Mail Statistics</div>");
|
||||
$graph_type = "courier"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
}
|
||||
if($device[apache] == '1') {
|
||||
echo("<div class=graphhead>Apache Hits</div>");
|
||||
$graph_type = "apachehits"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>Apache Traffic</div>");
|
||||
$graph_type = "apachebits"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
}
|
||||
echo("<div class=graphhead>Device Uptime</div>");
|
||||
$graph_type = "uptime"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
break;
|
||||
case "IOS":
|
||||
echo("<div class=graphhead>CPU Usage</div>");
|
||||
$graph_type = "cpu"; include ("includes/print-device-graph.php");
|
||||
echo("<div class=graphhead>Memory Usage</div>");
|
||||
echo("<br />");
|
||||
$graph_type = "mem"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
if(mysql_result(mysql_query("SELECT count(*) FROM temperature WHERE temp_host = '$device[id]'"),0)) {
|
||||
echo("<div class=graphhead>Temperatures</div>");
|
||||
$graph_type = "temp"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
}
|
||||
echo("<div class=graphhead>IP Statistics</div>");
|
||||
$graph_type = "ip_graph"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>TCP Statistics</div>");
|
||||
$graph_type = "tcp_graph"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>UDP Statistics</div>");
|
||||
$graph_type = "udp_graph"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>ICMP Statistics</div>");
|
||||
$graph_type = "icmp_graph"; include ("includes/print-device-graph.php");
|
||||
echo("<br />");
|
||||
echo("<div class=graphhead>Uptime</div>");
|
||||
$graph_type = "uptime"; include ("includes/print-device-graph.php");
|
||||
break;
|
||||
case "Snom":
|
||||
echo("<div class=graphhead>Calls</div>");
|
||||
$graph_type = "calls"; include ("includes/print-device-graph.php");
|
||||
}
|
||||
|
||||
if($memgraph) {
|
||||
echo("<img src='$memgraph'> <img src='$memgraphm'>");
|
||||
}
|
||||
if($storagegraph) {
|
||||
echo("$storagegraph");
|
||||
}
|
||||
if($loadgraph) {
|
||||
echo("<img src='$loadgraph'> <img src='$loadgraphm'>");
|
||||
}
|
||||
if($tempgraph) {
|
||||
echo("<img src='$tempgraph'> <img src='$tempgraphm'>");
|
||||
}
|
||||
if($mailsgraph) {
|
||||
echo("<img src='$mailsgraph'> <img src='$mailsgraphm'>");
|
||||
}
|
||||
if($mailerrorgraph) {
|
||||
echo("<img src='$mailerrorgraph'> <img src='$mailerrorgraphm'>");
|
||||
}
|
||||
if($couriergraph) {
|
||||
echo("<img src='$couriergraph'> <img src='$couriergraphm'>");
|
||||
}
|
||||
if($ahitsgraph) {
|
||||
echo("<img src='$ahitsgraph'> <img src='$ahitsgraphm'>");
|
||||
}
|
||||
if($abitsgraph) {
|
||||
echo("<img src='$abitsgraph'> <img src='$abitsgraphm'>");
|
||||
}
|
||||
if($usersgraph) {
|
||||
echo("<img src='$usersgraph'> <img src='$usersgraphm'>");
|
||||
}
|
||||
if($procsgraph) {
|
||||
echo("<img src='$procsgraph'> <img src='$procsgraphm'>");
|
||||
}
|
||||
if($uptimegraph) {
|
||||
echo("<img src='$uptimegraph'> <img src='$uptimegraphm'>");
|
||||
}
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$dographs = 1;
|
||||
|
||||
include("includes/dev-ifs.inc");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
$hostname = gethostbyid($_GET[id]);
|
||||
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
$i = "1";
|
||||
$interface_query = mysql_query("select * from interfaces WHERE host = '$_GET[id]' ORDER BY 'ifIndex'");
|
||||
while($interface = mysql_fetch_array($interface_query)) {
|
||||
include("includes/print-interface.inc");
|
||||
}
|
||||
echo("</table></div>");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
$overview = 1;
|
||||
|
||||
$id = $_GET[id];
|
||||
|
||||
$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE id = '$_GET[id]'"));
|
||||
|
||||
$interfaces['total'] = mysql_result(mysql_query("SELECT count(id) FROM interfaces WHERE host = '$id'"),0);
|
||||
$interfaces['up'] = mysql_result(mysql_query("SELECT count(id) FROM interfaces WHERE host = '$id' AND up = 'up'"),0);
|
||||
$interfaces['down'] = mysql_result(mysql_query("SELECT count(id) FROM interfaces WHERE host = '$id' AND up = 'down' AND up_admin = 'up'"),0);
|
||||
$interfaces['disabled'] = mysql_result(mysql_query("SELECT count(id) FROM interfaces WHERE host = '$id' AND up_admin = 'down'"),0);
|
||||
|
||||
$services['total'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_host = '$id'"),0);
|
||||
$services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_host = '$id' AND service_status = '1' AND service_ignore ='0'"),0);
|
||||
$services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_host = '$id' AND service_status = '0' AND service_ignore = '0'"),0);
|
||||
$services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_host = '$id' AND service_ignore = '1'"),0);
|
||||
|
||||
if($services['down']) { $services_colour = $warn_colour_a; } else { $services_colour = $list_colour_a; }
|
||||
if($interfaces['down']) { $interfaces_colour = $warn_colour_a; } else { $interfaces_colour = $list_colour_a; }
|
||||
|
||||
echo("
|
||||
<table width=100% cellspacing=0 cellpadding=0>
|
||||
<tr><td width=50% valign=top>");
|
||||
|
||||
|
||||
if(file_exists("includes/dev-data-" . strtolower($device[os]) . ".inc")) {
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p class=sectionhead>Device Data</p><div style='height: 5px;'></div>");
|
||||
include("includes/dev-data-" . strtolower($device[os]) . ".inc");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '%d/%b/%y %T') as humandate FROM `eventlog` WHERE `host` = '$_GET[id]' ORDER BY `datetime` DESC LIMIT 0,10";
|
||||
$data = mysql_query($query);
|
||||
|
||||
echo("<p class=sectionhead>Recent Events</p><div style='height: 5px;'></div>
|
||||
<table cellspacing=0 cellpadding=2 width=100%>");
|
||||
|
||||
while($entry = mysql_fetch_array($data)) {
|
||||
|
||||
include("includes/print-event.inc");
|
||||
|
||||
}
|
||||
echo("</table></div>");
|
||||
|
||||
echo("</td><td width=50% valign=top>");
|
||||
|
||||
if($interfaces['total']) {
|
||||
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p class=sectionhead>Interfaces</p><div style='height: 5px;'></div>");
|
||||
|
||||
echo("
|
||||
<table class=tablehead cellpadding=2 cellspacing=0 width=100%>
|
||||
<tr bgcolor=$interfaces_colour align=center><td></td>
|
||||
<td width=25%><img src='images/16/connect.png' align=absmiddle> $interfaces[total]</td>
|
||||
<td width=25% class=green><img src='images/16/if-connect.png' align=absmiddle> $interfaces[up]</td>
|
||||
<td width=25% class=red><img src='images/16/if-disconnect.png' align=absmiddle> $interfaces[down]</td>
|
||||
<td width=25% class=grey><img src='images/16/if-disable.png' align=absmiddle> $interfaces[disabled]</td></tr>
|
||||
</table>");
|
||||
|
||||
echo("<div style='margin: 8px; font-size: 11px; font-weight: bold;'>");
|
||||
|
||||
$sql = "SELECT * FROM interfaces WHERE host = '$id'";
|
||||
$query = mysql_query($sql);
|
||||
while($data = mysql_fetch_array($query)) {
|
||||
$up_admin = $data['up_admin'];
|
||||
$up = $data['up'];
|
||||
if ($up_admin == "down") { $status = "grey"; }
|
||||
if ($up_admin == "up" && $up == "down") { $status = "red"; }
|
||||
if ($up_admin == "up" && $up == "up") { $status = "blue"; }
|
||||
echo("$ifbreak<a class=$status>" . generateiflink($data, makeshortif(strtolower($data['if']))) . "</a>");
|
||||
$ifbreak = ", ";
|
||||
}
|
||||
unset($break);
|
||||
echo("</div>");
|
||||
|
||||
echo("</div>");
|
||||
|
||||
}
|
||||
|
||||
if($services['total']) {
|
||||
|
||||
echo("<div style='background-color: #eeeeee; margin: 5px; padding: 5px;'>");
|
||||
echo("<p class=sectionhead>Services</p><div style='height: 5px;'></div>");
|
||||
|
||||
echo("
|
||||
<table class=tablehead cellpadding=2 cellspacing=0 width=100%>
|
||||
<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% class=green><img src='images/16/cog_go.png' align=absmiddle> $services[up]</td>
|
||||
<td width=25% class=red><img src='images/16/cog_error.png' align=absmiddle> $services[down]</td>
|
||||
<td width=25% class=grey><img src='images/16/cog_disable.png' align=absmiddle> $services[disabled]</td></tr>
|
||||
</table>");
|
||||
|
||||
|
||||
|
||||
echo("<div style='padding: 8px; font-size: 11px; font-weight: bold;'>");
|
||||
|
||||
$sql = "SELECT * FROM services WHERE service_host = '$id' ORDER BY service_type";
|
||||
$query = mysql_query($sql);
|
||||
while($data = mysql_fetch_array($query)) {
|
||||
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] == "0" && $data[service_ignore] == "0") { $status = "red"; }
|
||||
if ($data[service_status] == "1" && $data[service_ignore] == "0") { $status = "blue"; }
|
||||
echo("$break<a class=$status>" . strtolower($data[service_type]) . "</a>");
|
||||
$break = ", ";
|
||||
}
|
||||
|
||||
echo("</div>");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo("</td></tr></table>");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?
|
||||
|
||||
$hostname = gethostbyid($_GET[id]);
|
||||
|
||||
if(mysql_result(mysql_query("select count(service_id) from services WHERE service_host = '$_GET[id]'"), 0) > '0') {
|
||||
|
||||
echo("<div style='margin: 5px;'><table cellpadding=7 border=0 cellspacing=0 width=100%>");
|
||||
$i = "1";
|
||||
$service_query = mysql_query("select * from services WHERE service_host = '$_GET[id]' ORDER BY service_type");
|
||||
while($service = mysql_fetch_array($service_query)) {
|
||||
|
||||
include("includes/print-service.inc");
|
||||
}
|
||||
echo("</table></div>");
|
||||
|
||||
} else {
|
||||
|
||||
echo("No Services");
|
||||
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?
|
||||
|
||||
$query = "SELECT * FROM `syslog` WHERE `host` = '$_GET[id]' ORDER BY `datetime` DESC LIMIT 0,250";
|
||||
$data = mysql_query($query);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=1 width=100%>");
|
||||
|
||||
while($entry = mysql_fetch_array($data)) {
|
||||
|
||||
include("includes/print-syslog.inc");
|
||||
|
||||
}
|
||||
echo("</table>");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
if ($device['status'] == '0') { $class = "list-device-down"; } else { $class = "list-device"; }
|
||||
if ($device['ignore'] == '1') {
|
||||
$class = "list-device-ignored";
|
||||
if ($device['status'] == '1') { $class = "list-device-ignored-up"; }
|
||||
}
|
||||
$type = strtolower($device['os']);
|
||||
unset($image);
|
||||
|
||||
$image = getImage($device[id]);
|
||||
|
||||
echo("
|
||||
<tr >
|
||||
<td width='40' align=center valign=middle>$image</td>
|
||||
<td valign=middle><span style='font-weight: bold; font-size: 20px;'>" . generatedevicelink($device) . "</span>
|
||||
<br />$device[purpose]</td>
|
||||
<td></td>
|
||||
</tr>");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?
|
||||
|
||||
$updated = '1';
|
||||
|
||||
$descr = $_POST['descr'];
|
||||
$apache = $_POST['apache'];
|
||||
$temp = $_POST['temp'];
|
||||
$ignore = $_POST['ignore'];
|
||||
$type = $_POST['type'];
|
||||
|
||||
$sql = "UPDATE `devices` SET `purpose` = '$descr', `apache` = '$apache', `temp` = '$temp', `type` = '$type', `ignore` = '$ignore' WHERE `id` = '$_GET[id]'";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
$affected = mysql_affected_rows() . "records affected";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
$type = strtolower($device['os']);
|
||||
if(file_exists("images/os/$type" . ".gif")){ $image = "<img src='/images/os/$type.gif'>"; }
|
||||
|
||||
echo("<table cellpadding=0 cellspacing=0 class=devicetable width=100%>");
|
||||
echo("
|
||||
<tr bgcolor='#e5e5e5'>
|
||||
<td width='40' align=center valign=middle>$image</td>
|
||||
<td width='250' style='font-weight: bold;'><a class='$class' href='?page=device&id=$device[id]'>$device[hostname]</a>
|
||||
<br />$device[hardware]</td>
|
||||
<td width='150'>$device[os] $device[version]<br />
|
||||
$device[features]</td>
|
||||
<td>$device[location]<br />
|
||||
Up " . formatUptime($device[uptime]) ."</td>
|
||||
<td>");
|
||||
|
||||
if($_GET['page'] == 'device') {
|
||||
if($_GET['graphs'] == 'yes') {
|
||||
echo("<p class=interface><a href='?page=device&id=$_GET[id]'>
|
||||
<img src='/images/neu/hide-graphs.png' border=0 align=absmiddle> Hide Graphs</a></p>");
|
||||
} else {
|
||||
echo("<p class=interface><a href='?page=device&id=$_GET[id]&graphs=yes'>
|
||||
<img src='/images/neu/show-graphs.png' border=0 align=absmiddle> Show Graphs</a></p>");
|
||||
}
|
||||
}
|
||||
|
||||
echo(" </tr>");
|
||||
|
||||
echo("</table>");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg = $list_colour_a; }
|
||||
if ($device['status'] == '0') { $class = "list-device-down"; } else { $class = "list-device"; }
|
||||
if ($device['ignore'] == '1') {
|
||||
$class = "list-device-ignored";
|
||||
if ($device['status'] == '1') { $class = "list-device-ignored-up"; }
|
||||
}
|
||||
$type = strtolower($device['os']);
|
||||
unset($image);
|
||||
|
||||
$image = getImage($device[id]);
|
||||
|
||||
echo("
|
||||
<tr bgcolor='$bg'>
|
||||
<td width='40' align=center valign=middle>$image</td>
|
||||
<td width='300'><span style='font-weight: bold; font-size: 14px;'>" . generatedevicelink($device) . "</span>
|
||||
<br />$device[purpose]</td>
|
||||
<td width='200'>$device[os]<br />
|
||||
$device[version]</td>
|
||||
<td width='200'>$device[hardware]<br />
|
||||
$device[features]</td>
|
||||
<td>" . formatUptime($device[uptime]) . "
|
||||
<br />
|
||||
$device[location]</td>
|
||||
<td width=10>
|
||||
</td>
|
||||
</tr>");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$iftype = fixiftype($interface[ifType]);
|
||||
|
||||
echo ("<p class=interface-header>$inf</p>");
|
||||
if($ifalias && $ifalias != "") { echo("<span class=box-desc>$ifalias</span><br />"); }
|
||||
if($iftype && $iftype != "") { echo("<span class=box-desc>$iftype</span> ");
|
||||
if($mac && $mac != "") { echo("<span class=box-desc>$mac</span><br />");
|
||||
} else { echo("<br />"); }
|
||||
}
|
||||
|
||||
if($interface[ifType] != "softwareLoopback") {
|
||||
if($speed == '0') { $speed = "0bps"; }
|
||||
echo("<span class=box-desc>$speed");
|
||||
if($interface[ifDuplex] != unknown) { echo(" / $interface[ifDuplex]-duplex"); }
|
||||
if($interface[ifMtu] && $interface[ifMtu] != "") { echo(" / $interface[ifMtu]MTU</span>"); }
|
||||
echo("</span>");
|
||||
}
|
||||
|
||||
echo ("<span class=box-desc><b>$status</b></span>");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
$daily_traffic = "graph.php?host=$device[id]&type=$graph_type&from=$day&to=$now&width=215&height=100";
|
||||
$daily_url = "graph.php?host=$device[id]&type=$graph_type&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_traffic = "graph.php?host=$device[id]&type=$graph_type&from=$week&to=$now&width=215&height=100";
|
||||
$weekly_url = "graph.php?host=$device[id]&type=$graph_type&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_traffic = "graph.php?host=$device[id]&type=$graph_type&from=$month&to=$now&width=215&height=100";
|
||||
$monthly_url = "graph.php?host=$device[id]&type=$graph_type&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_traffic = "graph.php?host=$device[id]&type=$graph_type&from=$year&to=$now&width=215&height=100";
|
||||
$yearly_url = "graph.php?host=$device[id]&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_traffic' border=0></a> ");
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$weekly_traffic' border=0></a> ");
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$monthly_traffic' border=0></a> ");
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$yearly_traffic' border=0></a>");
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
<?
|
||||
|
||||
if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
|
||||
|
||||
$hostname = gethostbyid($entry['host']);
|
||||
$interface = fixifname(getifbyid($entry['interface']));
|
||||
|
||||
unset($icon);
|
||||
|
||||
$icon = geteventicon($entry['message']);
|
||||
if($icon) {$icon = "<img src='/images/16/$icon'>"; }
|
||||
|
||||
|
||||
echo("<tr style=\"background-color: $bg\">
|
||||
<td width=0></td>
|
||||
<td class=syslog width=130>
|
||||
$entry[humandate]
|
||||
</td>");
|
||||
$if['id'] = $entry[interface];
|
||||
$if['if'] = $interface;
|
||||
echo("<td class=list-bold>
|
||||
" . generateiflink($if) . "
|
||||
</td>
|
||||
<td width=30 align=center>$icon</td>
|
||||
<td class=syslog>
|
||||
$entry[message]
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>");
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
<?
|
||||
|
||||
if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
|
||||
|
||||
$hostname = gethostbyid($entry['host']);
|
||||
$interface = fixifname(getifbyid($entry['interface']));
|
||||
|
||||
unset($icon);
|
||||
|
||||
$icon = geteventicon($entry['message']);
|
||||
if($icon) {$icon = "<img src='/images/16/$icon'>"; }
|
||||
|
||||
|
||||
echo("<tr style=\"background-color: $bg\">
|
||||
<td width=0></td>
|
||||
<td class=syslog width=180>
|
||||
$entry[humandate]
|
||||
</td>");
|
||||
if(!$_GET[id] && !$overview) {
|
||||
$dev['id'] = $entry['host'];
|
||||
$dev['hostname'] = $hostname;
|
||||
echo("<td class=list-bold width=250>
|
||||
" . generatedevicelink($dev) . "
|
||||
</td>");
|
||||
}
|
||||
|
||||
$if['id'] = $entry[interface];
|
||||
$if['if'] = $interface;
|
||||
echo("<td class=list-bold width=175>
|
||||
" . generateiflink($if) . "
|
||||
</td>
|
||||
<td width=20>$icon</td>
|
||||
<td class=syslog>
|
||||
$entry[message]
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>");
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
$daily_traffic = "graph.php?if=$iid&type=$graph_type&from=$day&to=$now&width=217&height=100";
|
||||
$daily_url = "graph.php?if=$iid&type=$graph_type&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_traffic = "graph.php?if=$iid&type=$graph_type&from=$week&to=$now&width=217&height=100";
|
||||
$weekly_url = "graph.php?if=$iid&type=$graph_type&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_traffic = "graph.php?if=$iid&type=$graph_type&from=$month&to=$now&width=217&height=100";
|
||||
$monthly_url = "graph.php?if=$iid&type=$graph_type&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_traffic = "graph.php?if=$iid&type=$graph_type&from=$year&to=$now&width=217&height=100";
|
||||
$yearly_url = "graph.php?if=$iid&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
||||
|
||||
echo("<a href='?page=interface&id=$iid' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_traffic' border=0></a> ");
|
||||
echo("<a href='?page=interface&id=$iid' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$weekly_traffic' border=0></a> ");
|
||||
echo("<a href='?page=interface&id=$iid' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$monthly_traffic' border=0></a> ");
|
||||
echo("<a href='?page=interface&id=$iid' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
|
||||
<img src='$yearly_traffic' border=0></a>");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
# This file prints a table row for each interface
|
||||
|
||||
$if_id = $interface['id'];
|
||||
$inf = fixifName($interface['if']);
|
||||
$ifIndex = $interface['ifIndex'];
|
||||
$ifclass = ifclass($interface['up'], $interface['up_admin']);
|
||||
$ifname = $interface['name'];
|
||||
$speed = humanspeed($interface['ifSpeed']);
|
||||
$mac = $interface['ifPhysAddress'];
|
||||
if($ifname) {$ifname = $ifname . "</br>";}
|
||||
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||
$graph_url = "graph.php?if=$if_id&from=$twoday&to=$now&width=400&height=120&type=bits";
|
||||
echo("<tr style=\"background-color: $bg; padding: 5px;\" valign=top>
|
||||
<td valign=top width=275>
|
||||
<span class=list-large><a onmouseover=\"return overlib('<img src=\'$graph_url\'>');\" onmouseout=\"return nd();\"
|
||||
class='$ifclass' href='?page=interface&id=$interface[id]'>
|
||||
$i. $inf
|
||||
</a></span><br /><span class=interface-desc>$ifname</span>");
|
||||
unset ($break);
|
||||
$iftype = fixiftype($interface[ifType]);
|
||||
if(!$dographs) {
|
||||
$ipdata = mysql_query("SELECT * FROM `ipaddr` WHERE `interface_id` = '$interface[id]'");
|
||||
while($ip = mysql_fetch_Array($ipdata)) {
|
||||
echo("$break <a class=interface-desc href=\"javascript:popUp('/netcmd.php?cmd=whois&query=$ip[addr]')\">$ip[addr]/$ip[cidr]</a>");
|
||||
$break = " ";
|
||||
}
|
||||
echo("</span>");
|
||||
echo("</td><td width=80>");
|
||||
if($speed && $speed != "") { echo("<span class=box-desc>$speed</span>"); }
|
||||
echo("</td><td width=80>");
|
||||
if($iftype && $iftype != "") { echo("<span class=box-desc>$iftype</span>"); } else { echo("-"); }
|
||||
echo("</td><td width=80>");
|
||||
if($mac && $mac != "") { echo("<span class=box-desc>$mac</span>"); } else { echo("-"); }
|
||||
echo("</td><td width=80>");
|
||||
if($interface[ifMtu] && $interface[ifMtu] != "") { echo("<span class=box-desc>MTU $interface[ifMtu]</span>"); } else { echo("-"); }
|
||||
|
||||
# if($interface[ifDuplex] != unknown) { echo("<span class=box-desc>Duplex $interface[ifDuplex]</span>"); } else { echo("-"); }
|
||||
}
|
||||
|
||||
echo("</td>");
|
||||
echo("<td valign=top class=interface-desc>");
|
||||
if ( strpos($inf, "oopback") === false && !$dographs) {
|
||||
$link_query = mysql_query("select I.if, D.hostname, D.id AS dev_id, I.id from links AS L, interfaces AS I, devices AS D WHERE L.src_if = '$if_id' AND L.dst_if = I.id AND I.host = D.id");
|
||||
while($link = mysql_fetch_array($link_query)) {
|
||||
echo("<img src='images/16/connect.png' align=absmiddle alt='Directly Connected' /> " . generateiflink($link) . " on " . generatedevicelink($link) . "</a><br />");
|
||||
$br = "<br />";
|
||||
}
|
||||
unset($br);
|
||||
$adj_sql = "SELECT * FROM networks AS N, interfaces AS I, adjacencies AS A ";
|
||||
$adj_sql = $adj_sql . "WHERE I.id = A.interface_id AND A.network_id = N.id ";
|
||||
$adj_sql = $adj_sql . "AND I.id = '$if_id'";
|
||||
$adj_query = mysql_query("$adj_sql");
|
||||
while($adjs = mysql_fetch_array($adj_query)) {
|
||||
$network_id = $adjs['network_id'];
|
||||
$newsql = "SELECT *, I.id AS iid, D.id AS did FROM adjacencies AS A, networks as N, interfaces as I, devices as D ";
|
||||
$newsql = $newsql . "WHERE N.id = '$network_id' AND A.network_id = N.id AND I.id = A.interface_id AND D.id = I.host ";
|
||||
$newsql = $newsql . "AND D.id != '$device[id]' AND I.if NOT LIKE '%loopback%' GROUP BY D.id ORDER BY D.hostname";
|
||||
$new_query = mysql_query($newsql);
|
||||
while($new = mysql_fetch_array($new_query)) {
|
||||
if ($new['status'] == '0') { $class = "red"; } else { $class = "blue"; }
|
||||
if ($new['ignore'] == '1') {
|
||||
$class = "grey";
|
||||
if ($new['status'] == '1') { $class = "green"; }
|
||||
}
|
||||
$this_ifid = $new['iid'];
|
||||
$this_hostid = $new['did'];
|
||||
$this_hostname = $new['hostname'];
|
||||
$this_ifname = fixifName($new['if']);
|
||||
$wq = mysql_query("select count(*) FROM links WHERE dst_if = '$this_ifid' AND src_if = $if_id;");
|
||||
if (@mysql_result($wq, 0) == '0' && $this_hostname != $hostname) {
|
||||
$graph_url = "graph.php?if=$this_ifid&from=$twoday&to=$now&width=400&height=120&type=bits";
|
||||
echo("$br <img src='images/16/bullet_go.png' alt='Same Subnet' align=absmiddle />" . generateiflink($new) . " on " . generatedevicelink($new));
|
||||
$br = "<br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($br);
|
||||
}
|
||||
|
||||
echo("</td></tr>");
|
||||
|
||||
// If we're showing graphs, generate the graph and print the img tags
|
||||
if($dographs && is_file("rrd/" . $hostname . ".". $ifIndex . ".rrd")) {
|
||||
$daily_traffic = "graph.php?if=$if_id&type=bits&from=$day&to=$now&width=210&height=100";
|
||||
$weekly_traffic = "graph.php?if=$if_id&type=bits&from=$week&to=$now&width=210&height=100";
|
||||
$monthly_traffic = "graph.php?if=$if_id&type=bits&from=$month&to=$now&width=210&height=100";
|
||||
$yearly_traffic = "graph.php?if=$if_id&type=bits&from=$year&to=$now&width=210&height=100";
|
||||
|
||||
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=3>");
|
||||
echo("<img src='$daily_traffic'> <img src='$weekly_traffic'> ");
|
||||
echo("<img src='$monthly_traffic'> <img src='$yearly_traffic'>");
|
||||
echo("</td></tr>");
|
||||
}
|
||||
|
||||
|
||||
|
||||
$i++;
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
$service_alerts = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0'"),0);
|
||||
$if_alerts = mysql_result(mysql_query("SELECT count(id) FROM `interfaces` WHERE `up` = 'down' AND `up_admin` = 'up' AND `ignore` = '0'"),0);
|
||||
$device_alerts = "0";
|
||||
$device_alert_sql = "WHERE 0";
|
||||
|
||||
$query_a = mysql_query("SELECT * FROM `devices`");
|
||||
while($device = mysql_fetch_array($query_a)) {
|
||||
|
||||
if($device[status] == 0 && $device[ignore] == '0') { $this_alert = "1"; } elseif($device[ignore] == '0') {
|
||||
if(mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0' AND service_host = '$device[id]'"),0)) { $this_alert = "1"; }
|
||||
if(mysql_result(mysql_query("SELECT count(id) FROM interfaces WHERE `up` = 'down' AND `up_admin` = 'up' AND host = '$device[id]'"),0)) { $this_alert = "1"; }
|
||||
}
|
||||
|
||||
if($this_alert) {
|
||||
$device_alerts++;
|
||||
$device_alert_sql .= " OR `id` = '$device[id]'";
|
||||
}
|
||||
unset($this_alert);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="menu2">
|
||||
<ul>
|
||||
<li><a><img src='/images/16/lightbulb.png' border=0 align=absmiddle> Status
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href="?page=overview"><img src='/images/16/zoom.png' border=0 align=absmiddle> Overview</a></li>
|
||||
<li><a href="?page=eventlog"><img src='/images/16/information.png' border=0 align=absmiddle> Eventlog</a></li>
|
||||
<li><a href="?page=alerts"><img src='/images/16/exclamation.png' border=0 align=absmiddle> Alerts</a></li>
|
||||
</ul>
|
||||
</td></tr></table>
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a><img src='/images/16/server.png' border=0 align=absmiddle> Devices
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href='?page=devices'><img src='/images/16/server.png' border=0 align=absmiddle> All Devices</a></li>
|
||||
<li><hr width=140 /></li>
|
||||
<li><a href="?page=devices&type=server"><img src='/images/16/server.png' border=0 align=absmiddle> Servers</a></li>
|
||||
<li><a href="?page=devices&type=network"><img src='/images/16/arrow_switch.png' border=0 align=absmiddle> Network</a></li>
|
||||
<li><a href="?page=devices&type=firewall"><img src='/images/16/shield.png' border=0 align=absmiddle> Firewalls</a></li>
|
||||
<?php
|
||||
echo(" <li><hr width=140 /></li>
|
||||
<li><a href='?page=devices&status=alerted'><img src='/images/16/server_error.png' border=0 align=absmiddle> Alerts ($device_alerts)</a></li>");
|
||||
?>
|
||||
<li><hr width=140 /></li>
|
||||
<li><a href="?page=addhost"><img src='/images/16/server_add.png' border=0 align=absmiddle> Add Device</a></li>
|
||||
<li><a href="?page=delhost"><img src='/images/16/server_delete.png' border=0 align=absmiddle> Delete Device</a></li>
|
||||
</ul>
|
||||
</td></tr></table>
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
</li>
|
||||
<li><a><img src='/images/16/cog.png' border=0 align=absmiddle> Services
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
<li><a href="?page=services"><img src='/images/16/cog.png' border=0 align=absmiddle> All Services </a></li>
|
||||
<?php if($service_alerts) {
|
||||
echo(" <li><hr width=140 /></li>
|
||||
<li><a href='?page=services&status=0'><img src='/images/16/cog_error.png' border=0 align=absmiddle> Alerts ($service_alerts)</a></li>");
|
||||
} ?>
|
||||
<li><hr width=140 /></li>
|
||||
<li><a href="?page=addsrv"><img src='/images/16/cog_add.png' border=0 align=absmiddle> Add Service</a></li>
|
||||
<li><a href="?page=delsrv"><img src='/images/16/cog_delete.png' border=0 align=absmiddle> Delete Service</a></li>
|
||||
|
||||
</ul>
|
||||
</td></tr></table>
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
</li>
|
||||
<li><a class="menu2four" href="?page=locations"><img src='/images/16/building.png' border=0 align=absmiddle> Locations</a></li>
|
||||
|
||||
<li><a><img src='/images/16/connect.png' border=0 align=absmiddle> Interfaces
|
||||
<!--[if IE 7]><!--></a><!--<![endif]-->
|
||||
|
||||
<table><tr><td>
|
||||
<ul>
|
||||
|
||||
|
||||
<li><a href='?page=interfaces'><img src='/images/16/connect.png' border=0 align=absmiddle> All Interfaces</a></li>
|
||||
<li><hr width=140 /></li>
|
||||
|
||||
<?php
|
||||
|
||||
if($show_if_customers) { echo("<li><a href='?page=customers'><img src='/images/16/group_link.png' border=0 align=absmiddle> Customers</a></li>"); $ifbreak = 1;}
|
||||
if($show_if_transit) { echo("<li><a href='?page=iftype&type=transit'><img src='/images/16/world_link.png' border=0 align=absmiddle> Transit</a></li>"); $ifbreak = 1; }
|
||||
if($show_if_peering) { echo("<li><a href='?page=iftype&type=peering'><img src='/images/16/brick_link.png' border=0 align=absmiddle> Peering</a></li>"); $ifbreak = 1; }
|
||||
|
||||
if($ifbreak && $interface_alerts) { echo("<li><hr width=140 /></li>"); }
|
||||
|
||||
if($interface_alerts) {
|
||||
echo("<li><a href='?page=interfaces&status=0'><img src='/images/16/link_error.png' border=0 align=absmiddle> Alerts ($interface_alerts)</a></li>");
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</ul></td></tr></table>
|
||||
|
||||
<!--[if lte IE 6]></a><![endif]-->
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
<li style='float: right;'><a href='?page=configuration'><img src='/images/16/wrench.png' border=0 align=absmiddle> Configuration</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
if(!$samehost) {
|
||||
if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg = $list_colour_a; }
|
||||
}
|
||||
|
||||
$service_type = strtolower($service[service_type]);
|
||||
|
||||
if($service[service_status] == '0') {$status = "<span class=red><b>$service_type</b></span>";
|
||||
} elseif ($service[service_status] == '1') {$status = "<span class=green><b>$service_type</b></span>";
|
||||
} elseif ($service[service_status] == '2') {$status = "<span class=grey><b>$service_type</b></span>";}
|
||||
|
||||
$message = trim($service[service_message]);
|
||||
$message = str_replace("\n", "<br />", $message);
|
||||
|
||||
$since = time() - $service[service_changed];
|
||||
$since = formatUptime($since);
|
||||
|
||||
if($service[service_checked]) {
|
||||
$checked = time() - $service[service_checked];
|
||||
$checked = formatUptime($checked);
|
||||
} else { $checked = "Never"; }
|
||||
|
||||
|
||||
echo("
|
||||
<tr style=\"background-color: $bg; padding: 5px;\"><td valign=top>$service[service_id].</td>");
|
||||
|
||||
if($device_id) {
|
||||
if(!$samehost) {
|
||||
$device[id] = $device_id;
|
||||
$device[hostname] = $device_hostname;
|
||||
echo("<td valign=top width=200><span style='font-weight:bold;'>" . generatedevicelink($device) . "</span></td>");
|
||||
} else {
|
||||
echo("<td></td>");
|
||||
}
|
||||
}
|
||||
|
||||
echo("
|
||||
<td valign=top class=list-bold>
|
||||
$status
|
||||
</td>
|
||||
<td valign=top width=175>
|
||||
$since
|
||||
</td>
|
||||
<td valign=top>
|
||||
<span class=box-desc>$message</span>
|
||||
</td>
|
||||
</tr>");
|
||||
|
||||
$i++;
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
<?
|
||||
|
||||
if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
|
||||
|
||||
$hostname = gethostbyid($entry['host']);
|
||||
$interface = fixifname(getifbyid($entry['interface']));
|
||||
|
||||
unset($icon);
|
||||
|
||||
$icon = geteventicon($entry['message']);
|
||||
if($icon) {$icon = "<img src='/images/16/$icon'>"; }
|
||||
|
||||
|
||||
echo("<tr style=\"background-color: $bg\">
|
||||
<td width=0></td>
|
||||
<td class=syslog width=150>
|
||||
$entry[datetime]
|
||||
</td>
|
||||
<td class=list-bold width=100>
|
||||
$entry[priority]
|
||||
</td>
|
||||
<td class=syslog width=100>
|
||||
$entry[program]
|
||||
</td>
|
||||
<td class=syslog>
|
||||
$entry[msg]
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>");
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
$devices['count'] = mysql_result(mysql_query("SELECT count(id) FROM devices"),0);
|
||||
$devices['up'] = mysql_result(mysql_query("SELECT count(id) FROM devices WHERE status = '1' AND `ignore` = '0'"),0);
|
||||
$devices['down'] = mysql_result(mysql_query("SELECT count(id) FROM devices WHERE status = '0' AND `ignore` = '0'"),0);
|
||||
$devices['disabled'] = mysql_result(mysql_query("SELECT count(id) FROM devices WHERE `ignore` = '1'"),0);
|
||||
|
||||
$interfaces['count'] = mysql_result(mysql_query("SELECT count(id) FROM interfaces"),0);
|
||||
$interfaces['up'] = mysql_result(mysql_query("SELECT count(id) FROM interfaces WHERE up = 'up'"),0);
|
||||
$interfaces['down'] = mysql_result(mysql_query("SELECT count(id) FROM interfaces WHERE up = 'down' AND up_admin = 'up'"),0);
|
||||
$interfaces['disabled'] = mysql_result(mysql_query("SELECT count(id) FROM interfaces WHERE up_admin = 'down'"),0);
|
||||
|
||||
$services['count'] = mysql_result(mysql_query("SELECT count(service_id) FROM services"),0);
|
||||
$services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '1' AND service_ignore ='0'"),0);
|
||||
$services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0' AND service_ignore = '0'"),0);
|
||||
$services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_ignore = '1'"),0);
|
||||
|
||||
if($devices['down']) { $devices['bgcolour'] = "#ffcccc"; } else { $devices['bgcolour'] = ""; }
|
||||
if($interfaces['down']) { $interfaces['bgcolour'] = "#ffcccc"; } else { $interfaces['bgcolour'] = "#e5e5e5"; }
|
||||
if($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['bgcolour'] = ""; }
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<table cellpadding=2 cellspacing=0 border=0>
|
||||
<?php
|
||||
echo("<tr bgcolor=$devices[bgcolour]><td width=5></td>
|
||||
<td>Devices :
|
||||
</td><td>$devices[count]
|
||||
</td><td> ( <span class=green>$devices[up] up</span>
|
||||
</td><td><span class=red>$devices[down] down</span>
|
||||
</td><td><span class=grey>$devices[disabled]</span> ignored )
|
||||
</td><td width=5></td>");
|
||||
echo("</tr><tr bgcolor=$interfaces[bgcolour]>");
|
||||
echo("<td width=5></td><td>Interfaces :
|
||||
</td><td>$interfaces[count]
|
||||
</td><td> ( <span class=green> $interfaces[up] up </span>
|
||||
</td><td><span class=red> $interfaces[down] down </span>
|
||||
</td><td><span class=grey> $interfaces[disabled] </span> disabled )
|
||||
</td><td width=5></td>");
|
||||
echo("</tr><tr bgcolor=$services[bgcolour]>");
|
||||
echo("<td width=5></td><td>Services :
|
||||
</td><td>$services[count]
|
||||
</td><td> ( <span class=green>$services[up] up</span>
|
||||
</td><td><span class=red>$services[down] down</span>
|
||||
</td><td><span class=grey>$services[disabled]</span> ignored )
|
||||
</td><td width=5></td>");
|
||||
echo("</tr>");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=left>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
Reference in New Issue
Block a user