Extract keys from field name (not field value)

I have a requirement to retrieve filesystem utilization metrics for Linux servers via SNMP. I am utilizing logstash to do a snmp walk on HOST-RESOURCES-MIB and ingesting in to elastic. Here is how it is reported

**HOST-RESOURCES-MIB::hrStorageType.31** = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
**HOST-RESOURCES-MIB::hrStorageType.35** = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
**HOST-RESOURCES-MIB::hrStorageSize.31** = INTEGER: 499668
**HOST-RESOURCES-MIB::hrStorageSize.35** = INTEGER: 2558871
**HOST-RESOURCES-MIB::hrStorageDescr.31** = STRING: /
**HOST-RESOURCES-MIB::hrStorageDescr.35** = STRING: /dev/shm
**HOST-RESOURCES-MIB::hrStorageUsed.31** = INTEGER: 143316
**HOST-RESOURCES-MIB::hrStorageUsed.35** = INTEGER: 0

I need to dynamically extract the id's 31, 35 so that i can use them with other fields to calculate utilization.

For eg: 31 is id for /. I can get the % utilization for this filesystem by (HOST-RESOURCES-MIB::hrStorageUsed.31/HOST-RESOURCES-MIB::hrStorageSize.3) * 100.

Please help as to how can I dynamically capture these id's from the field and loop through them in a array. Any ruby filter that could help here?

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