From 0c708c5fe70b025eb0c4ed8dc13a22ddb7d51f5e Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Mon, 8 Feb 2010 18:07:00 +0000 Subject: [PATCH] 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 --- config.php.default | 5 ++--- html/images/warning-background.png | Bin 1132 -> 323 bytes html/includes/hostbox.inc | 4 ++-- html/includes/print-interface.inc.php | 6 +++--- html/pages/bgp.php | 10 +++++----- html/pages/device/bgp.inc.php | 8 ++++---- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/config.php.default b/config.php.default index eac5631b9..76581ebfb 100755 --- a/config.php.default +++ b/config.php.default @@ -44,10 +44,9 @@ $config['snmpset'] = "/usr/bin/snmpset"; # 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['overlib_defaults'] = ",FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505'"; +$config['overlib_defaults'] = ",FGCOLOR,'#ffffff', BGCOLOR, '#e5e5e5', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#555555'"; ### 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"); diff --git a/html/images/warning-background.png b/html/images/warning-background.png index 9e87b6931fcdded6575f049ab9951f2afeafecd8..f7f5d1117493772b7e51083dce3aadf28c0fb2c1 100644 GIT binary patch delta 209 zcmV;?051RR2*U!9dVc`3NklkWV)41}4{1z-u+a}#DkYJ!jWf-9vlNWxEY z_q9jC1n&d9r_mb53UrQd$Ec-bF3glZ0luF1~1I&lT!p}MVLpbp1 zJ%v0-{CoLX6!q}dwoW^ zwIyl)xe%7Y&;9SFu%0i#LIHeO$gBzpUIlowW(01_s&H$Ia(|)%bmsu}(S48Lx5sAS zS0&+AGcw4h)kFn^xikt$sorizc7C3kfj9SsTYfFQ&6k?i2L))3$#*V=XGV`dfCk*% zW!e35UIr_izH_dmRr733D%W=d9Sd-ZKVwPlWW?6h+D=q08K`N zYLiJvV<+d|%~q}5Iv1FrWHa0%E$lI-hXN9lA@AfIoqsp0W}P?d!l`GZTbKps=zI&5 z<{l|PcMgZ6$vE{DsNHPUoXZ_;GW^Vd;6-!~&Ih{>Nku#ji^9H3 zAk8hS)7TY$=@s@IoWtL>+O^5_3n2Jt0UoC0?Z1(oJA+{BVq0|Q|4jzKvD!n7c93&+ z9KFWFRj*~F^PxEXA|(hRJdwTIlY}bJ{Ft>vEu>30o=XVHUMX&!r^E#bj^UVs)L0z zj9a^C0?hwjd09GVJJW-=TNk1So7P9^1C!||X(Tjujy2=q0Wo^p^RoBJAX^xz&cP~z zg@2wN+v~F?!^xx>Y|2#zoOgM>BG1_sN2!A)zGM=`_jf!Rxi%TRmz|q|BUs$h0y@Vf zL($P>;$TU3JTaO6o`Z9kj9Y*XkQ-+t_-hNeaYx6Ia;+yaD%}zVlowE%c+6d z+c(ETU#}CHOd>!Q0h7Tovgz*0h6h(UfL%H!E)b{NHu&> ugu=D2KXSc}1`W?Fe=Dv2w$9f~GW{P#O}f)c09tnd0000 ' . $image . ' ' . generatedevicelink($device) . ' diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php index b4493833b..9387077f3 100644 --- a/html/includes/print-interface.inc.php +++ b/html/includes/print-interface.inc.php @@ -53,11 +53,11 @@ if($port_details) { $interface['graph_type'] = "port_bits"; - echo(generateiflink($interface, "")); + echo(generateiflink($interface, "", $interface['graph_type'])); $interface['graph_type'] = "port_upkts"; - echo(generateiflink($interface, "")); + echo(generateiflink($interface, "",$interface['graph_type'])); $interface['graph_type'] = "port_errors"; - echo(generateiflink($interface, "")); + echo(generateiflink($interface, "",$interface['graph_type'])); } echo(""); diff --git a/html/pages/bgp.php b/html/pages/bgp.php index 72b901a77..a46e5d343 100644 --- a/html/pages/bgp.php +++ b/html/pages/bgp.php @@ -6,9 +6,9 @@ if ($_SESSION['userlevel'] < '5') } else { - echo("
"); + echo("
"); - echo ''; + echo ''; $i = "1"; @@ -26,7 +26,7 @@ else 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['bgpPeerRemoteAs'] == $peer['bgpLocalAs']) { $peer_type = "iBGP"; } else { $peer_type = "eBGP"; @@ -37,8 +37,8 @@ else if($peerhost) { $peername = generatedevicelink($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); } - echo(" - + echo(" + diff --git a/html/pages/device/bgp.inc.php b/html/pages/device/bgp.inc.php index e7f502123..2907fa4fe 100644 --- a/html/pages/device/bgp.inc.php +++ b/html/pages/device/bgp.inc.php @@ -24,6 +24,7 @@ print_optionbar_end(); $i = "1"; $peer_query = mysql_query("select * from bgpPeers WHERE device_id = '".$device['device_id']."' ORDER BY bgpPeerRemoteAs, bgpPeerIdentifier"); 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($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"; } @@ -104,9 +105,9 @@ print_optionbar_end(); } 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"; - $database = $config['rrd_dir'] . "/" . $device['hostname'] . "/mac-accounting/" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd"; + $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_bits"; + $database = $config['rrd_dir'] . "/" . $device['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd"; if ( is_file($database) ) { $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"; @@ -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"; $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("
Local addressPeer addressTypeRemote ASStateUptime
Local addressPeer addressTypeRemote ASStateUptime
" . $peer['bgpLocalAddr'] . "
".generatedevicelink($peer, shorthost($peer['hostname']))."
-> " . $peer['bgpPeerIdentifier'] . "
".$peername."
"); echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> ");