1 | <?php |
||
2 | |||
3 | // We're discovering this MIB |
||
4 | // snmpwalk -v2c -c <community> <hostname> -M mibs/junose/ -m Juniper-UNI-ATM-MIB juniAtmVpStatsEntry |
||
5 | // JunOSe ATM vps |
||
6 | use LibreNMS\Config; |
||
7 | |||
8 | if ($device['os'] == 'junose' && Config::get('enable_ports_junoseatmvp')) { |
||
9 | $vp_array = snmpwalk_cache_multi_oid($device, 'juniAtmVpStatsInCells', $vp_array, 'Juniper-UNI-ATM-MIB', 'junose'); |
||
10 | $valid_vp = []; |
||
11 | d_echo($vp_array); |
||
12 | |||
13 | if (is_array($vp_array)) { |
||
14 | foreach ($vp_array as $index => $entry) { |
||
15 | [$ifIndex,$vp_id] = explode('.', $index); |
||
16 | |||
17 | $port_id = dbFetchCell('SELECT `port_id` FROM `ports` WHERE `device_id` = ? AND `ifIndex` = ?', [$device['device_id'], $ifIndex]); |
||
18 | |||
19 | if (is_numeric($port_id) && is_numeric($vp_id)) { |
||
20 | discover_juniAtmvp($valid_vp, $port_id, $vp_id, null); |
||
0 ignored issues
–
show
|
|||
21 | } |
||
22 | } //end foreach |
||
23 | } //end if |
||
24 | |||
25 | unset($vp_array); |
||
26 | |||
27 | // Remove ATM vps which weren't redetected here |
||
28 | $sql = "SELECT * FROM `ports` AS P, `juniAtmVp` AS J WHERE P.`device_id` = '" . $device['device_id'] . "' AND J.port_id = P.port_id"; |
||
29 | |||
30 | d_echo($valid_vp); |
||
31 | |||
32 | foreach (dbFetchRows($sql) as $test) { |
||
33 | $port_id = $test['port_id']; |
||
34 | $vp_id = $test['vp_id']; |
||
35 | d_echo($port_id . ' -> ' . $vp_id . "\n"); |
||
36 | |||
37 | if (! $valid_vp[$port_id][$vp_id]) { |
||
38 | echo '-'; |
||
39 | dbDelete('juniAtmvp', '`juniAtmVp` = ?', [$test['juniAtmvp']]); |
||
40 | } |
||
41 | |||
42 | unset($port_id); |
||
43 | unset($vp_id); |
||
44 | } |
||
45 | |||
46 | unset($valid_vp); |
||
47 | echo "\n"; |
||
48 | }//end if |
||
49 |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.