Skip to main content

hello

I got an appliance (fortinet analyzer) that has a snmp capability, it works fine for basic system info like cpu, nic and storage, but for the memory it uses the same mib as the storage and it is filtered 

 

here is an extract of the snmpwalk, the ram and swap are in the hrStorage* tables along with the hard drives

HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 8161580 KBytes
HOST-RESOURCES-MIB::hrStorageIndex.1 = INTEGER: 1
HOST-RESOURCES-MIB::hrStorageIndex.2 = INTEGER: 2
HOST-RESOURCES-MIB::hrStorageIndex.3 = INTEGER: 3
HOST-RESOURCES-MIB::hrStorageIndex.4 = INTEGER: 4
HOST-RESOURCES-MIB::hrStorageType.1 = OID: HOST-RESOURCES-TYPES::hrStorageRam
HOST-RESOURCES-MIB::hrStorageType.2 = OID: HOST-RESOURCES-TYPES::hrStorageVirtualMemory
HOST-RESOURCES-MIB::hrStorageType.3 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageType.4 = OID: HOST-RESOURCES-TYPES::hrStorageFixedDisk
HOST-RESOURCES-MIB::hrStorageDescr.1 = STRING: Physical Memory
HOST-RESOURCES-MIB::hrStorageDescr.2 = STRING: Swap Memory
HOST-RESOURCES-MIB::hrStorageDescr.3 = STRING: Compact Flash Disk
HOST-RESOURCES-MIB::hrStorageDescr.4 = STRING: Internal Hard Disk
HOST-RESOURCES-MIB::hrStorageAllocationUnits.1 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.2 = INTEGER: 1024 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.3 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageAllocationUnits.4 = INTEGER: 4096 Bytes
HOST-RESOURCES-MIB::hrStorageSize.1 = INTEGER: 8161580
HOST-RESOURCES-MIB::hrStorageSize.2 = INTEGER: 49649656
HOST-RESOURCES-MIB::hrStorageSize.3 = INTEGER: 251563
HOST-RESOURCES-MIB::hrStorageSize.4 = INTEGER: 1056610944
HOST-RESOURCES-MIB::hrStorageUsed.1 = INTEGER: 4991272
HOST-RESOURCES-MIB::hrStorageUsed.2 = INTEGER: 13934876
HOST-RESOURCES-MIB::hrStorageUsed.3 = INTEGER: 129309
HOST-RESOURCES-MIB::hrStorageUsed.4 = INTEGER: 406384294

I managed to get the memory and swap by using the snmp storage check and using 

--filter-storage-type=’hrStorageRam’ and hrStorageVirtualMemory, however the output contains “OK: Storage”

is there a way to change “storage” to “memory” or “swap”

 

here is the option of the command

--mode=storage  --storage='^Physical Memory$' --name --regexp --display-transform-src='' --display-transform-dst='' --warning-usage='90' --critical-usage='90' --verbose --filter-perfdata='storage.space|used|free' --filter-storage-type='hrStorageRam'

 

(I can’t remember if the filter-perfdata here is from the linux template or a tweak I did a lonnnng time ago), but is there a tranformation I could to change “storage” in the output

 

or maybe a way to use the hrStorage table to get the ram without using the storage check command? 

 

Thanks in advance

Hello :)

To replace ‘Storage’ with ‘Memory’ in the output, you can use this option, which should meet your needs: 

=item B<--change-short-output> B<--change-long-output>

Modify the short/long output that is returned by the plugin.
Syntax: --change-short-output=pattern~replacement~modifier
Most commonly used modifiers are i (case insensitive) and g (replace all occurrences).
Example: adding --change-short-output='OK~Up~gi' will replace all occurrences of 'OK', 'ok', 'Ok' or 'oK' with 'Up'

Hope, this can help you :)


ah damn, I was playing with display-transform, I forgot about change output, yes it’s working fine

 

 


Reply