Monitor several instances of a process
Sometimes a process creates multiple instances of itself. A good example of such a process is the svchost.exe. If the process creates multiple instances of itself and you need to monitor that at least a specific number of these instances run then you can use below script.
Below example uses the svchost.exe as an example but if once need to monitor the instances of another process name then just change the name in the script. You simple just add below script in custom.conf. sample file in the SysOrb agent folder. Then rescan the agent in the sysorb webinterface and the new check will be available in SysOrb.
[process_svchost_count] command=cmd /c tasklist /FI "IMAGENAME eq svchost.exe" | find /c "svchost.exe" type=integer result_pattern=([[:digit:]]+) timeout=120
If you want to monitor that there should be at least 5 instances of the process running then you just configure this threshold in SysOrb.
Here is an example of this custom check in our SysOrb demo.