1 | <?php |
||
2 | /** |
||
3 | * ict-psu.inc.php |
||
4 | * |
||
5 | * LibreNMS voltage sensor discovery module for ICT Digital Series Power Supply |
||
6 | * |
||
7 | * This program is free software: you can redistribute it and/or modify |
||
8 | * it under the terms of the GNU General Public License as published by |
||
9 | * the Free Software Foundation, either version 3 of the License, or |
||
10 | * (at your option) any later version. |
||
11 | * |
||
12 | * This program is distributed in the hope that it will be useful, |
||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the |
||
15 | * GNU General Public License for more details. |
||
16 | * |
||
17 | * You should have received a copy of the GNU General Public License |
||
18 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||
19 | * |
||
20 | * @link https://www.librenms.org |
||
21 | * |
||
22 | * @copyright 2017 Lorenzo Zafra |
||
23 | * @author Lorenzo Zafra<[email protected]> |
||
24 | */ |
||
25 | |||
26 | // Input Voltage |
||
27 | // SNMPv2-SMI::enterprises.39145.11.6.0 = STRING: "120" -- inputVoltage |
||
28 | |||
29 | $inputVoltage = trim(snmp_get($device, 'inputVoltage.0', '-Oqv', 'ICT-DIGITAL-SERIES-MIB'), '" '); |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
30 | if (! empty($inputVoltage)) { |
||
31 | $divisor = 1; |
||
32 | $index = 0; |
||
33 | $oid = '.1.3.6.1.4.1.39145.11.6.0'; |
||
34 | $descr = 'Input Voltage'; |
||
35 | $type = 'ict-psu'; |
||
36 | $currentValue = $inputVoltage / $divisor; |
||
37 | echo "got in\n"; |
||
38 | discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $currentValue); |
||
39 | } |
||
40 | |||
41 | // Output Voltage |
||
42 | // SNMPv2-SMI::enterprises.39145.11.7.0 = STRING: "55.2" -- outputVoltage |
||
43 | |||
44 | $outputVoltage = trim(snmp_get($device, 'outputVoltage.0', '-Oqv', 'ICT-DIGITAL-SERIES-MIB'), '" '); |
||
45 | if (! empty($outputVoltage)) { |
||
46 | $divisor = 1; |
||
47 | $index = 1; |
||
48 | $oid = '.1.3.6.1.4.1.39145.11.7.0'; |
||
49 | $descr = 'Output Voltage'; |
||
50 | $type = 'ict-psu'; |
||
51 | $currentValue = $outputVoltage / $divisor; |
||
52 | |||
53 | discover_sensor($valid['sensor'], 'voltage', $device, $oid, $index, $type, $descr, $divisor, '1', null, null, null, null, $currentValue); |
||
54 | } |
||
55 |