mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
graph improvements. FIXME - graph defs are getting messier. NEED SIMPLIFICATION.
git-svn-id: http://www.observium.org/svn/observer/trunk@3160 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -30,6 +30,6 @@ $scale_min = "0";
|
|||||||
$nototal = 1;
|
$nototal = 1;
|
||||||
$simple_rrd = TRUE;
|
$simple_rrd = TRUE;
|
||||||
|
|
||||||
include("includes/graphs/generic_multi_line.inc.php");
|
include("includes/graphs/generic_multi.inc.php");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -1,30 +1,21 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$device = device_by_id_cache($id);
|
|
||||||
|
|
||||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-snmp.rrd";
|
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-snmp.rrd";
|
||||||
|
|
||||||
$stats = array('snmpInPkts',
|
$ds_in = "snmpInPkts";
|
||||||
'snmpOutPkts');
|
$ds_out = "snmpOutPkts";
|
||||||
|
|
||||||
$i=0;
|
$colour_area_in = "AA66AA";
|
||||||
foreach ($stats as $stat)
|
$colour_line_in = "330033";
|
||||||
{
|
$colour_area_out = "FFDD88";
|
||||||
$i++;
|
$colour_line_out = "FF6600";
|
||||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
|
||||||
$rrd_list[$i]['descr'] = str_replace("snmp", "", $stat);
|
|
||||||
$rrd_list[$i]['ds'] = $stat;
|
|
||||||
if (strpos($stat, "Out") !== FALSE)
|
|
||||||
{
|
|
||||||
$rrd_list[$i]['invert'] = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$colours='mixed';
|
$colour_area_in_max = "cc88cc";
|
||||||
|
$colour_area_out_max = "FFefaa";
|
||||||
|
|
||||||
$nototal = 1;
|
$graph_max = 1;
|
||||||
$simple_rrd = TRUE;
|
$unit_text = "Packets";
|
||||||
|
|
||||||
include("includes/graphs/generic_multi_line.inc.php");
|
include("includes/graphs/generic_duplex.inc.php");
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
74
html/includes/graphs/generic_multi.inc.php
Normal file
74
html/includes/graphs/generic_multi.inc.php
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
include("includes/graphs/common.inc.php");
|
||||||
|
|
||||||
|
if($width > "500")
|
||||||
|
{
|
||||||
|
$descr_len=24;
|
||||||
|
} else {
|
||||||
|
$descr_len=12;
|
||||||
|
$descr_len += round(($width - 250) / 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($nototal) { $descrlen += "2"; $unitlen += "2";}
|
||||||
|
|
||||||
|
if($width > "500")
|
||||||
|
{
|
||||||
|
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'";
|
||||||
|
if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; }
|
||||||
|
$rrd_options .= " COMMENT:'\l'";
|
||||||
|
} else {
|
||||||
|
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)."Now Min Max Avg\l'";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
$iter = 0;
|
||||||
|
|
||||||
|
foreach ($rrd_list as $rrd)
|
||||||
|
{
|
||||||
|
if (!$config['graph_colours'][$colours][$iter]) { $iter = 0; }
|
||||||
|
|
||||||
|
$colour=$config['graph_colours'][$colours][$iter];
|
||||||
|
|
||||||
|
$ds = $rrd['ds'];
|
||||||
|
$filename = $rrd['filename'];
|
||||||
|
|
||||||
|
$descr = str_replace(":", "\:", substr(str_pad($rrd['descr'], $descr_len),0,$descr_len));
|
||||||
|
|
||||||
|
$id = "ds".$i;
|
||||||
|
|
||||||
|
$rrd_options .= " DEF:".$id."=$filename:$ds:AVERAGE";
|
||||||
|
|
||||||
|
if ($simple_rrd)
|
||||||
|
{
|
||||||
|
$rrd_options .= " CDEF:".$id."min=".$id." ";
|
||||||
|
$rrd_options .= " CDEF:".$id."max=".$id." ";
|
||||||
|
} else {
|
||||||
|
$rrd_options .= " DEF:".$id."min=$filename:$ds:MIN";
|
||||||
|
$rrd_options .= " DEF:".$id."max=$filename:$ds:MAX";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rrd['invert'])
|
||||||
|
{
|
||||||
|
$rrd_options .= " CDEF:".$id."i=".$id.",-1,*";
|
||||||
|
$rrd_optionsc .= " AREA:".$id."i#".$colour.":'$descr':".$cstack;
|
||||||
|
$rrd_optionsc .= " GPRINT:".$id.":LAST:%5.1lf%s GPRINT:".$id."min:MIN:%5.1lf%s";
|
||||||
|
$rrd_optionsc .= " GPRINT:".$id."max:MAX:%5.1lf%s GPRINT:".$id.":AVERAGE:'%5.1lf%s\\n'";
|
||||||
|
$cstack = "STACK";
|
||||||
|
} else {
|
||||||
|
$rrd_optionsb .= " AREA:".$id."#".$colour.":'$descr':".$bstack;
|
||||||
|
$rrd_optionsb .= " GPRINT:".$id.":LAST:%5.1lf%s GPRINT:".$id."min:MIN:%5.1lf%s";
|
||||||
|
$rrd_optionsb .= " GPRINT:".$id."max:MAX:%5.1lf%s GPRINT:".$id.":AVERAGE:'%5.1lf%s\\n'";
|
||||||
|
$bstack = "STACK";
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++; $iter++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$rrd_options .= $rrd_optionsb;
|
||||||
|
$rrd_options .= " HRULE:0#555555";
|
||||||
|
$rrd_options .= $rrd_optionsc;
|
||||||
|
|
||||||
|
?>
|
Reference in New Issue
Block a user