Issues (2963)

includes/polling/os/ibmnos.inc.php (1 issue)

1
<?php
2
/*
3
 * LibreNMS IBM NOS information module
4
 *
5
 * Copyright (c) 2015 Søren Friis Rosiak <[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
$sysdescr_value = $device['sysDescr'];
13
if (strpos($sysdescr_value, 'IBM Networking Operating System') !== false) {
14
    $hardware = str_replace('IBM Networking Operating System', '', $sysdescr_value);
15
    if (strpos($sysdescr_value, 'G8052') !== false) {
16
        $version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" ');
0 ignored issues
show
It seems like snmp_get($device, '.1.3.....1.1.1.1.10.1', '-Ovq') 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

16
        $version = trim(/** @scrutinizer ignore-type */ snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" ');
Loading history...
17
        $serial = trim(snmp_get($device, '.1.3.6.1.4.1.26543.100.100.14.9.0', '-Ovq'), '" ');
18
    }
19
20
    if (strpos($sysdescr_value, 'G8316') !== false) {
21
        $version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" ');
22
        $serial = trim(snmp_get($device, '.1.3.6.1.4.1.20301.100.100.14.9.0', '-Ovq'), '" ');
23
    }
24
25
    if (strpos($sysdescr_value, 'G8264CS') !== false) {
26
        $version = trim(snmp_get($device, '.1.3.6.1.4.1.20301.2.7.15.1.1.1.10.0', '-Ovq'), '" ');
27
        $serial = trim(snmp_get($device, '.1.3.6.1.4.1.20301.100.100.14.9.0', '-Ovq'), '" ');
28
    }
29
30
    if (strpos($sysdescr_value, 'G8264-T') !== false) {
31
        $version = trim(snmp_get($device, '.1.3.6.1.4.1.20301.2.7.13.1.1.1.10.0', '-Ovq'), '" ');
32
        $serial = trim(snmp_get($device, '.1.3.6.1.4.1.20301.100.100.14.9.0', '-Ovq'), '" ');
33
    }
34
35
    if (empty($version)) {
36
        $version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" ');
37
    }
38
39
    if (empty($serial)) {
40
        $serial = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.11.1', '-Ovq'), '" ');
41
    }
42
} elseif (strpos($sysdescr_value, 'IBM Flex System Fabric') !== false) {
43
    $hardware = str_replace('IBM Flex System Fabric', '', $sysdescr_value);
44
    $version = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.10.1', '-Ovq'), '" ');
45
    $serial = trim(snmp_get($device, '.1.3.6.1.2.1.47.1.1.1.1.11.1', '-Ovq'), '" ');
46
} elseif (strpos($sysdescr_value, 'IBM Networking OS 1/10Gb Uplink Ethernet Switch Module') !== false) {
47
    $hardware = 'IBM BladeCenter 1/10Gb Uplink Ethernet Switch Module';
48
}//end if
49