git-svn-id: http://www.observium.org/svn/observer/trunk@428 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2009-05-11 13:43:59 +00:00
parent cf1e2830cf
commit 67fc89c6e7
22 changed files with 395 additions and 106 deletions

View File

@@ -52,6 +52,9 @@ $config['mono_font'] = $config['install_dir'] . "/fonts/DejaVuSansMono.ttf";
$config['favicon'] = "favicon.ico";
$config['header_color'] = "#1F334E";
## Custom pre-login message
$config['login_message'] = "";
$config['page_refresh'] = "0"; ## Refresh the page every xx seconds
$config['front_page'] = "pages/front/default.php";
@@ -101,9 +104,24 @@ $config['ignore_mount'] = array("/kern", "/mnt/cdrom", "/dev", "/dev/pts", "/pro
### Style Options
# Alternating list colours
$list_colour_a = "#ffffff";
$list_colour_b = "#eeeeee";
# Alternating list-within-list colours
$list_colour_a_a = "#f9f9f9";
$list_colour_a_b = "#f0f0f0";
$list_colour_b_a = "#e9e9e9";
$list_colour_b_b = "#e0e0e0";
$warn_colour_a = "#ffeeee";
$warn_colour_b = "#ffcccc";
$warn_colour_a = "#ffeeee";
$warn_colour_b = "#ffcccc";

View File

@@ -39,8 +39,6 @@ while ($device = mysql_fetch_array($device_query)) {
$cdp_links = trim($cdp_links);
# echo("\n$cdp_links\n\n");
foreach ( explode("\n" ,$cdp_links) as $link ) {
if ($link == "") { break; }
list($src_host,$src_if, $dst_host, $dst_if) = explode(",", $link);

View File

@@ -47,7 +47,7 @@
echo("</td><td width=100>");
if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)){
echo("<a href='/?page=mac-accounting&id=".$interface['interface_id']."'><img src='/images/16/chart_curve.png' align='absmiddle'> Mac Acc</a>");
echo("<a href='device/".$interface['device_id']."/interface/".$interface['interface_id']."/macaccounting/'><img src='/images/16/chart_curve.png' align='absmiddle'> Mac Acc</a>");
}
echo("</td><td width=120>");

View File

@@ -128,6 +128,8 @@ if($config['enable_billing']) { echo("<li><a href='bills/'><img src='images/16/m
if($config['enable_pseudowires']) { echo("<li><a href='pseudowires/'><img src='images/16/arrow_switch.png' border=0 align=absmiddle> Pseudowires</a></li>"); $ifbreak = 1;}
if($config['enable_pseudowires']) { echo("<li><a href='vrfs/'><img src='images/16/layers.png' border=0 align=absmiddle> VRFs</a></li>"); $ifbreak = 1;}
if($_SESSION['userlevel'] >= '5') {
echo("<li><hr width=140 /></li>");

View File

@@ -24,11 +24,16 @@ echo("<div class=mainpane>");
echo("
<ul id='maintab' class='shadetabs'>
<li class=" . $select['overview'] . ">
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/overview/'>
<img src='images/16/server_lightning.png' align=absmiddle border=0> Overview
</a>
</li>");
");
#echo("
#<ul id='maintab' class='shadetabs'>
#<li class=" . $select['overview'] . ">
# <a href='".$config['base_url']."/device/" . $device['device_id'] . "/overview/'>
# <img src='images/16/server_lightning.png' align=absmiddle border=0> Overview
# </a>
#</li>");
echo("<li class=" . $select['graphs'] . ">
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/graphs/'>
@@ -142,15 +147,15 @@ if($config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entP
}
if(mysql_result(mysql_query("select count(storage_id) from storage WHERE host_id = '" . $device['device_id'] . "'"), 0) > '0') {
echo("
<li class=" . $select['storage'] . ">
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/storage/'>
<img src='images/16/database.png' align=absmiddle border=0> Storage
</a>
</li>
");
}
#if(mysql_result(mysql_query("select count(storage_id) from storage WHERE host_id = '" . $device['device_id'] . "'"), 0) > '0') {
# echo("
#<li class=" . $select['storage'] . ">
# <a href='".$config['base_url']."/device/" . $device['device_id'] . "/storage/'>
# <img src='images/16/database.png' align=absmiddle border=0> Storage
# </a>
#</li>
#");
#}
if(mysql_result(mysql_query("select count(service_id) from services WHERE service_host = '" . $device['device_id'] . "'"), 0) > '0') {

View File

@@ -10,6 +10,8 @@ echo("
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/cbgp_prefixes/ipv4.unicast/'>IPv4</a> |
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/cbgp_prefixes/ipv4.vpn/'>VPNv4</a> |
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/cbgp_prefixes/ipv6.unicast/'>IPv6</a>
| Traffic:
<a href='".$config['base_url']."/device/" . $_GET['id'] . "/bgp/macaccounting/'>Mac Accounting</a>
</div>
</div>");
@@ -53,7 +55,6 @@ echo("
<img src='images/16/arrow_up.png' align=absmiddle> " . $peer['bgpPeerOutUpdates'] . "</td></tr>");
if($_GET['opta']) {
foreach(explode(" ", $_GET['opta']) as $graph_type) {
if($graph_type == "cbgp_prefixes") { list($afi, $safi) = explode(".", $_GET['optb']); $afisafi = "&afi=$afi&safi=$safi"; }
if($graph_type == "bgp_updates" || $valid_afi_safi[$afi][$safi]) {
@@ -72,8 +73,41 @@ echo("
echo("<a href='' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"><img src='$yearly_traffic' border=0></a>");
echo("</td></tr>");
}
if ($_GET['opta'] == "macaccounting") {
if(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)) {
$acc = mysql_fetch_array(mysql_query("SELECT * FROM `ipv4_mac` AS I, mac_accounting AS M WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address"));
$graph_type = "mac_acc";
$daily_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100";
$daily_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
$weekly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100";
$weekly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
$monthly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100";
$monthly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
$yearly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100";
$yearly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
echo("<tr bgcolor=$bg_colour><td colspan=7>");
echo("<a href='?page=interface&id=" . $interface['ma_id'] . "' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
<img src='$daily_traffic' border=0></a> ");
echo("<a href='?page=interface&id=" . $interface['ma_id'] . "' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
<img src='$weekly_traffic' border=0></a> ");
echo("<a href='?page=interface&id=" . $interface['ma_id'] . "' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
<img src='$monthly_traffic' border=0></a> ");
echo("<a href='?page=interface&id=" . $interface['ma_id'] . "' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
<img src='$yearly_traffic' border=0></a>");
echo("</td></tr>");
}
}
}
$i++;
}
echo("</table></div>");

View File

@@ -2,20 +2,32 @@
function printEntPhysical($ent, $level, $class) {
$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn");
global $device;
$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex");
while($ent = mysql_fetch_array($query)) {
echo("<li class='$class'>");
echo("
<li class='$class'>");
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'] == "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'] == "sensor") { echo("<img src='images/16/contrast.png' style='vertical-align:middle'/> "); }
if($ent['entPhysicalClass'] == "sensor") {
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();\"";
} 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($ent['entPhysicalModelName'] && $ent['entPhysicalName']) {
if($link) {echo("<a $link>");}
if($ent['ifIndex']) {
$interface = mysql_fetch_array(mysql_query("SELECT * FROM `interfaces` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'"));
$ent['entPhysicalName'] = generateiflink($interface);
}
if ($ent['entPhysicalModelName'] && $ent['entPhysicalName']) {
echo("<strong>".$ent['entPhysicalModelName'] . "</strong> (".$ent['entPhysicalName'].")");
} elseif($ent['entPhysicalModelName']) {
echo("<strong>".$ent['entPhysicalModelName'] . "</strong>");
@@ -25,10 +37,14 @@ function printEntPhysical($ent, $level, $class) {
echo("<strong>".$ent['entPhysicalDescr']."</strong>");
}
if($ent['entPhysicalClass'] == "sensor") {
echo(" (".$ent['entSensorValue'] ." ". $ent['entSensorType'].")");
}
echo("<br /><div class='interface-desc' style='margin-left: 20px;'>" . $ent['entPhysicalDescr']);
if($link) {echo("</a>");}
if($ent['entPhysicalSerialNum']) {
echo(" <br /><span style='color: #000099;'>Serial No. ".$ent['entPhysicalSerialNum']."</span> ");
}

View File

@@ -0,0 +1,62 @@
<?php
echo("<div style='margin-top: 5px; padding: 0px;'>");
echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1';
$mempools = mysql_query("SELECT * FROM `cempMemPool` WHERE device_id = '" . $device['device_id'] . "'");
while($mempool = mysql_fetch_array($mempools)) {
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$entPhysicalName = mysql_result(mysql_query("SELECT entPhysicalName from entPhysical WHERE device_id = '".$device['device_id']."'
AND entPhysicalIndex = '".$mempool['entPhysicalIndex']."'"),0);
$perc = round($mempool['cempMemPoolUsed'] / ($mempool['cempMemPoolUsed'] + $mempool['cempMemPoolFree']) * 100,2);
$mempool['descr_fixed'] = $entPhysicalName . " ". $mempool['cempMemPoolName'];
# $mempool['descr_fixed'] = str_replace("Routing Processor", "RP", $mempool['descr_fixed']);
# $mempool['descr_fixed'] = str_replace("Switching Processor", "SP", $mempool['descr_fixed']);
# $mempool['descr_fixed'] = str_replace("Processor", "Proc", $mempool['descr_fixed']);
$proc_url = "?page=device/".$device['device_id']."/sensors/mempools/";
$mempool_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$mempool['descr_fixed'];
$mempool_popup .= "</div><img src=\'graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$month&to=$now&width=400&height=125\'>";
$mempool_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($mempool['cpuCPMTotal5minRev'] > '60') { $mempool_colour='#cc0000'; } else { $mempool_colour='#0000cc'; }
echo("<tr bgcolor='$row_colour'><td width=350 class=tablehead><a href='' $mempool_popup>" . $mempool['descr_fixed'] ."</a></td>
<td><a href='#' $mempool_popup><img src='percentage.php?per=" . $perc . "&width=600'></a></td>
<td style='font-weight: bold; color: $drv_colour'>$perc%</td>
<td style='color: $drv_colour'>" . formatstorage($mempool['cempMemPoolFree'], 0) . "/" . formatstorage($mempool['cempMemPoolUsed'] + $mempool['cempMemPoolFree'], 0) . "</strong></td>
</tr>");
echo("<tr bgcolor='$row_colour'><td colspan=5>");
$daily_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$day&to=$now&width=211&height=100";
$daily_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$day&to=$now&width=400&height=150";
$weekly_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$week&to=$now&width=211&height=100";
$weekly_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$week&to=$now&width=400&height=150";
$monthly_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$month&to=$now&width=211&height=100";
$monthly_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$month&to=$now&width=400&height=150";
$yearly_graph = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$year&to=$now&width=211&height=100";
$yearly_url = "graph.php?id=" . $mempool['cempMemPool_id'] . "&type=cempMemPool&from=$year&to=$now&width=400&height=150";
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$daily_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$weekly_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$monthly_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$yearly_graph' border=0></a>");
echo("</td></tr>");
$i++;
}
echo("</table>");
echo("</div>");
?>

View File

@@ -0,0 +1,52 @@
<?php
echo("<div style='margin-top: 5px; padding: 0px;'>");
echo("<table width=100% cellpadding=6 cellspacing=0>");
$i = '1';
$procs = mysql_query("SELECT * FROM `cpmCPU` WHERE device_id = '" . $device['device_id'] . "'");
while($proc = mysql_fetch_array($procs)) {
$proc_url = "?page=device/".$device['device_id']."/health/cpm/";
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$proc['entPhysicalDescr'];
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&from=$month&to=$now&width=400&height=125\'>";
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($proc['cpuCPMTotal5minRev'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
echo("<tr><td class=tablehead width=350><a href='' $proc_popup>" . $proc['entPhysicalDescr'] . "</a></td>
<td><a href='#' $proc_popup><img src='percentage.php?per=" . $proc['cpmCPUTotal5minRev'] . "&width=600'></a></td>
<td style='font-weight: bold; color: $drv_colour'>" . $proc['cpmCPUTotal5minRev'] . "%</td>
</tr>");
echo("<tr bgcolor='$row_colour'><td colspan=5>");
$daily_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$day&to=$now&width=211&height=100";
$daily_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$day&to=$now&width=400&height=150";
$weekly_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$week&to=$now&width=211&height=100";
$weekly_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$week&to=$now&width=400&height=150";
$monthly_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$month&to=$now&width=211&height=100";
$monthly_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$month&to=$now&width=400&height=150";
$yearly_graph = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$year&to=$now&width=211&height=100";
$yearly_url = "graph.php?id=" . $proc['cpmCPU_id'] . "&type=cempMemPool&from=$year&to=$now&width=400&height=150";
echo("<a onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$daily_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$weekly_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$monthly_graph' border=0></a> ");
echo("<a onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT);\" onmouseout=\"return nd();\">
<img src='$yearly_graph' border=0></a>");
echo("</td></tr>");
$i++;
}
echo("</table>");
echo("</div>");
?>

View File

@@ -5,21 +5,14 @@ $query = mysql_query($sql);
echo("<table cellspacing=0 cellpadding=5 width=100%>");
echo("<tr class=tablehead>
<th width=200>Sensor</th>
<th width=100>Current</th>
<th width=100>Alert</th>
<th>Notes</th>
</tr>");
$row = 1;
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;\">
<td>" . $temp['temp_descr'] . "</td>
<td width=350>" . $temp['temp_descr'] . "</td>
<td>" . print_temperature($temp['temp_current'], $temp['temp_limit']) . "</td>
<td>" . $temp['temp_limit'] . "</td>
<td>" . $temp['temp_notes'] . "</td>

View File

@@ -48,7 +48,13 @@ if( !$broke)
echo("<div style='clear: both;'>");
if(file_exists("rrd/" . $hostname . "/". $ifIndex . ".rrd")) {
if($_GET['optb']) {
include("pages/device/".mres($_GET['optb']).".php");
} else {
if(file_exists("rrd/" . $hostname . "/". $ifIndex . ".rrd")) {
$iid = $id;
echo("<div class=graphhead>Interface Traffic</div>");
@@ -67,6 +73,9 @@ if(file_exists("rrd/" . $hostname . "/". $ifIndex . ".rrd")) {
$graph_type = "errors";
include("includes/print-interface-graphs.php");
}
}
?>

View File

@@ -0,0 +1,89 @@
<?
$hostname = $device['hostname'];
$hostid = $device['interface_id'];
$ifname = $interface['ifDescr'];
$ifIndex = $interface['ifIndex'];
$speed = humanspeed($interface['ifSpeed']);
$ifalias = $interface['name'];
if($interface['ifPhysAddress']) { $mac = "$interface[ifPhysAddress]"; }
$color = "black";
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'] == "up") { $status = "<span class='green'>Enabled / Connected</span>"; }
$i = 1;
$inf = fixifName($ifname);
$bg="#ffffff";
$query = mysql_query("SELECT *, (M.bps_in + M.bps_out) as bps FROM `mac_accounting` AS M, `interfaces` 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");
while($acc = mysql_fetch_array($query)) {
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."'"));
$name = gethostbyaddr($addy['ipv4_address']);
if($name == $addy['ipv4_address']) { unset ($name); }
if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; }
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_info = mysql_fetch_array($peer_query);
} else { unset ($peer_info); }
echo("<div style='background-color: $bg; padding: 8px;'>");
if($peer_info) { $asn = "AS".$peer_info['bgpPeerRemoteAs']; $astext = $peer_info['astext']; } else {
unset ($as); unset ($astext);
}
echo("
<table>
<tr>
<td class=list-large width=200>".mac_clean_to_readable($acc['mac'])."</td>
<td class=list-large width=200>".$addy['ipv4_address']."</td>
<td class=list-large width=500>".$name."</td>
<td class=list-large width=100>".formatRates($acc['bps_in'])."</td>
<td class=list-large width=100>".formatRates($acc['bps_out'])."</td>
</tr>
</table>
");
$peer_info['astext'];
$graph_type = "mac_acc";
$daily_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100";
$daily_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
$weekly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100";
$weekly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150";
$monthly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100";
$monthly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150";
$yearly_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100";
$yearly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150";
echo("<a href='?page=interface&id=" . $interface['ma_id'] . "' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
<img src='$daily_traffic' border=0></a> ");
echo("<a href='?page=interface&id=" . $interface['ma_id'] . "' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">
<img src='$weekly_traffic' border=0></a> ");
echo("<a href='?page=interface&id=" . $interface['ma_id'] . "' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
<img src='$monthly_traffic' border=0></a> ");
echo("<a href='?page=interface&id=" . $interface['ma_id'] . "' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\">
<img src='$yearly_traffic' border=0></a>");
echo("</div>");
}
?>

View File

@@ -40,14 +40,14 @@ if(mysql_result(mysql_query("SELECT count(*) from cpmCPU WHERE device_id = '" .
$procs = mysql_query("SELECT * FROM `cpmCPU` WHERE device_id = '" . $device['device_id'] . "'");
while($proc = mysql_fetch_array($procs)) {
$proc_url = "?page=device/".$device['device_id']."/sensors/processors/";
$proc_url = "?page=device/".$device['device_id']."/health/cpm/";
$proc_popup = "onmouseover=\"return overlib('<div class=list-large>".$device['hostname']." - ".$proc['entPhysicalDescr'];
$proc_popup .= "</div><img src=\'graph.php?id=" . $proc['cpmCPU_id'] . "&type=cpmCPU&from=$month&to=$now&width=400&height=125\'>";
$proc_popup .= "', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"";
if($proc['cpuCPMTotal5minRev'] > '60') { $proc_colour='#cc0000'; } else { $proc_colour='#0000cc'; }
echo("<tr><td class=tablehead><a href='' $proc_popup>" . $proc['entPhysicalDescr'] . "</a></td>
echo("<tr><td class=tablehead><a href='$proc_url' $proc_popup>" . $proc['entPhysicalDescr'] . "</a></td>
<td><a href='#' $proc_popup><img src='percentage.php?per=" . $proc['cpmCPUTotal5minRev'] . "'></a></td>
<td style='font-weight: bold; color: $drv_colour'>" . $proc['cpmCPUTotal5minRev'] . "%</td>
</tr>");
@@ -80,7 +80,7 @@ if(mysql_result(mysql_query("SELECT count(*) from cempMemPool WHERE device_id =
if($mempool['cpuCPMTotal5minRev'] > '60') { $mempool_colour='#cc0000'; } else { $mempool_colour='#0000cc'; }
echo("<tr><td class=tablehead><a href='' $mempool_popup>" . $mempool['descr_fixed'] ."</a></td>
echo("<tr><td class=tablehead><a href='$proc_url' $mempool_popup>" . $mempool['descr_fixed'] ."</a></td>
<td><a href='#' $mempool_popup><img src='percentage.php?per=" . $perc . "'></a></td>
<td style='font-weight: bold; color: $drv_colour'>$perc%</td>
<td style='color: $drv_colour'>" . formatstorage($mempool['cempMemPoolFree'], 0) . "/" . formatstorage($mempool['cempMemPoolUsed'] + $mempool['cempMemPoolFree'], 0) . "</strong></td>
@@ -107,7 +107,7 @@ if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE host_id
$total = formatStorage($total);
$used = formatStorage($used);
$fs_url = "?page=device&id=".$device['device_id']."&section=dev-storage";
$fs_url = "/device/".$device['device_id']."/health/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\'>";
@@ -115,7 +115,7 @@ if(mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE host_id
if($perc > '80') { $drv_colour='#cc0000'; } else { $drvclass='#0000cc'; }
echo("<tr><td class=tablehead><a href='".$fs_url."' $fs_popup>" . $drive['hrStorageDescr'] . "</a></td>
<td><a href='#' $fs_popup><img src='percentage.php?per=" . $drive['perc'] . "'></a></td>
<td><a href='$fs_url' $fs_popup><img src='percentage.php?per=" . $drive['perc'] . "'></a></td>
<td style='font-weight: bold; color: $drv_colour'>" . $drive['perc'] . "%</td>
<td>" . $total . "</td>
<td>" . $used . "</td>
@@ -144,7 +144,7 @@ if(mysql_result(mysql_query("SELECT count(temp_id) from temperature WHERE temp_h
$temp_colour = percent_colour($temp_perc);
$temp_url = "graph.php?id=" . $temp['temp_id'] . "&type=temp&from=$month&to=$now&width=400&height=125";
$temp_link = "<a href='?page=device&id=".$device['device_id']."&section=dev-temp' onmouseover=\"return ";
$temp_link = "<a href='/device/".$device['device_id']."/health/temp/' onmouseover=\"return ";
$temp_link .= "overlib('<div class=list-large>".$device['hostname']." - ".$temp['temp_descr'];
$temp_link .= "</div><img src=\'$temp_url\'>', RIGHT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\" >";
$temp_link .= $temp['temp_descr'] . "</a>";

View File

@@ -37,7 +37,7 @@ if($_GET['type']) {
<span class=interface-desc style='float: left;'>".generatedevicelink($interface)." ".generateiflink($interface)." </span>");
if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)){
echo("<span style='float: right;'><a href='".$config['base_url']."/?page=mac-accounting&id=".$interface['interface_id']."'><img src='/images/16/chart_curve.png' align='absmiddle'> MAC Accounting</a></span>");
echo("<span style='float: right;'><a href='".$config['base_url']."/device/".$interface['device_id']."/interface/".$interface['interface_id']."/macaccounting/'><img src='/images/16/chart_curve.png' align='absmiddle'> MAC Accounting</a></span>");
}

View File

@@ -25,9 +25,7 @@
</tr>");
if($auth_message) {
echo("<tr><td colspan=2><span style='font-weight: bold; color: #cc0000;'>$auth_message</span></td></tr>");
echo("<tr><td colspan=2><span style='font-weight: bold; color: #cc0000;'>$auth_message</span></td></tr>");
}
echo(" </table>
@@ -35,4 +33,9 @@ echo(" </table>
</tr>
</table>
</center>");
if($config['login_message']) {
echo("<div style='text-align: center; font-weight: bold; color: #cc0000; width=300px;'>".$config['login_message']."</div>");
}
?>

View File

@@ -6,13 +6,8 @@ include("includes/update-preferences-password.inc.php");
echo("<div style='width: 800px; background-color: #fff; padding:5px; margin-bottom:10px; float:left;'>");
$pref_sql = "SELECT * FROM user_prefs"
echo("</div>");
echo("<div style='width: 300px; float: right;'>");
echo("<div style='background-color: #e5e5e5; border: solid #e5e5e5 10px; margin-bottom:10px;'>");
echo("<div style='font-size: 18px; font-weight: bold; margin-bottom: 5px;'>Change Password</div>");

View File

@@ -2,6 +2,12 @@
## Common Functions
function getifhost($id) {
$sql = mysql_query("SELECT `device_id` from `interfaces` WHERE `interface_id` = '$id'");
$result = @mysql_result($sql, 0);
return $result;
}
function gethostbyid($id) {
$sql = mysql_query("SELECT `hostname` FROM `devices` WHERE `device_id` = '$id'");
$result = @mysql_result($sql, 0);

View File

@@ -13,7 +13,7 @@
foreach(explode("\n", $ents) as $entPhysicalIndex) {
$ent_data = $config['snmpget'] . " -m ENTITY-MIB -Ovqs -";
$ent_data = $config['snmpget'] . " -m ENTITY-MIB:IF-MIB -Ovqs -";
$ent_data .= $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] .":".$device['port'];
$ent_data .= " entPhysicalDescr." . $entPhysicalIndex;
$ent_data .= " entPhysicalContainedIn." . $entPhysicalIndex;
@@ -28,7 +28,8 @@
list($entPhysicalDescr,$entPhysicalContainedIn,$entPhysicalClass,$entPhysicalName,$entPhysicalSerialNum,$entPhysicalModelName,$entPhysicalMfgName,$entPhysicalVendorType,$entPhysicalParentRelPos, $ifIndex) = explode("\n", `$ent_data`);
if(strpos($ifIndex, "o") || $ifIndex == "") { unset($ifIndex); }
if(!strpos($ifIndex, "fIndex") || $ifIndex == "") { unset($ifIndex); }
list(,$ifIndex) = explode(".", $ifIndex);
$entPhysicalModelName = trim($entPhysicalModelName);
$entPhysicalSerialNum = trim($entPhysicalSerialNum);
@@ -39,12 +40,17 @@
$entPhysicalModelName = $entPhysicalVendorTypes[$entPhysicalVendorType];
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"),0)) {
$entPhysical_id = @mysql_result(mysql_query("SELECT entPhysical_id FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'"),0);
### TO DO : WRITE CODE FOR UPDATES!
if($entPhysical_id) {
$sql = "UPDATE `entPhysical` SET `ifIndex` = '$ifIndex'";
$sql .= ", entPhysicalIndex = '$entPhysicalIndex', entPhysicalDescr = '$entPhysicalDescr', entPhysicalClass = '$entPhysicalClass', entPhysicalName = '$entPhysicalName'";
$sql .= ", entPhysicalModelName = '$entPhysicalModelName', entPhysicalSerialNum = '$entPhysicalSerialNum', entPhysicalContainedIn = '$entPhysicalContainedIn'";
$sql .= ", entPhysicalMfgName = '$entPhysicalMfgName', entPhysicalParentRelPos = '$entPhysicalParentRelPos', entPhysicalVendorType = '$entPhysicalVendorType'";
$sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'";
mysql_query($sql);
echo(".");
} else {
$sql = "INSERT INTO `entPhysical` ( `device_id` , `entPhysicalIndex` , `entPhysicalDescr` , `entPhysicalClass` , `entPhysicalName` , `entPhysicalModelName` , `entPhysicalSerialNum` , `entPhysicalContainedIn`, `entPhysicalMfgName`, `entPhysicalParentRelPos`, `entPhysicalVendorType`, `ifIndex` ) ";
$sql .= "VALUES ( '" . $device['device_id'] . "', '$entPhysicalIndex', '$entPhysicalDescr', '$entPhysicalClass', '$entPhysicalName', '$entPhysicalModelName', '$entPhysicalSerialNum', '$entPhysicalContainedIn', '$entPhysicalMfgName','$entPhysicalParentRelPos' , '$entPhysicalVendorType', '$ifIndex')";
@@ -55,17 +61,23 @@
if($entPhysicalClass == "sensor") {
$sensor_cmd = $config['snmpget'] . " -m CISCO-ENTITY-SENSOR-MIB -O Uqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$sensor_cmd .= " entSensorType.$entPhysicalIndex entSensorScale.$entPhysicalIndex entSensorPrecision.$entPhysicalIndex";
$sensor_cmd .= " entSensorMeasuredEntity.$entPhysicalIndex";
$sensor_cmd .= " entSensorValueUpdateRate.$entPhysicalIndex entSensorMeasuredEntity.$entPhysicalIndex";
$sensor_data = shell_exec($sensor_cmd);
list($entSensorType,$entSensorScale,$entSensorPrecision,$entSensorValueUpdateRate,$entSensorMeasuredEntity) = explode("\n", $sensor_data);
if($entSensorMeasuredEntity) {
echo("M:$entSensorMeasuredEntity");
}
if($config['allow_entity_sensor'][$entSensorType]) {
$sql = "UPDATE `entPhysical` SET entSensorType = '$entSensorType', entSensorScale = '$entSensorScale', entSensorPrecision = '$entSensorPrecision', ";
$sql .= " entSensorMeasuredEntity = '$entSensorMeasuredEntity'";
$sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'";
mysql_query($sql);
} else {
echo("!$entSensorType");
$sql = "UPDATE `entPhysical` SET entSensorType = '', entSensorScale = '', entSensorPrecision = '', entSensorMeasuredEntity = ''";
$sql .= " WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '$entPhysicalIndex'";
}
mysql_query($sql);
}
$valid[$entPhysicalIndex] = 1;
}
@@ -74,12 +86,11 @@
$sql = "SELECT * FROM `entPhysical` WHERE `device_id` = '".$device['device_id']."'";
$query = mysql_query($sql);
while ($test = mysql_fetch_array($query)) {
$id = $test['entPhysical_id'];
$id = $test['entPhysicalIndex'];
if(!$valid[$id]) {
echo("-");
# mysql_query("DELETE FROM `entPhysical` WHERE entPhysical_id = '".$test['entPhysical_id']."'");
mysql_query("DELETE FROM `entPhysical` WHERE entPhysical_id = '".$test['entPhysical_id']."'");
}
}

View File

@@ -10,9 +10,9 @@
foreach(explode("\n", $oids) as $data) {
$data = trim($data);
list($oid,$hrStorageIndex) = explode(" ", $data);
$temp = shell_exec($config['snmpget'] . " -m HOST-RESOURCES-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " hrStorageDescr.$oid hrStorageAllocationUnits.$oid hrStorageSize.$oid hrStorageType.$oid");
$temp = shell_exec($config['snmpget'] . " -m HOST-RESOURCES-MIB:HOST-RESOURCES-TYPES -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " hrStorageDescr.$oid hrStorageAllocationUnits.$oid hrStorageSize.$oid hrStorageType.$oid");
$temp = trim($temp);
list($descr, $units, $size, $type) = explode("\n", $temp);
list($descr, $units, $size, $fstype) = explode("\n", $temp);
list($units) = explode(" ", $units);
$allow = 1;
@@ -23,7 +23,9 @@
}
}
if(strstr($type, "FixedDisk") && $size > '0' && $allow) {
echo("$fstype\n");
if(strstr($fstype, "FixedDisk") && $size > '0' && $allow) {
if(mysql_result(mysql_query("SELECT count(storage_id) FROM `storage` WHERE hrStorageIndex = '$hrStorageIndex' AND host_id = '".$device['device_id']."'"),0) == '0') {
$query = "INSERT INTO storage (`host_id`, `hrStorageIndex`, `hrStorageDescr`,`hrStorageSize`,`hrStorageAllocationUnits`) ";
$query .= "values ('".$device['device_id']."', '$hrStorageIndex', '$descr', '$size', '$units')";

View File

@@ -634,12 +634,6 @@ function hoststatus($id) {
return $result;
}
function getifhost($id) {
$sql = mysql_query("SELECT `device_id` from `interfaces` WHERE `interface_id` = '$id'");
$result = @mysql_result($sql, 0);
return $result;
}
function match_network ($nets, $ip, $first=false) {
$return = false;
if (!is_array ($nets)) $nets = array ($nets);

View File

@@ -42,7 +42,7 @@ $devices_polled = 0;
$device_query = mysql_query("SELECT * FROM `devices` WHERE status = '1' $where ORDER BY device_id ASC");
while ($device = mysql_fetch_array($device_query)) {
echo("\n" . $device['hostname'] ."\n");
echo("includes/discovery/".$type.".php");
include("includes/discovery/".$type.".php");