views:

35

answers:

2

I have a problem that probably is not unique, but certainly does not seem to be widely reported.

I need a method to ping a windows service that will tell me if it has stalled out, even if windows is reporting that it is running.

I would prefer to use have a Perl solution but would accept any solution that someone can come up with.

Thanks, Jeremy

+1  A: 

What service are you dealing with? I don't think there is any generic solution to your question if the Services control panel doesn't indicate a problem. In order to detect a running-but-no-longer-functioning-properly process, you have to know what "functioning properly" looks like.

cjm
A: 

You could use the Win32::Service module

use Win32::Service;
GetStatus(hostName, serviceName, status);

From http://search.cpan.org/~jdb/Win32-Service-0.06/Service.pm: Get the status of a service. The third argument must be a hash reference that will be populated with entries corresponding to the SERVICE_STATUS structure of the Win32 API. See the Win32 Platform SDK documentation for details of this structure. You can even grab the service with GetServices(hostName, hashref).

Dean Pearce
yeah, I am already doing all that. Not much good if the service is reporting as started in the admin tools but is actually not doing anything.I think I have a way around this. Websphere pluglet that is running returns a string when you hit it with an HTTP request so I can just check against that to see if it is actually running.
Jeremy Petzold