We monitor processes via SNMP using a two line powershell script which does a snmpwalk of the current running processes on the target machines host_resource mib, returning a 0 or 1, depending it it finds the process or not. This simple script works for both Unix and Windows successfully however we have hit two problems.
The first, is that it cannot differentiate multiple processes by the same name.
The second problem is that the overhead of using powershell for these 20 external process monitors can be greater than ipmonitor itself which has over 3000 active standard monitors. I think this is because powershell is using CPU to actively check if the snmpwalk has come back yet, which can take a second or two.
Below is the simple but effective generic script which we pass the target server, community string and process name as parameters. It runs on the IPMONITOR host machine, requiring nothing installed on the target servers.
if (invoke-expression "d:\net-snmp\usr\bin\snmpwalk -v 1 -c $($args[0]) $($args[1]) 1.3.6.1.2.1.25.4.2.1.2" | select-string "$($args[2])") { Write-Host "FOUND"; exit 1 } else { Write-Host "NOT FOUND";exit 0 }
Does anyone have a better/faster/more effecive/alternate way of being able to solve or improve either of these issues?
Does anyone know if process monitoring, including monitoring multiple processes of the same name, will be added as a monitor type at any point in IPMONITOR's future?
Paul