mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
adding new things
git-svn-id: http://www.observium.org/svn/observer/trunk@430 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
211
html/pages/default-jt.php
Normal file
211
html/pages/default-jt.php
Normal file
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
|
||||
function generate_front_box ($type, $content) {
|
||||
echo("<div style=' background: transparent url(images/box-$type.png) no-repeat; display: block; height: 84px; width: 119px; padding: 8px; margin: 5px; float: left;'>
|
||||
$content
|
||||
</div>");
|
||||
|
||||
|
||||
# echo("<div style='float: left; padding: 5px; width: 135px; margin: 0px;'>
|
||||
# <b class='box-".$type."'>
|
||||
# <b class='box-".$type."1'><b></b></b>
|
||||
# <b class='box-".$type."2'><b></b></b>
|
||||
# <b class='box-".$type."3'></b>
|
||||
# <b class='box-".$type."4'></b>
|
||||
# <b class='box-".$type."5'></b></b>
|
||||
# <div class='box-".$type."fg' style='height: 90px;'>
|
||||
# ".$content."
|
||||
# </div>
|
||||
# <b class='box-".$type."'>
|
||||
# <b class='box-".$type."5'></b>
|
||||
# <b class='box-".$type."4'></b>
|
||||
# <b class='box-".$type."3'></b>
|
||||
# <b class='box-".$type."2'><b></b></b>
|
||||
# <b class='box-".$type."1'><b></b></b></b>
|
||||
# </div>");
|
||||
}
|
||||
|
||||
echo("<div style='width: 875px; float: left; padding: 3px 10px; background: #fff;'>");
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'");
|
||||
while($device = mysql_fetch_array($sql)){
|
||||
|
||||
generate_front_box("alert", "<center><strong>".generatedevicelink($device, shorthost($device['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span>
|
||||
<span class=body-date-1>".truncate($device['location'], 20)."</span>
|
||||
</center>");
|
||||
|
||||
|
||||
}
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `interfaces` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
|
||||
while($interface = mysql_fetch_array($sql)){
|
||||
|
||||
generate_front_box("warn", "<center><strong>".generatedevicelink($interface, shorthost($interface['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span>
|
||||
<!-- <img src='graph.php?type=bits&if=".$interface['interface_id']."&from=$day&to=$now&width=100&height=32' /> -->
|
||||
<strong>".generateiflink($interface, makeshortif($interface['ifDescr']))."</strong> <br />
|
||||
<span class=body-date-1>".truncate($interface['ifAlias'], 20)."</span>
|
||||
</center>");
|
||||
|
||||
}
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.service_host = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
|
||||
while($service = mysql_fetch_array($sql)){
|
||||
|
||||
|
||||
generate_front_box("alert", "<center><strong>".generatedevicelink($service, shorthost($service['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span>
|
||||
<strong>".$service['service_type']."</strong><br />
|
||||
<span class=body-date-1>".truncate($interface['ifAlias'], 20)."</span>
|
||||
</center>");
|
||||
|
||||
}
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND B.device_id = D.device_id");
|
||||
while($peer = mysql_fetch_array($sql)){
|
||||
|
||||
generate_front_box("alert", "<center><strong>".generatedevicelink($peer, shorthost($peer['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span>
|
||||
<strong>".$peer['bgpPeerIdentifier']."</strong> <br />
|
||||
<span class=body-date-1>AS".$peer['bgpPeerRemoteAs']." ".truncate($peer['astext'], 10)."</span>
|
||||
</center>");
|
||||
|
||||
}
|
||||
|
||||
$sql = mysql_query("SELECT * FROM `devices` AS D, devices_attribs AS A WHERE A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value < '84600'");
|
||||
while($device = mysql_fetch_array($sql)){
|
||||
|
||||
|
||||
generate_front_box("info", "<center><strong>".generatedevicelink($device, shorthost($device['hostname']))."</strong><br />
|
||||
<span style='font-size: 14px; font-weight: bold; margin: 5px; color: #009;'>Device<br />Rebooted</span><br />
|
||||
<span class=body-date-1>".formatUptime($device['attrib_value'], 'short')."</span>
|
||||
</center>");
|
||||
|
||||
}
|
||||
|
||||
if($config['frontpage_display'] == 'syslog') {
|
||||
|
||||
## Open Syslog Div
|
||||
echo("<div style='margin: 4px; clear: both; padding: 5px;'>
|
||||
<h3>Recent Syslog Messages</h3>
|
||||
");
|
||||
|
||||
$sql = "SELECT *, DATE_FORMAT(datetime, '%D %b %T') AS date from syslog ORDER BY datetime DESC LIMIT 20";
|
||||
$query = mysql_query($sql);
|
||||
echo("<table cellspacing=0 cellpadding=2 width=100%>");
|
||||
while($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); }
|
||||
echo("</table>");
|
||||
|
||||
echo("</div>"); ## Close Syslog Div
|
||||
|
||||
} else {
|
||||
|
||||
## Open eventlog Div
|
||||
echo("<div style='margin: 4px; clear: both; padding: 5px;'>
|
||||
<h3>Recent Eventlog Entries</h3>
|
||||
");
|
||||
|
||||
if($_SESSION['userlevel'] == '10') {
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15";
|
||||
} else {
|
||||
$query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host =
|
||||
P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,15";
|
||||
}
|
||||
|
||||
$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>");
|
||||
|
||||
|
||||
echo("</div>"); ## Close Syslog Div
|
||||
|
||||
|
||||
}
|
||||
|
||||
echo("</div>");
|
||||
|
||||
echo("<div style='width: 290px; margin: 7px; float: right;'>
|
||||
<b class='content-box'>
|
||||
<b class='content-box1'><b></b></b>
|
||||
<b class='content-box2'><b></b></b>
|
||||
<b class='content-box3'></b>
|
||||
<b class='content-box4'></b>
|
||||
<b class='content-box5'></b></b>
|
||||
|
||||
<div class='content-boxfg' style='padding: 2px 8px;'>");
|
||||
|
||||
/// this stuff can be customised to show whatever you want....
|
||||
|
||||
if($_SESSION['userlevel'] >= '5') {
|
||||
|
||||
$sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id AND D.hostname LIKE '%";
|
||||
$sql .= $config['mydomain'] . "' ORDER BY I.ifAlias";
|
||||
$query = mysql_query($sql);
|
||||
unset ($seperator);
|
||||
while($interface = mysql_fetch_array($query)) {
|
||||
$interfaces['peering'] .= $seperator . $interface['interface_id'];
|
||||
$seperator = ",";
|
||||
}
|
||||
|
||||
$sql = "select * from interfaces as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
|
||||
$query = mysql_query($sql);
|
||||
unset ($seperator);
|
||||
while($interface = mysql_fetch_array($query)) {
|
||||
$interfaces['transit'] .= $seperator . $interface['interface_id'];
|
||||
$seperator = ",";
|
||||
}
|
||||
|
||||
$interfaces['broadband'] = "2490,2509";
|
||||
$interfaces['wave_broadband'] = "2098";
|
||||
|
||||
if($interfaces['transit']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||
"&from=".$day."&to=".$now."&width=400&height=150\'>', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 18px; font-weight: bold;'>Internet Transit</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['transit'].
|
||||
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||
}
|
||||
|
||||
if($interfaces['broadband']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['broadband'].
|
||||
"&from=".$day."&to=".$now."&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 18px; font-weight: bold;'>Broadband</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['broadband'].
|
||||
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||
}
|
||||
|
||||
if($interfaces['wave_broadband']) {
|
||||
echo("<a onmouseover=\"return overlib('<img src=\'graph.php?type=multi_bits&interfaces=".$interfaces['wave_broadband'].
|
||||
"&from=".$day."&to=".$now."&width=400&height=150\'>', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >".
|
||||
"<div style='font-size: 18px; font-weight: bold;'>Wave Broadhand</div>".
|
||||
"<img src='graph.php?type=multi_bits&interfaces=".$interfaces['wave_broadband'].
|
||||
"&from=".$day."&to=".$now."&width=200&height=100'></a>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo("</div>
|
||||
|
||||
<b class='content-box'>
|
||||
<b class='content-box5'></b>
|
||||
<b class='content-box4'></b>
|
||||
<b class='content-box3'></b>
|
||||
<b class='content-box2'><b></b></b>
|
||||
<b class='content-box1'><b></b></b></b>
|
||||
</div>
|
||||
");
|
||||
|
||||
#echo("</div>");
|
||||
|
||||
/// END VOSTRON
|
||||
|
||||
#}
|
||||
|
||||
?>
|
36
html/pages/device/ciscosensors.inc.php
Normal file
36
html/pages/device/ciscosensors.inc.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php // vim:fenc=utf-8:filetype=php:ts=4
|
||||
|
||||
echo("<div style='width: auto; text-align: right; padding: 10px; display:block; background-color: #eeeeee;'>");
|
||||
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`");
|
||||
while($data = mysql_fetch_array($query)) {
|
||||
$type = $data['entSensorType'];
|
||||
if(!$_GET['opta']) { $_GET['opta'] = $type; }
|
||||
echo($sep);
|
||||
if($_GET['opta'] == $type) { echo("<strong>"); }
|
||||
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/ciscosensors/" . $type . "/'>" . htmlspecialchars($type) ."</a>\n");
|
||||
if($_GET['opta'] == $type) { echo("</strong>"); }
|
||||
$sep = ' | ';
|
||||
}
|
||||
unset ($sep);
|
||||
echo("</div>");
|
||||
|
||||
$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)) {
|
||||
|
||||
if($data['entSensorMeasuredEntity']) {
|
||||
$measured = mysql_fetch_array(mysql_query("SELECT * FROM entPhysical WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '".$data['entSensorMeasuredEntity']."'"));
|
||||
}
|
||||
|
||||
echo("<div><h3>".$measured['entPhysicalName']." ".$data['entPhysicalName']."</h3>");
|
||||
$graph_type = "cisco_entity_sensor";
|
||||
$args = "&a=".$data['entPhysical_id'];
|
||||
|
||||
include("includes/print-device-graph.php");
|
||||
|
||||
echo("</div>");
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
34
html/pages/device/health.inc.php
Normal file
34
html/pages/device/health.inc.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php // vim:fenc=utf-8:filetype=php:ts=4
|
||||
|
||||
$temp = mysql_result(mysql_query("select count(*) from temperature WHERE temp_host = '" . $device['device_id'] . "'"), 0);
|
||||
$storage = mysql_result(mysql_query("select count(*) from storage WHERE host_id = '" . $device['device_id'] . "'"), 0);
|
||||
$cemp = mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
$cpm = mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
|
||||
if($temp) { $datas[] = 'temp'; }
|
||||
if($storage) { $datas[] = 'storage'; }
|
||||
if($cemp) { $datas[] = 'cemp'; }
|
||||
if($cpm) { $datas[] = 'cpm'; }
|
||||
|
||||
$type_text['temp'] = "Temperatures";
|
||||
$type_text['cemp'] = "Memory Pools";
|
||||
$type_text['cpm'] = "Processor Usage";
|
||||
$type_text['storage'] = "Disk Usage";
|
||||
|
||||
echo("<div style='width: auto; text-align: right; padding: 10px; display:block; background-color: #eeeeee;'>");
|
||||
unset ($sep);
|
||||
foreach ($datas as $type) {
|
||||
if(!$_GET['opta']) { $_GET['opta'] = $type; }
|
||||
echo($sep);
|
||||
if($_GET['opta'] == $type) { echo("<strong>"); }
|
||||
echo("<a href='".$config['base_url']."/device/" . $device['device_id'] . "/health/" . $type . "/'>" . $type_text[$type] ."</a>\n");
|
||||
if($_GET['opta'] == $type) { echo("</strong>"); }
|
||||
$sep = ' | ';
|
||||
}
|
||||
unset ($sep);
|
||||
echo("</div>");
|
||||
|
||||
if(is_file("pages/device/health/".mres($_GET['opta']).".inc.php")) { include("pages/device/health/".mres($_GET['opta']).".inc.php"); }
|
||||
|
||||
|
||||
?>
|
79
html/pages/device/health/storage.inc.php
Normal file
79
html/pages/device/health/storage.inc.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
$sql = "SELECT * FROM `storage` WHERE host_id = '" . $_GET[id] . "' ORDER BY hrStorageDescr";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
echo("<table cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
echo("<tr class=tablehead>
|
||||
<th width=200>Drive</th>
|
||||
<th width=360>Usage</th>
|
||||
<th width=50>Used</th>
|
||||
<th width=50>Total</th>
|
||||
<th width=50>Free</th>
|
||||
<th></th>
|
||||
</tr>");
|
||||
|
||||
$row = 1;
|
||||
|
||||
while($drive = mysql_fetch_array($query)) {
|
||||
|
||||
if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
$total = $drive['hrStorageSize'] * $drive['hrStorageAllocationUnits'];
|
||||
$used = $drive['hrStorageUsed'] * $drive['hrStorageAllocationUnits'];
|
||||
$perc = round($drive['storage_perc'], 0);
|
||||
$total = formatStorage($total);
|
||||
$used = formatStorage($used);
|
||||
|
||||
$fs_url = "?page=device&id=".$device['device_id']."§ion=dev-storage";
|
||||
|
||||
$fs_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr'];
|
||||
$fs_popup .= "</div><img src=\'graph.php?id=" . $drive['storage_id'] . "&type=unixfs&from=$month&to=$now&width=400&height=125\'>";
|
||||
$fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\"";
|
||||
|
||||
$drv_colour = percent_colour($perc);
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><th><a href='$fs_url' $fs_popup>" . $drive['hrStorageDescr'] . "</a></td><td>
|
||||
<a href='$fs_url' $fs_popup><img src='percentage.php?per=" . $perc . "&width=350'></a>
|
||||
</td><td style='font-weight: bold; color: $drv_colour'>" . $perc . "%</td><td>" . $total . "</td><td>" . $used . "</td><td></td></tr>");
|
||||
|
||||
|
||||
$graph_type = "unixfs";
|
||||
|
||||
// start temperature graphs
|
||||
|
||||
$daily_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$day&to=$now&width=212&height=100";
|
||||
$daily_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$day&to=$now&width=400&height=150";
|
||||
|
||||
$weekly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$week&to=$now&width=212&height=100";
|
||||
$weekly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$week&to=$now&width=400&height=150";
|
||||
|
||||
$monthly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$month&to=$now&width=212&height=100";
|
||||
$monthly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$month&to=$now&width=400&height=150";
|
||||
|
||||
$yearly_temp = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$year&to=$now&width=212&height=100";
|
||||
$yearly_url = "graph.php?id=" . $drive['storage_id'] . "&type=$graph_type&from=$year&to=$now&width=400&height=150";
|
||||
|
||||
echo("<tr bgcolor='$row_colour'><td colspan=6>");
|
||||
|
||||
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$daily_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
|
||||
<img src='$daily_temp' border=0></a> ");
|
||||
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$weekly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
|
||||
<img src='$weekly_temp' border=0></a> ");
|
||||
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$monthly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
|
||||
<img src='$monthly_temp' border=0></a> ");
|
||||
echo("<a onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$drive['hrStorageDescr']."</div><img src=\'$yearly_url\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">
|
||||
<img src='$yearly_temp' border=0></a>");
|
||||
|
||||
echo("</td></tr>");
|
||||
|
||||
|
||||
$row++;
|
||||
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
|
||||
?>
|
34
html/pages/device/nagios.inc.php
Normal file
34
html/pages/device/nagios.inc.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?
|
||||
|
||||
### 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>");
|
||||
|
||||
|
||||
?>
|
36
html/pages/pseudowires.php
Normal file
36
html/pages/pseudowires.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
echo("<table cellpadding=7 cellspacing=0 class=devicetable width=100%>");
|
||||
|
||||
$sql = "SELECT * FROM pseudowires AS P, interfaces AS I, devices AS D WHERE P.interface_id = I.interface_id AND I.device_id = D.device_id ORDER BY D.hostname,I.ifDescr";
|
||||
$query = mysql_query($sql);
|
||||
|
||||
while($pw_a = mysql_fetch_array($query)) {
|
||||
$i = 0;
|
||||
while ($i < count($linkdone)) {
|
||||
$thislink = $pw_a['device_id'] . $pw_a['interface_id'];
|
||||
if ($linkdone[$i] == $thislink) { $dupe = "yes"; }
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
if($dupe) {
|
||||
unset($dupe);
|
||||
} else {
|
||||
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
|
||||
$pw_b = mysql_fetch_array(mysql_query("SELECT * from `devices` AS D, `interfaces` AS I, `pseudowires` AS P WHERE D.device_id = '".$pw_a['peer_device_id']."' AND
|
||||
D.device_id = I.device_id AND
|
||||
P.cpwVcID = '".$pw_a['cpwVcID']."' AND
|
||||
P.interface_id = I.interface_id"));
|
||||
|
||||
echo("<tr style=\"background-color: $bg;\"><td rowspan=2 style='font-size:18px; padding:4px;'>".$pw_a['cpwVcID']."</td><td>".generatedevicelink($pw_a)."</td><td>".generateiflink($pw_a)."</td>
|
||||
<td rowspan=2> => </td>
|
||||
<td>".generatedevicelink($pw_b)."</td><td>".generateiflink($pw_b)."</td></tr>");
|
||||
echo("<tr style=\"background-color: $bg;\"><td colspan=2>".$pw_a['ifAlias']."</td><td colspan=2>".$pw_b['ifAlias']."</td></tr>");
|
||||
$linkdone[] = $pw_b['device_id'] . $pw_b['interface_id'];
|
||||
}
|
||||
}
|
||||
|
||||
echo("</table>");
|
||||
|
||||
?>
|
40
html/pages/purgeports.php
Normal file
40
html/pages/purgeports.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
function delete_port($interface_id) {
|
||||
$ipaddrs = mysql_query("SELECT * FROM `ipaddr` WHERE `interface_id` = '$interface_id'");
|
||||
while($ipaddr = mysql_fetch_array($ipaddrs)) {
|
||||
echo("<div style='padding-left:8px; font-weight: normal;'>Deleting IPv4 address " . $ipaddr['addr'] . "/" . $ipaddr['cidr'] );
|
||||
mysql_query("DELETE FROM addr WHERE id = '".$addr['id']."'");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
$ip6addr = mysql_query("SELECT * FROM `ip6addr` WHERE `interface_id` = '$interface_id'");
|
||||
while($ip6addr = mysql_fetch_array($ip6addrs)) {
|
||||
echo("<div style='padding-left:8px; font-weight: normal;'>Deleting IPv6 address " . $ip6addr['ip6_comp_addr'] . "/" . $ip6addr['ip6_prefixlen'] );
|
||||
mysql_query("DELETE FROM ip6addr WHERE ip6_addr_id = '".$ip6addr['ip6_addr_id']."'");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
$ip6addr = mysql_query("SELECT * FROM `ip6addr` WHERE `interface_id` = '$interface_id'");
|
||||
while($ip6addr = mysql_fetch_array($ip6addrs)) {
|
||||
echo("<div style='padding-left:8px; font-weight: normal;'>Deleting IPv6 address " . $ip6addr['ip6_comp_addr'] . "/" . $ip6addr['ip6_prefixlen'] );
|
||||
mysql_query("DELETE FROM ip6addr WHERE ip6_addr_id = '".$ip6addr['ip6_addr_id']."'");
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
mysql_query("DELETE FROM `pseudowires` WHERE `interface_id` = '$interface_id'");
|
||||
mysql_query("DELETE FROM `mac_accounting` WHERE `interface_id` = '$interface_id'");
|
||||
mysql_query("DELETE FROM `links` WHERE `src_if` = '$interface_id'");
|
||||
mysql_query("DELETE FROM `links` WHERE `dst_if` = '$interface_id'");
|
||||
mysql_query("DELETE FROM `interfaces_perms` WHERE `interface_id` = '$interface_id'");
|
||||
mysql_query("DELETE FROM `interfaces` WHERE `interface_id` = '$interface_id'");
|
||||
}
|
||||
|
||||
$ports = mysql_query("SELECT * FROM `interfaces` WHERE `deleted` = '1'");
|
||||
while($port = mysql_fetch_array($ports)) {
|
||||
echo("<div style='font-weight: bold;'>Deleting port " . $port['interface_id'] . " - " . $port['ifDescr'] );
|
||||
delete_port($port['interface_id']);
|
||||
echo("</div>");
|
||||
}
|
||||
|
||||
?>
|
46
html/pages/vrfs.php
Normal file
46
html/pages/vrfs.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
$i = "1";
|
||||
$vrf_query = mysql_query("SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`");
|
||||
while($vrf = mysql_fetch_array($vrf_query)) {
|
||||
|
||||
if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
|
||||
echo("<tr valign=top bgcolor='$bg_colour'>");
|
||||
|
||||
echo("<td width=200 class=list-large>" . $vrf['vrf_name'] . "</td>");
|
||||
echo("<td width=100 class=box-desc>" . $vrf['mplsVpnVrfRouteDistinguisher'] . "</td>");
|
||||
|
||||
echo("<td width=200 class=box-desc>" . $vrf['mplsVpnVrfDescription'] . "</td>");
|
||||
|
||||
echo("<td><table border=0 cellspacing=0 cellpadding=5 width=100%>");
|
||||
|
||||
$devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id");
|
||||
$x=1;
|
||||
while($device = mysql_fetch_array($devices)) {
|
||||
if(!is_integer($i/2)) {
|
||||
if(!is_integer($x/2)) { $dev_colour = $list_colour_a_a; } else { $dev_colour = $list_colour_a_b; }
|
||||
} else {
|
||||
if(!is_integer($x/2)) { $dev_colour = $list_colour_b_b; } else { $dev_colour = $list_colour_b_a; }
|
||||
}
|
||||
echo("<tr bgcolor='$dev_colour'><td width=150>".generatedevicelink($device) . "</td><td>");
|
||||
$interfaces = mysql_query("SELECT * FROM `interfaces` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'");
|
||||
unset($seperator);
|
||||
while($interface = mysql_fetch_array($interfaces)) {
|
||||
echo($seperator.generateiflink($interface,makeshortif($interface['ifDescr'])));
|
||||
$seperator = ", ";
|
||||
}
|
||||
echo("</td></tr>");
|
||||
$x++;
|
||||
}
|
||||
|
||||
echo("</table></td>");
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
echo("</table></div>");
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user