How do I check if a OID exists within a function?
I want to do a conditional if a OID exists or does not. I am changing the cpu_usage function to get results from different devices that use different OIDs than the default host one.
For instance, I have a SonicWall, Cisco Router and the default HOST MIB
HOST - iso.org.dod.internet.mgmt.mib-2.host.hrDevice.hrProcessorTable.hrProcessorEntry.hrProcessorLoad"
Cisco - iso.org.dod.internet.private.enterprises.cisco.ciscoMgmt.ciscoProcessMIB.ciscoProcessMIBObjects.cpmCPU.cpmCPUTotalTable.cpmCPUTotalEntry.cpmCPUTotal5min
SonicWall - iso.org.dod.internet.private.enterprises.sonicwall.sonicwallFw.sonicwallFwStatsModule.sonicwallFwStats.sonicCurrentCPUUtil.0
I know that if the SonicWallCPUUtil.0 exists the device is a sonicwall and I want the CPU function to get it instead of one of the others.
I do it currently via
if(cpu_usage_sonicwall() > 0, cpu_usage_sonicwall(),
if(cpu_usage_cisco() > 0, cpu_usage_cisco(),
if(cpu_usage_HOST() > 0, cpu_usage_HOST(),
0
)
)
)
But if the device has very low CPU utilization, averaging out at 0 than the CPU does not display/register that the CPU exists.