large graph type fix for interface mini graphs. fix mac accounting. add nifty warning background. cleanup graphing popups.

git-svn-id: http://www.observium.org/svn/observer/trunk@794 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-02-08 18:07:00 +00:00
parent 32f1569db7
commit 0c708c5fe7
6 changed files with 16 additions and 17 deletions

View File

@ -44,10 +44,9 @@ $config['snmpset'] = "/usr/bin/snmpset";
# Set the general colours and other settings for rrdtool graphs # Set the general colours and other settings for rrdtool graphs
$config['rrdgraph_def_text'] = " -c BACK#EEEEEE00 -c SHADEA#c5c5c500 -c SHADEB#c5c5c500 -c FONT#000000 -c CANVAS#FFFFFF -c GRID#a5a5a5"; $config['rrdgraph_def_text'] = " -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c FONT#000000 -c CANVAS#FFFFFF -c GRID#a5a5a5";
$config['rrdgraph_def_text'] .= " -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal"; $config['rrdgraph_def_text'] .= " -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e -R normal";
$config['overlib_defaults'] = ",FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555'";
$config['overlib_defaults'] = ",FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505'";
### List of networks to allow scanning-based discovery ### List of networks to allow scanning-based discovery
$config['nets'] = array ("89.21.224.0/19", "212.9.12.0/24", "212.9.13.0/24"); $config['nets'] = array ("89.21.224.0/19", "212.9.12.0/24", "212.9.13.0/24");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 323 B

View File

@ -1,7 +1,7 @@
<?php <?php
if($bg == $list_colour_b) { $bg = $list_colour_a; } else { $bg = $list_colour_b; } if($bg == $list_colour_b) { $bg = $list_colour_a; } else { $bg = $list_colour_b; }
if ($device['status'] == '0') { $class = "list-device-down"; } else { $class = "list-device"; } if ($device['status'] == '0') { $class = "list-device-down"; $bg_image = "images/warning-background.png"; } else { $class = "list-device"; unset ($bg_image); }
if ($device['ignore'] == '1') { if ($device['ignore'] == '1') {
$class = "list-device-ignored"; $class = "list-device-ignored";
if ($device['status'] == '1') { $class = "list-device-ignored-up"; } if ($device['status'] == '1') { $class = "list-device-ignored-up"; }
@ -14,7 +14,7 @@
$device['os_text'] = $os_text[$device['os']]; $device['os_text'] = $os_text[$device['os']];
echo(' <tr bgcolor="' . $bg . '" onmouseover="this.style.backgroundColor=\'#fdd\';" onmouseout="this.style.backgroundColor=\'' . $bg . '\';" echo(' <tr background="'.$bg_image.'" bgcolor="' . $bg . '" onmouseover="this.style.backgroundColor=\'#fdd\';" onmouseout="this.style.backgroundColor=\'' . $bg . '\';"
onclick="location.href=\'/device/'.$device['device_id'].'/\'" style="cursor: hand;"> onclick="location.href=\'/device/'.$device['device_id'].'/\'" style="cursor: hand;">
<td width="40" align="center" valign="middle">' . $image . '</td> <td width="40" align="center" valign="middle">' . $image . '</td>
<td width="300"><span style="font-weight: bold; font-size: 14px;">' . generatedevicelink($device) . '</span> <td width="300"><span style="font-weight: bold; font-size: 14px;">' . generatedevicelink($device) . '</span>

View File

@ -53,11 +53,11 @@
if($port_details) { if($port_details) {
$interface['graph_type'] = "port_bits"; $interface['graph_type'] = "port_bits";
echo(generateiflink($interface, "<img src='graph.php?type=port_bits&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>")); echo(generateiflink($interface, "<img src='graph.php?type=port_bits&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>", $interface['graph_type']));
$interface['graph_type'] = "port_upkts"; $interface['graph_type'] = "port_upkts";
echo(generateiflink($interface, "<img src='graph.php?type=port_upkts&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>")); echo(generateiflink($interface, "<img src='graph.php?type=port_upkts&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>",$interface['graph_type']));
$interface['graph_type'] = "port_errors"; $interface['graph_type'] = "port_errors";
echo(generateiflink($interface, "<img src='graph.php?type=port_errors&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>")); echo(generateiflink($interface, "<img src='graph.php?type=port_errors&port=".$interface['interface_id']."&from=".$day."&to=".$now."&width=100&height=20&legend=no&bg=".str_replace("#","", $row_colour)."'>",$interface['graph_type']));
} }
echo("</td><td width=120>"); echo("</td><td width=120>");

View File

@ -6,9 +6,9 @@ if ($_SESSION['userlevel'] < '5')
} }
else else
{ {
echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=2 width=100%>"); echo("<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>");
echo '<tr style="height: 30px"><th></th><th>Local address</th><th></th><th>Peer address</th><th>Type</th><th>Remote AS</th><th>State</th><th>Uptime</th></tr>'; echo '<tr style="height: 30px"><td width=1></td><th>Local address</th><th></th><th>Peer address</th><th>Type</th><th>Remote AS</th><th>State</th><th>Uptime</th></tr>';
$i = "1"; $i = "1";
@ -26,7 +26,7 @@ else
if(!is_integer($i/2)) { $bg_colour = $list_colour_b; } else { $bg_colour = $list_colour_a; } if(!is_integer($i/2)) { $bg_colour = $list_colour_b; } else { $bg_colour = $list_colour_a; }
if($peer['bgpPeerState'] == "established") { $col = "green"; } else { $col = "red"; if ($_GET['opta'] != "alerts") { $bg_colour = "#ffcccc"; } } if($peer['bgpPeerState'] == "established") { $col = "green"; } else { $col = "red"; if ($_GET['opta'] != "alerts") { $bg_image = "images/warning-background.png"; } }
if($peer['bgpPeerAdminStatus'] == "start" || $peer['bgpPeerAdminStatus'] == "running") { $admin_col = "green"; } else { $admin_col = "gray"; } if($peer['bgpPeerAdminStatus'] == "start" || $peer['bgpPeerAdminStatus'] == "running") { $admin_col = "green"; } else { $admin_col = "gray"; }
if($peer['bgpPeerRemoteAs'] == $peer['bgpLocalAs']) { $peer_type = "<span style='color: #00f;'>iBGP</span>"; } else { $peer_type = "<span style='color: #0a0;'>eBGP</span>"; if($peer['bgpPeerRemoteAs'] == $peer['bgpLocalAs']) { $peer_type = "<span style='color: #00f;'>iBGP</span>"; } else { $peer_type = "<span style='color: #0a0;'>eBGP</span>";
@ -37,8 +37,8 @@ else
if($peerhost) { $peername = generatedevicelink($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); } if($peerhost) { $peername = generatedevicelink($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); }
echo("<tr bgcolor=$bg_colour> echo("<tr bgcolor=$bg_colour background=$bg_image>
<td width=10></td> <td></td>
<td width=150><span class=list-large>" . $peer['bgpLocalAddr'] . "</span><br />".generatedevicelink($peer, shorthost($peer['hostname']))."</td> <td width=150><span class=list-large>" . $peer['bgpLocalAddr'] . "</span><br />".generatedevicelink($peer, shorthost($peer['hostname']))."</td>
<td width=30>-></td> <td width=30>-></td>
<td width=150><span class=list-large>" . $peer['bgpPeerIdentifier'] . "</span><br />".$peername."</td> <td width=150><span class=list-large>" . $peer['bgpPeerIdentifier'] . "</span><br />".$peername."</td>

View File

@ -24,6 +24,7 @@ print_optionbar_end();
$i = "1"; $i = "1";
$peer_query = mysql_query("select * from bgpPeers WHERE device_id = '".$device['device_id']."' ORDER BY bgpPeerRemoteAs, bgpPeerIdentifier"); $peer_query = mysql_query("select * from bgpPeers WHERE device_id = '".$device['device_id']."' ORDER BY bgpPeerRemoteAs, bgpPeerIdentifier");
while($peer = mysql_fetch_array($peer_query)) { while($peer = mysql_fetch_array($peer_query)) {
unset($bg_image);
if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
#if($peer['bgpPeerAdminStatus'] == "start") { $img = "images/16/accept.png"; } else { $img = "images/16/delete.png"; } #if($peer['bgpPeerAdminStatus'] == "start") { $img = "images/16/accept.png"; } else { $img = "images/16/delete.png"; }
if($peer['bgpPeerState'] == "established") { $col = "green"; } else { $col = "red"; $bg_image = "images/warning-background.png"; } if($peer['bgpPeerState'] == "established") { $col = "green"; } else { $col = "red"; $bg_image = "images/warning-background.png"; }
@ -104,9 +105,9 @@ print_optionbar_end();
} }
if ($_GET['opta'] == "macaccounting") { 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)) { 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")); $acc = mysql_fetch_array(mysql_query("SELECT * FROM `ipv4_mac` AS I, mac_accounting AS M, interfaces AS P WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address AND P.interface_id = M.interface_id"));
$graph_type = "mac_acc"; $graph_type = "mac_acc_bits";
$database = $config['rrd_dir'] . "/" . $device['hostname'] . "/mac-accounting/" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd"; $database = $config['rrd_dir'] . "/" . $device['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd";
if ( is_file($database) ) { if ( is_file($database) ) {
$daily_traffic = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100"; $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"; $daily_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150";
@ -116,7 +117,6 @@ print_optionbar_end();
$monthly_url = "graph.php?id=" . $acc['ma_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150"; $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_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"; $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("<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();\"> 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> "); <img src='$daily_traffic' border=0></a> ");