librenms /
librenms
| 1 | <?php |
||||
| 2 | |||||
| 3 | /** |
||||
| 4 | * LibreNMS |
||||
| 5 | * |
||||
| 6 | * This file is part of LibreNMS. |
||||
| 7 | * |
||||
| 8 | * @copyright (C) 2006 - 2012 Adam Armstrong |
||||
| 9 | */ |
||||
| 10 | $init_modules = ['web', 'auth']; |
||||
| 11 | require realpath(__DIR__ . '/..') . '/includes/init.php'; |
||||
| 12 | |||||
| 13 | if (is_numeric($_GET['id']) && (\LibreNMS\Config::get('allow_unauth_graphs') || port_permitted($_GET['id']))) { |
||||
| 14 | $port = cleanPort(get_port_by_id($_GET['id'])); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 15 | $device = device_by_id_cache($port['device_id']); |
||||
| 16 | $title = generate_device_link($device); |
||||
| 17 | $title .= ' :: Port ' . generate_port_link($port); |
||||
|
0 ignored issues
–
show
Are you sure
generate_port_link($port) of type array|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 18 | $auth = true; |
||||
| 19 | |||||
| 20 | $in = snmp_get($device, 'ifHCInOctets.' . $port['ifIndex'], '-OUqnv', 'IF-MIB'); |
||||
| 21 | if (empty($in)) { |
||||
| 22 | $in = snmp_get($device, 'ifInOctets.' . $port['ifIndex'], '-OUqnv', 'IF-MIB'); |
||||
| 23 | } |
||||
| 24 | |||||
| 25 | $out = snmp_get($device, 'ifHCOutOctets.' . $port['ifIndex'], '-OUqnv', 'IF-MIB'); |
||||
| 26 | if (empty($out)) { |
||||
| 27 | $out = snmp_get($device, 'ifOutOctets.' . $port['ifIndex'], '-OUqnv', 'IF-MIB'); |
||||
| 28 | } |
||||
| 29 | |||||
| 30 | $time = microtime(true); |
||||
| 31 | |||||
| 32 | printf("%lf|%s|%s\n", $time, $in, $out); |
||||
|
0 ignored issues
–
show
It seems like
$in can also be of type false; however, parameter $values of printf() does only seem to accept double|integer|string, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 33 | } |
||||
| 34 |