Issues (2963)

discovery/sensors/fanspeed/ibm-amm.inc.php (1 issue)

1
<?php
2
/*
3
 * LibreNMS
4
 *
5
 * Copyright (c) 2016 Neil Lathwood <[email protected]>
6
 * This program is free software: you can redistribute it and/or modify it
7
 * under the terms of the GNU General Public License as published by the
8
 * Free Software Foundation, either version 3 of the License, or (at your
9
 * option) any later version.  Please see LICENSE.txt at the top level of
10
 * the source code distribution for details.
11
 */
12
13
$descr_prefix = 'Blower ';
14
$oids = [
15
    '.1.3.6.1.4.1.2.3.51.2.2.3.20.0', // BLADE-MIB:blower1speedRPM
16
    '.1.3.6.1.4.1.2.3.51.2.2.3.21.0', // BLADE-MIB:blower2speedRPM
17
    '.1.3.6.1.4.1.2.3.51.2.2.3.22.0', // BLADE-MIB:blower3speedRPM
18
    '.1.3.6.1.4.1.2.3.51.2.2.3.23.0', // BLADE-MIB:blower4speedRPM
19
];
20
21
echo 'BLADE-MIB ';
22
foreach ($oids as $index => $oid) {
23
    $value = trim(snmp_get($device, $oid, '-Oqv'), '"');
0 ignored issues
show
It seems like snmp_get($device, $oid, '-Oqv') can also be of type false; however, parameter $string of trim() does only seem to accept 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 ignore-type  annotation

23
    $value = trim(/** @scrutinizer ignore-type */ snmp_get($device, $oid, '-Oqv'), '"');
Loading history...
24
25
    if (is_numeric($value)) {
26
        $descr = $descr_prefix . ($index + 1);
27
        discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'snmp', $descr, 1, 1, null, null, null, null, $value);
28
    }
29
}
30