mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* breakout handling of suricata extend v. 1 returns * initial work for suricata 7.0.0 * add shared file for various Suricata related variables * update handling for new Suricata stuff * fix suricata rrd name bits * update suricata app page a bit * misc * add a new v2 suricata graph * more suricata v2 graphs * fix app data for suricata * more graph work * fix initial graphs * the page selector for suricata v2 * more cleanup for suricata stuff * add more graphs * add suricata_v2_pkt_drop.inc.php * add suricata_v2_error_delta.inc.php * add suricata app layer flows graph * add app layer tx * start work on bypassed * add flow bypass stuff * add suricata error stuff * add more graphs * more suricata v2 work * ... * add packets overview * cleanup suricata_packets_overview.inc.php * more work on the overview graphs * error delta is now per second * cleanup suricata_v2_app_layer_error_alloc.inc.php * add new flow proto stuff * add suricata_v2_flow_proto * add new overview graph * update v2 app layer flows graph * more v2 graph cleanup * suricata graph cleanup * suricata_dec_proto_overview now works * more graph work for suricata * more graph work * add another overview graph * snmp fix * add a new overview graph * add a new over view * more graph stuff * more memory graphs * tidy pages bit * more work on decoder stuff * more decoder work * decoder stuff done * cleanup suricata_packets_overview.inc.php * appl layer tx work * add app flow stuff * fix suricata_v2_decoder__event__ethernet.inc.php * fix suricata_v2_decoder__event__ipv4.inc.php * fix suricata_v2_decoder__event__ipv6.inc.php * add alloc error stuff * more error related work * more error stuff * start work on internal errors * add internal error graphs * parser error stuff done * more decoder work * decoder icmpv4 * more decoder work * ltnull done * mpls decoder stuff * nsh decoder work * decoder ppp done * more decoder work * more decoder work * more vlan work * vntag decoder stuff done * descr_len auto set for generic stats * ipv6 decoder stuff done * style fix * style fix * more style cleanup * more suricata graph work * fix require usage * tweak drop info a bit * add some checks for for with suricata 7.0.4 * more suricata tweaks * fix sagan instance handling * another minor fix * fix improper munging * rever something accidentally added to this repo * add linux_suricata-v2.snmprex * rename the metrics for instances from instance_ to instances_ * add linux_suricata-v2.json test data * style fix * minor munging tweak * style cleanup * some app data fixes * remove a typo from test data * add deleted_at and make sure discovered is numeric and not a string 1 * derp... json fix * remove something accidentally added * fix a small erorr in the test data * add a missing variable to the test data * try another tweak for suricata json test stuff * derp... fix a type in the suricata poller * revert a test data change * re-order some the metrics in the test * some more metric re-ordering * add a missing status * remove something that was accidentally added to this branch instead of another * strcmp cleanup * style fix
241 lines
7.5 KiB
PHP
241 lines
7.5 KiB
PHP
<?php
|
|
/*
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
* option) any later version. Please see LICENSE.txt at the top level of
|
|
* the source code distribution for details.
|
|
*
|
|
* @package LibreNMS
|
|
* @subpackage graphs
|
|
* @link https://www.librenms.org
|
|
* @copyright 2017 LibreNMS
|
|
* @author LibreNMS Contributors
|
|
*/
|
|
|
|
require 'includes/html/graphs/common.inc.php';
|
|
|
|
$stacked = generate_stacked_graphs();
|
|
|
|
if (! isset($munge)) {
|
|
$munge = false;
|
|
}
|
|
|
|
if (! isset($no_hourly)) {
|
|
$no_hourly = false;
|
|
}
|
|
|
|
if (! isset($no_daily)) {
|
|
$no_daily = false;
|
|
}
|
|
|
|
if (! isset($no_weekly)) {
|
|
$no_weekly = false;
|
|
}
|
|
|
|
if (! isset($no_percentile)) {
|
|
$no_percentile = false;
|
|
}
|
|
|
|
if (! isset($colours)) {
|
|
$colours = 'rainbow_stats_purple';
|
|
}
|
|
|
|
if (! isset($descr_len) && isset($descr)) {
|
|
$descr_len = strlen($descr);
|
|
if ($descr_len < 12) {
|
|
$descr_len = 12;
|
|
}
|
|
} elseif (! isset($descr_len)) {
|
|
$descr_len = 12;
|
|
}
|
|
|
|
if ($nototal) {
|
|
$descr_len += '2';
|
|
$unitlen += '2';
|
|
}
|
|
|
|
if ($height > 99) {
|
|
$rrd_options .= " COMMENT:'" . \LibreNMS\Data\Store\Rrd::fixedSafeDescr($unit_text, $descr_len) . " Now Min Max Avg\l'";
|
|
}
|
|
|
|
$i = 0;
|
|
$iter = 0;
|
|
|
|
if (! isset($colour)) {
|
|
$colour = \LibreNMS\Config::get("graph_colours.$colours.$iter");
|
|
$iter++;
|
|
}
|
|
|
|
if (! isset($colourA)) {
|
|
$colourA = $colour;
|
|
}
|
|
|
|
if (! isset($colourAalpha)) {
|
|
$colourAalpha = 33;
|
|
}
|
|
|
|
if (! isset($colour25th)) {
|
|
if (! \LibreNMS\Config::get("graph_colours.$colours.$iter")) {
|
|
$iter = 0;
|
|
}
|
|
$colour25th = \LibreNMS\Config::get("graph_colours.$colours.$iter");
|
|
$iter++;
|
|
}
|
|
|
|
if (! isset($colour50th)) {
|
|
if (! \LibreNMS\Config::get("graph_colours.$colours.$iter")) {
|
|
$iter = 0;
|
|
}
|
|
$colour50th = \LibreNMS\Config::get("graph_colours.$colours.$iter");
|
|
$iter++;
|
|
}
|
|
|
|
if (! isset($colour75th)) {
|
|
if (! \LibreNMS\Config::get("graph_colours.$colours.$iter")) {
|
|
$iter = 0;
|
|
}
|
|
$colour75th = \LibreNMS\Config::get("graph_colours.$colours.$iter");
|
|
$iter++;
|
|
}
|
|
|
|
if (! isset($colour1h)) {
|
|
if (! \LibreNMS\Config::get("graph_colours.$colours.$iter")) {
|
|
$iter = 0;
|
|
}
|
|
$colour1h = \LibreNMS\Config::get("graph_colours.$colours.$iter");
|
|
$iter++;
|
|
}
|
|
|
|
if (! isset($colour1d)) {
|
|
if (! \LibreNMS\Config::get("graph_colours.$colours.$iter")) {
|
|
$iter = 0;
|
|
}
|
|
$colour1d = \LibreNMS\Config::get("graph_colours.$colours.$iter");
|
|
$iter++;
|
|
}
|
|
|
|
if (! isset($colour1w)) {
|
|
if (! \LibreNMS\Config::get("graph_colours.$colours.$iter")) {
|
|
$iter = 0;
|
|
}
|
|
$colour1w = \LibreNMS\Config::get("graph_colours.$colours.$iter");
|
|
$iter++;
|
|
}
|
|
|
|
$graph_stat_percentile_disable = \LibreNMS\Config::get('graph_stat_percentile_disable');
|
|
|
|
$descr = \LibreNMS\Data\Store\Rrd::fixedSafeDescr($descr, $descr_len);
|
|
|
|
if ($height > 25) {
|
|
if (! $no_hourly) {
|
|
$descr_1h = \LibreNMS\Data\Store\Rrd::fixedSafeDescr('1 hour avg', $descr_len);
|
|
}
|
|
if (! $no_daily) {
|
|
$descr_1d = \LibreNMS\Data\Store\Rrd::fixedSafeDescr('1 day avg', $descr_len);
|
|
}
|
|
if (! $no_weekly) {
|
|
$descr_1w = \LibreNMS\Data\Store\Rrd::fixedSafeDescr('1 week avg', $descr_len);
|
|
}
|
|
}
|
|
|
|
$id = 'ds0';
|
|
if ($munge) {
|
|
$id = 'dsm0';
|
|
}
|
|
|
|
$rrd_options .= ' DEF:ds0' . "=$filename:$ds:AVERAGE";
|
|
|
|
$munge_helper = '';
|
|
if ($munge) {
|
|
if (! isset($munge_opts)) {
|
|
$munge_opts = '86400,/';
|
|
}
|
|
$rrd_options .= ' CDEF:dsm0=ds0,' . $munge_opts;
|
|
$munge_helper = 'ds';
|
|
}
|
|
|
|
$rrd_optionsb .= ' AREA:' . $id . '#' . $colourA . $colourAalpha;
|
|
$rrd_optionsb .= ' LINE1.25:' . $id . '#' . $colour . ":'$descr'";
|
|
|
|
if ($height > 25) {
|
|
if (! $no_hourly) {
|
|
$rrd_options .= ' DEF:' . $id . "1h$munge_helper=$filename:$ds:AVERAGE:step=3600";
|
|
}
|
|
if ($munge) {
|
|
$rrd_options .= ' CDEF:dsm01h=dsm01hds,' . $munge_opts;
|
|
}
|
|
$rrd_options .= ' VDEF:' . $id . '50th=' . $id . ',50,PERCENTNAN';
|
|
$rrd_options .= ' VDEF:' . $id . '25th=' . $id . ',25,PERCENTNAN';
|
|
$rrd_options .= ' VDEF:' . $id . '75th=' . $id . ',75,PERCENTNAN';
|
|
|
|
// the if is needed as with out it the group page will case an error
|
|
// devices/group=1/format=graph_poller_perf/from=-24hour/to=now/
|
|
if (is_numeric($vars['to']) && is_numeric($vars['from'])) {
|
|
$time_diff = $vars['to'] - $vars['from'];
|
|
} else {
|
|
$time_diff = 1;
|
|
}
|
|
// displays nan if less than 17 hours
|
|
if (! $no_daily) {
|
|
if ($time_diff >= 61200) {
|
|
$rrd_options .= ' DEF:' . $id . "1d$munge_helper=$filename:$ds:AVERAGE:step=86400";
|
|
if ($munge) {
|
|
$rrd_options .= ' CDEF:dsm01d=dsm01dds,' . $munge_opts;
|
|
}
|
|
}
|
|
}
|
|
|
|
// weekly breaks and causes issues if it is less than 8 days
|
|
if (! $no_weekly) {
|
|
if ($time_diff >= 691200) {
|
|
$rrd_options .= ' DEF:' . $id . "1w$munge_helper=$filename:$ds:AVERAGE:step=604800";
|
|
if ($munge) {
|
|
$rrd_options .= ' CDEF:dsm01w=dsm01wds,' . $munge_opts;
|
|
}
|
|
}
|
|
}
|
|
|
|
$rrd_optionsb .= ' GPRINT:' . $id . ':LAST:%5.' . $float_precision . 'lf%s' . $units . ' GPRINT:' . $id . ':MIN:%5.' . $float_precision . 'lf%s' . $units;
|
|
$rrd_optionsb .= ' GPRINT:' . $id . ':MAX:%5.' . $float_precision . 'lf%s' . $units . ' GPRINT:' . $id . ":AVERAGE:'%5." . $float_precision . "lf%s$units\\n'";
|
|
|
|
if (! $no_hourly) {
|
|
$rrd_optionsb .= ' LINE1.25:' . $id . '1h#' . $colour1h . ":'$descr_1h'";
|
|
$rrd_optionsb .= ' GPRINT:' . $id . '1h:LAST:%5.' . $float_precision . 'lf%s' . $units . ' GPRINT:' . $id . '1h:MIN:%5.' . $float_precision . 'lf%s' . $units;
|
|
$rrd_optionsb .= ' GPRINT:' . $id . '1h:MAX:%5.' . $float_precision . 'lf%s' . $units . ' GPRINT:' . $id . "1h:AVERAGE:'%5." . $float_precision . "lf%s$units\\n'";
|
|
}
|
|
|
|
if (! $no_daily) {
|
|
if ($time_diff >= 61200) {
|
|
$rrd_optionsb .= ' LINE1.25:' . $id . '1d#' . $colour1d . ":'$descr_1d'";
|
|
$rrd_optionsb .= ' GPRINT:' . $id . '1d:LAST:%5.' . $float_precision . 'lf%s' . $units . ' GPRINT:' . $id . '1d:MIN:%5.' . $float_precision . 'lf%s' . $units;
|
|
$rrd_optionsb .= ' GPRINT:' . $id . '1d:MAX:%5.' . $float_precision . 'lf%s' . $units . ' GPRINT:' . $id . "1d:AVERAGE:'%5." . $float_precision . "lf%s$units\\n'";
|
|
}
|
|
}
|
|
|
|
if (! $no_weekly) {
|
|
if ($time_diff >= 691200) {
|
|
$rrd_optionsb .= ' LINE1.25:' . $id . '1w#' . $colour1w . ":'$descr_1w'";
|
|
$rrd_optionsb .= ' GPRINT:' . $id . '1w:LAST:%5.' . $float_precision . 'lf%s' . $units . ' GPRINT:' . $id . '1w:MIN:%5.' . $float_precision . 'lf%s' . $units;
|
|
$rrd_optionsb .= ' GPRINT:' . $id . '1w:MAX:%5.' . $float_precision . 'lf%s' . $units . ' GPRINT:' . $id . "1w:AVERAGE:'%5." . $float_precision . "lf%s$units\\n'";
|
|
}
|
|
}
|
|
|
|
if (! $no_percentile) {
|
|
if (! $graph_stat_percentile_disable) {
|
|
$rrd_optionsb .= ' HRULE:' . $id . '25th#' . $colour25th . ':25th_Percentile';
|
|
$rrd_optionsb .= ' GPRINT:' . $id . '25th:%' . $float_precision . 'lf%s\n';
|
|
|
|
$rrd_optionsb .= ' HRULE:' . $id . '50th#' . $colour50th . ':50th_Percentile';
|
|
$rrd_optionsb .= ' GPRINT:' . $id . '50th:%' . $float_precision . 'lf%s\n';
|
|
|
|
$rrd_optionsb .= ' HRULE:' . $id . '75th#' . $colour75th . ':75th_Percentile';
|
|
$rrd_optionsb .= ' GPRINT:' . $id . '75th:%' . $float_precision . 'lf%s\n';
|
|
}
|
|
}
|
|
}
|
|
$rrd_options .= $rrd_optionsb;
|
|
$rrd_options .= ' HRULE:0#555555';
|
|
|
|
unset($stacked);
|