Pulling temperature value out of string

I have some QNAP “ES” nas devices. When I point LibreNMS at them, there are no sensor or state information. This type of NAS doesn’t respond to the standard NAS-MIB definitions. I am creating my own custom definition for this operating system using the vendor provided MIB. So far I’ve been able to add lots of temperature and fanspeed sensors, as well as states for disk status, disk smart info, pool status and shared folder status… pretty much everything I want…

One item I am having difficulty with is the disk temperatures. The OID that vendor provides returns a DisplayString and not an integer.

The temperature string looks like this: 21 C/69.8 F

All of the disk temperatures show up as -17.78 C in the web UI

This is what I have in my discovery definition yaml to collect the temperatures:

                    oid: es-DiskTable
                    value: es-DiskTemperature
                    num_oid: '.1.3.6.1.4.1.24681.1.4.1.1.1.1.5.2.1.6.{{ $index }}'
                    descr: 'Disk {{ $es-DiskID }} ({{ $es-DiskModel }})'
                    index: 'es-DiskTemperture.{{ $index }}'
                    group: 'Disks'

Is there a method to perform regex on the sensor value to pull out the correct number?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.