1 | <?php |
||
2 | /* |
||
3 | * LibreNMS module to Graph Huawei VRP Icmp metrics |
||
4 | * |
||
5 | * Copyright (c) 2021 PipoCanaja |
||
6 | * |
||
7 | * This program is free software: you can redistribute it and/or modify it |
||
8 | * under the terms of the GNU General Public License as published by the |
||
9 | * Free Software Foundation, either version 3 of the License, or (at your |
||
10 | * option) any later version. Please see LICENSE.txt at the top level of |
||
11 | * the source code distribution for details. |
||
12 | */ |
||
13 | |||
14 | $sla = dbFetchRow('SELECT `sla_nr` FROM `slas` WHERE `sla_id` = ?', [$vars['id']]); |
||
15 | |||
16 | require 'includes/html/graphs/common.inc.php'; |
||
17 | $rrd_options .= ' -l 0 -E '; |
||
18 | $rrd_filename = Rrd::name($device['hostname'], ['sla', $sla['sla_nr'], 'icmpAppl']); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
19 | |||
20 | if (Rrd::checkRrdExists($rrd_filename)) { |
||
21 | $rrd_options .= " COMMENT:'Packet loss\: Cur Avg Min Max\\n' "; |
||
22 | |||
23 | // Calculating percentage |
||
24 | $rrd_options .= ' DEF:ProbeResponses=' . $rrd_filename . ':ProbeResponses:AVERAGE '; |
||
25 | $rrd_options .= ' DEF:ProbeLoss=' . $rrd_filename . ':ProbeLoss:AVERAGE '; |
||
26 | $rrd_options .= ' CDEF:ProbeCount=ProbeResponses,ProbeLoss,+ '; |
||
27 | $rrd_options .= ' CDEF:PercentageLoss=ProbeLoss,UNKN,NE,0,ProbeLoss,IF,ProbeCount,/,100,*,CEIL '; |
||
28 | |||
29 | $rrd_options .= " LINE1:PercentageLoss#CC0000:'PercentageLoss'"; |
||
30 | $rrd_options .= ' GPRINT:PercentageLoss:LAST:%6.1lf%% '; |
||
31 | $rrd_options .= ' GPRINT:PercentageLoss:AVERAGE:%6.1lf%% '; |
||
32 | $rrd_options .= ' GPRINT:PercentageLoss:MIN:%6.1lf%% '; |
||
33 | $rrd_options .= ' GPRINT:PercentageLoss:MAX:%6.1lf%%\\l '; |
||
34 | } |
||
35 |