(http://docs.librenms.org/Support/FAQ/#faq20).
I need to apply a regex over the processor data (similar to what can be done with “version_regex:”). The device processor data is as shown in the logs below.
I have tried different ways to apply a regex over the output data (last try was “value_regex:”) but none has worked.
SNMPBulkGet Processor data:
‘5 Secs ( 14.9172%) 60 Secs ( 14.8959%) 300 Secs ( 15.4585%)’
the value retrieved by the code is “5”
Is there a way to get the correct values? by now I need the 60 Secs value…
YAML discovery file:
processors:
data:
-
oid: agentSwitchCpuProcessTotalUtilization
value: agentSwitchCpuProcessTotalUtilization
num_oid: '.1.3.6.1.4.1.4413.1.1.1.1.4.9.0'
value_regex: '/([0-9][0-9].[0-9][0-9])/'
Logs:
YAML Discovery Data:
array (
‘data’ =>
array (
0 =>
array (
‘oid’ => ‘agentSwitchCpuProcessTotalUtilization’,
‘value’ => ‘agentSwitchCpuProcessTotalUtilization’,
‘num_oid’ => ‘.1.3.6.1.4.1.4413.1.1.1.1.4.9.0’,
‘value_regex’ => ‘/([0-9][0-9].[0-9][0-9])/’,
),
),
)
Data agentSwitchCpuProcessTotalUtilization:
array (
0 =>
array (
‘agentSwitchCpuProcessTotalUtilization’ => ‘5 Secs ( 14.9172%) 60 Secs ( 14.8959%) 300 Secs ( 15.4585%)’,
),
)
Discovered LibreNMS\Device\Processor Array
(
[processor_id] =>
[entPhysicalIndex] => 0
[hrDeviceIndex] => 0
[device_id] => 25
[processor_oid] => .1.3.6.1.4.1.4413.1.1.1.1.4.9.0
[processor_index] => 0
[processor_type] => datacom-dm1200e
[processor_usage] => 5
[processor_descr] => Processor
[processor_precision] => 1
[processor_perc_warn] => 75
)
SQL[SELECT * FROM processors
WHERE device_id=? AND processor_index=? AND processor_type=? [25,“0”,“datacom-dm1200e”] 0.77ms]