diff --git a/html/includes/graphs/device/nfsen_common.inc.php b/html/includes/graphs/device/nfsen_common.inc.php new file mode 100644 index 0000000000..e71c96c041 --- /dev/null +++ b/html/includes/graphs/device/nfsen_common.inc.php @@ -0,0 +1,45 @@ + diff --git a/html/includes/graphs/device/nfsen_flows.inc.php b/html/includes/graphs/device/nfsen_flows.inc.php new file mode 100644 index 0000000000..0a2fd8f0ce --- /dev/null +++ b/html/includes/graphs/device/nfsen_flows.inc.php @@ -0,0 +1,5 @@ + diff --git a/html/includes/graphs/device/nfsen_packets.inc.php b/html/includes/graphs/device/nfsen_packets.inc.php new file mode 100644 index 0000000000..bf4dad4bb3 --- /dev/null +++ b/html/includes/graphs/device/nfsen_packets.inc.php @@ -0,0 +1,5 @@ + diff --git a/html/includes/graphs/device/nfsen_traffic.inc.php b/html/includes/graphs/device/nfsen_traffic.inc.php new file mode 100644 index 0000000000..735b81d0f5 --- /dev/null +++ b/html/includes/graphs/device/nfsen_traffic.inc.php @@ -0,0 +1,5 @@ + diff --git a/html/includes/graphs/generic_multi_simplex_seperated.inc.php b/html/includes/graphs/generic_multi_simplex_seperated.inc.php index 9522cae6e1..680d1afa79 100644 --- a/html/includes/graphs/generic_multi_simplex_seperated.inc.php +++ b/html/includes/graphs/generic_multi_simplex_seperated.inc.php @@ -7,21 +7,28 @@ $rrd_options .= " COMMENT:'$unit_text Cur Max'"; if (!$nototal) { $rrd_options .= " COMMENT:'Total '"; } $rrd_options .= " COMMENT:'\\n'"; -$i = 0; +$iter=0; foreach ($rrd_list as $rrd) { if (!$config['graph_colours'][$colours][$iter]) { $iter = 0; } $colour = $config['graph_colours'][$colours][$iter]; $rrd_options .= " DEF:".$rrd['rra'].$i."=".$rrd['filename'].":".$rrd['rra'].":AVERAGE "; $rrd_options .= " DEF:".$rrd['rra'].$i."max=".$rrd['filename'].":".$rrd['rra'].":MAX "; - - if (!$args['nototal']) + if (!$nototal) { $rrd_options .= " VDEF:tot".$rrd['rra'].$i."=".$rrd['rra'].$i.",TOTAL"; } if ($i) { $stack="STACK"; } - $rrd_options .= " AREA:".$rrd['rra'].$i."#" . $colour . ":'" . substr(str_pad($rrd['descr'], 18),0,18) . "':$stack"; + + # if we've been passed a multiplier we must make a CDEF based on it! + $defname = $rrd['rra']; + if (is_numeric($multiplier)) + { + $defname = $defname . "_cdef"; + $rrd_options .= " CDEF:" . $defname . $i . "=" . $rrd['rra'] . $i . "," . $multiplier . ",*"; + } + $rrd_options .= " AREA:" . $defname . $i . "#" . $colour . ":'" . substr(str_pad($rrd['descr'], 18),0,18) . "':$stack"; $rrd_options .= " GPRINT:".$rrd['rra'].$i.":LAST:%6.2lf%s$units"; $rrd_options .= " GPRINT:".$rrd['rra'].$i."max:MAX:%6.2lf%s$units"; @@ -31,4 +38,4 @@ foreach ($rrd_list as $rrd) $i++; $iter++; } -?> \ No newline at end of file +?> diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index 1f00f834b5..b379c04dfe 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -212,6 +212,27 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id']) '); } + if ($config['nfsen_enable']) + { + if (!is_array($config['nfsen_rrds'])) { $config['nfsen_rrds'] = array($config['nfsen_rrds']); } + foreach ($config['nfsen_rrds'] as $nfsenrrds) + { + if ($configs[strlen($nfsenrrds)-1] != '/') { $nfsenrrds .= '/'; } + $basefilename_underscored = preg_replace('/\./', $config['nfsen_split_char'], $device['hostname']); + if (is_file($nfsenrrds . $basefilename_underscored . ".rrd")) { $nfsen_rrd_file = $nfsenrrds . $basefilename_underscored . ".rrd"; } + } + } + + if ($nfsen_rrd_file) + { + echo('