some graph cleanups and minor improvements

git-svn-id: http://www.observium.org/svn/observer/trunk@1161 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-06-13 14:39:09 +00:00
parent 06ee8ec7d2
commit c9bff08425
6 changed files with 51 additions and 17 deletions

View File

@@ -38,42 +38,42 @@
$rrd_options .= " COMMENT:'Packets/sec Current Average Maximum\\n'";
$rrd_options .= " AREA:InReceives_4#003300:'InReceives v4'";
$rrd_options .= " AREA:InReceives_4#CDEB8B:'InReceives v4'";
$rrd_options .= " GPRINT:InReceives_4:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:InReceives_4:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:InReceives_4:MAX:%6.2lf%s\\\\n";
$rrd_options .= " AREA:InReceives_6#91B13C:' v6':STACK";
$rrd_options .= " AREA:InReceives_6#8C9E5E:' v6':STACK";
$rrd_options .= " GPRINT:InReceives_6:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:InReceives_6:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:InReceives_6:MAX:%6.2lf%s\\\\n";
$rrd_options .= " AREA:OutRequests_4_n#000033:'OutRequests v4'";
$rrd_options .= " AREA:OutRequests_4_n#C3D9FF:'OutRequests v4'";
$rrd_options .= " GPRINT:OutRequests_4:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:OutRequests_4:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:OutRequests_4:MAX:%6.2lf%s\\\\n";
$rrd_options .= " AREA:OutRequests_6_n#8080BD:' v6':STACK";
$rrd_options .= " AREA:OutRequests_6_n#8D9CB7:' v6':STACK";
$rrd_options .= " GPRINT:OutRequests_6:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:OutRequests_6:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:OutRequests_6:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:InForwDatagrams_4#AF63AF:'InForward v4'";
$rrd_options .= " AREA:InForwDatagrams_4#AF63AF:'InForward v4'";
$rrd_options .= " GPRINT:InForwDatagrams_4:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:InForwDatagrams_4:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:InForwDatagrams_4:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:InForwDatagrams_6#3F003F:' v6'";
$rrd_options .= " AREA:InForwDatagrams_6#3F003F:' v6':STACK";
$rrd_options .= " GPRINT:InForwDatagrams_6:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:InForwDatagrams_6:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:InForwDatagrams_6:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:OutForwDatagrams_4#AF63AF:'OutForward v4'";
$rrd_options .= " AREA:OutForwDatagrams_4#AF63AF:'OutForward v4'";
$rrd_options .= " GPRINT:OutForwDatagrams_4:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:OutForwDatagrams_4:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:OutForwDatagrams_4:MAX:%6.2lf%s\\\\n";
$rrd_options .= " LINE1.25:OutForwDatagrams_6#3F003F:' v6'";
$rrd_options .= " AREA:OutForwDatagrams_6#3F003F:' v6':STACK";
$rrd_options .= " GPRINT:OutForwDatagrams_6:LAST:%6.2lf%s";
$rrd_options .= " GPRINT:OutForwDatagrams_6:AVERAGE:%6.2lf%s";
$rrd_options .= " GPRINT:OutForwDatagrams_6:MAX:%6.2lf%s\\\\n";

View File

@@ -42,15 +42,16 @@ if(is_numeric($_GET['topn'])) { $topn = $_GET['topn']; } else { $topn = '10'; }
while($acc = mysql_fetch_array($query)) {
$this_rrd = $config['rrd_dir'] . "/" . $acc['hostname'] . "/" . safename("cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd");
if(is_file($this_rrd)) {
$name = $acc['mac'];
$mac = formatmac($acc['mac']);
$name = $mac;
$addy = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_mac where mac_address = '".$acc['mac']."' AND interface_id = '".$acc['interface_id']."'"));
if($addy) {
$name = $addy['ipv4_address'];
$name = $addy['ipv4_address'] . " (".$mac.")";
$peer = mysql_fetch_array(mysql_query("SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D
WHERE A.ipv4_address = '".$addy['ipv4_address']."'
AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
if($peer) {
$name = $peer['hostname'] . " " . $peer['ifDescr'];
$name = $peer['hostname'] . " " . makeshortif($peer['ifDescr']) . " (".$mac.")";
}
if(mysql_result(mysql_query("SELECT count(*) FROM bgpPeers WHERE device_id = '".$acc['device_id']."' AND bgpPeerIdentifier = '".
@@ -70,6 +71,9 @@ if(is_numeric($_GET['topn'])) { $topn = $_GET['topn']; } else { $topn = '10'; }
$colour=$config['graph_colours'][$colours][$iter];
$descr = str_pad($name, 36);
$descr = substr($descr,0,36);
$descr = str_replace("(", "(", $descr);
$descr = str_replace(")", ")", $descr);
$descr = str_replace(":", "\\:", $descr);
$rrd_options .= " DEF:in".$this_id."=$this_rrd:".$prefix."IN:AVERAGE ";
$rrd_options .= " DEF:out".$this_id."temp=$this_rrd:".$prefix."OUT:AVERAGE ";
$rrd_options .= " CDEF:inB".$this_id."=in".$this_id.",$multiplier,* ";