Hi, simple question: How can I monitor a windows service to see if it’s running or stopped ?
You would need to setup an SNMP Probe using something like the following path for the Oid:
iso . org . dod . internet . private . enterprises . lanmanager . lanmgr-2 . server . svSvcTable . svSvcEntry . svSvcName
You may need a better MIB library for this to work. I’m not sure what The Dude provides since I haven’t actually tried this as of yet.
Hope this helps
Create a new probe. Make it as follows (in this eample I am checking if ‘OUTLOOK.EXE’ is a running process):
Name: name your probe anything you’d like
Available: if(array_find(oid_column(“1.3.6.1.2.1.25.4.2.1.2”),“OUTLOOK.EXE”)>0, 1, -1)
Error: if(array_find(oid_column(“1.3.6.1.2.1.25.4.2.1.2”),“OUTLOOK.EXE”)>0, “”, “OUTLOOK.EXE not detected by SNMP probe”)
Value: 1 (or anything else, is for charting purposes and I return 1 if the service is running)
Unit: running (or whatever you want to call the above values)
Rate: none
Explanation:
The above functions basicly retrieves an array of running processes from the machine and then checks if ‘OUTLOOK.EXE’ is member of this array. (Similar things can be done for services, you’d then just need another oid value. You should be able to find it through a SNMP walk.)
Ok, now you have a probe. Add it to the services of the device you want to monitor, possibly put a notification on it so you get warned when the services goes down, and that’s that! ![]()
Oh yes, backup The Dude first. Creating incorrect probes, functions, etc. can crash The Dude. Never had a crash that actually ‘destroyed’ The Dude here, but you never know…
My above probe works ‘out of the box’… nothing needed. (Ok, you need to run the SNMP Agent on the to-be-monitored machine
)
Besides just seeing if a process is running, is there a way to see what the cpu usage of that particular process is and graph it?
For example, I want to know if a process I am monitoring is the cause for cpu spikes - causing system slowness, etc.
Thanks in advance,
Yes, that should possible with SNMP and some clever use of Dude functions.
It would work something like this: find the array in SNMP that stores the running processes (that’s this one: ‘oid_column(“1.3.6.1.2.1.25.4.2.1.2”)’). Note the index (position) ‘your’ process in the array. Then look for the array that shows CPU usage per process. You’ll find the CPU usage for your process at the same index as determined above.
Okay… I have found the values I need, but I cannot seem to get the output I want. Anyone else ever try what I am trying to get and can show an example?
For example:
winlogon.exe is -
iso.org.dod.internet.mgmt.mib-2.host.hrSWRun.hrSWRunTable.hrSWRunEntry.hrSWRunName.536
or
1.3.6.1.2.1.25.4.2.1.2.536
I think this is the CPU usage section:
iso.org.dod.internet.mgmt.mib-2.host.hrSWRunPerf.hrSWRunPerfTable.hrSWRunPerfEntry.hrSWRunPerfCPU.536
or
1.3.6.1.2.1.25.5.1.1.1.536
Of course, I could be just really hosing this up with incorrect OIDs and what to do with them.
Please note that the location of a certain process in that list will change with every reboot. That’s why you need to get a list of ALL running processes (“1.3.6.1.2.1.25.4.2.1.2”), locate winlogon.exe and note the index and then refer to that same index in the list of all location RunPerfCPU.
Something along the lines of (you’d have to find the appropriate functions and syntax of course):
return_array_value( array(PerfCPU), (locate_index(array(processes), winlogon.exe)) )
Hope this sets you of in the right direction.