Hello,
Thanks in advance for the great project and taking the time to read this post.
I’m trying to add temperature sensor data to our FortiGate devices (also other environment data, but let’s keep the scope limited to temperature).
Depending on the model of FortiGate, there are different sensors in each hardware type, so FortiNet has put the sensor data in a table.
When discovery iterates over that table I get the correct values for the sensors.
Though, when it’s time for polling, it tries to read a different OID,which isn’t available, thus returning “0”.
I’m trying to figure out what’s wrong with my code so I can fix it an return the improvement with a PR back into LibreNMS.
The file I’m adding the code to is: includes/definitions/discovery/fortigate.yml
.
The code I’m adding is the temperature
block at the bottom of the file. The rest of the file is unchanged.
mib: FORTINET-FORTIGATE-MIB
modules:
mempools:
data:
-
...
...
sensors:
pre-cache:
data:
-
oid:
- fgVpnTunEntPhase1Name
- fgVpnTunEntPhase2Name
- fgVpnTunEntRemGwyIp
- fgVdEntName
...
temperature:
data:
-
oid: fgHwSensors
num_oid: '.1.3.6.1.4.1.12356.101.4.3.2.1.{{ $index }}'
index: 'fgHwSensorEntIndex.{{ $index }}'
descr: fgHwSensorEntName
value: fgHwSensorEntValue
skip_values:
- oid: fgHwSensorEntName
op: 'regex'
value: '/^((?!Temp).)*$/'
- oid: fgHwSensorEntValue
op: '='
value: -1
When running a discovery, the correct values are discovered and (temporarily, until polling) visible in the GUI.
Below is Discovery CLI output:
...
Temperature: Cur 23, Low: null, Low Warn: null, Warn: null, High: null
+Cur 24, Low: null, Low Warn: null, Warn: null, High: null
+
Tv_signal:
...
Percent:
>> Runtime for discovery module 'sensors': 6.4010 seconds with 175568 bytes
>> SNMP: [17/1.00s] MySQL: [2703/50.48s] RRD: [0/0.00s]
#### Unload disco module sensors ####
This is the Discovery GUI output:
https://p.libren.ms/view/e3028762
While running Poller Capture, this is the output:
SQL[SELECT * FROM `sensors` WHERE `sensor_class` = ? AND `device_id` = ? ["temperature",5] 0.75ms]
SNMP['/usr/bin/snmpget' '-v2c' '-c' 'COMMUNITY' '-OUQntea' '-M' '/opt/librenms/mibs:/opt/librenms/mibs/fortinet' '-t' '5' 'udp:HOSTNAME:161' '.1.3.6.1.4.1.12356.101.4.3.2.1.33' '.1.3.6.1.4.1.12356.101.4.3.2.1.34']
.*.4.1.123*.2.1.33 = No Such Object available on this agent at this OID
.*.4.1.123*.2.1.34 = No Such Object available on this agent at this OID
Checking (snmp) temperature PS1 Temp 1...
Checking (snmp) temperature PS1 Temp 2...
0 C
0 C
>> Runtime for poller module 'sensors': 0.8358 seconds with 22784 bytes
>> SNMP: [46/0.79s] MySQL: [29/0.34s]
#### Unload poller module sensors ####
Note that it is trying to get invalid OID’s.
It is trying to fetch .*.4.1.123*.2.1.33 while it should have been trying to fetch .*.4.1.123*.2.1.1.33
I’ve verified with a manual snmpget that the correct value is availabe at the OID with the extra “.1”
Am I making an obvious mistake here?
Any help is much appreciated!
Thanks.