Checks if the types of the passed arguments in a function/method call are compatible.
1 | <?php |
||
2 | /* |
||
3 | * LibreNMS module to display F5 LTM Bandwidth Controller Details |
||
4 | * |
||
5 | * Copyright (c) 2019 Yacine BENAMSILI <https://github.com/yac01/ [email protected]> |
||
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 | $component = new LibreNMS\Component(); |
||
15 | $options = []; |
||
16 | $options['filter']['type'] = ['=', 'f5-ltm-bwc']; |
||
17 | $components = $component->getComponents($device['device_id'], $options); |
||
18 | |||
19 | // We only care about our device id. |
||
20 | $components = $components[$device['device_id']]; |
||
21 | |||
22 | include 'includes/html/graphs/common.inc.php'; |
||
23 | $rrd_options .= ' -l 0 -E '; |
||
24 | $rrd_options .= " COMMENT:'LTM Bandwidth Controller Now Avg Max\\n'"; |
||
25 | $colours = array_merge(\LibreNMS\Config::get('graph_colours.mixed'), \LibreNMS\Config::get('graph_colours.manycolours')); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
26 | $colcount = 0; |
||
27 | $count = 0; |
||
28 | |||
29 | // add all LTM VS on this device. |
||
30 | foreach ($components as $compid => $comp) { |
||
31 | $label = $comp['label']; |
||
32 | $hash = $comp['hash']; |
||
33 | $rrd_filename = Rrd::name($device['hostname'], [$comp['type'], $label, $hash]); |
||
34 | if (Rrd::checkRrdExists($rrd_filename)) { |
||
35 | // Grab a colour from the array. |
||
36 | if (isset($colours[$colcount])) { |
||
37 | $colour = $colours[$colcount]; |
||
38 | } else { |
||
39 | $colcount = 0; |
||
40 | $colour = $colours[$colcount]; |
||
41 | } |
||
42 | |||
43 | $rrd_options .= ' DEF:DS' . $count . '=' . $rrd_filename . ':bytesdropped:AVERAGE '; |
||
44 | $rrd_options .= ' CDEF:MOD' . $count . '=DS' . $count . ',8,* '; |
||
45 | $rrd_options .= ' LINE1.25:MOD' . $count . '#' . $colour . ":'" . str_pad(substr($label, 0, 60), 60) . "'"; |
||
46 | $rrd_options .= ' GPRINT:MOD' . $count . ':LAST:%6.2lf%s '; |
||
47 | $rrd_options .= ' GPRINT:MOD' . $count . ':AVERAGE:%6.2lf%s '; |
||
48 | $rrd_options .= ' GPRINT:MOD' . $count . ":MAX:%6.2lf%s\l "; |
||
49 | $count++; |
||
50 | $colcount++; |
||
51 | } |
||
52 | } |
||
53 |