4

We have a number of services (mostly console applications) running across several remote computers.

I need to implement some form of a watchdog to make sure all these services are running as expected.

Some services are executed via Windows Task Scheduler, and some are long-running apps.

What would be the best way of logging that those applications are run? I don't want to modify my running services.

I have administrator access to all machines.

A few options comes to mind:

For the long running applications: Use psexec and retrieve a list of running processes and make sure my application is in that list.

For tasks invoked by task scheduler: Use psexec and query schtasks and find out when my services was run and what the return code was.

Do you have any other ideas of doing this?

For the record, this will be implemented in C#/WPF.

EDIT:

Ok, I solved this in a pretty straight forward way. Thanks for your input.

Source: http://pastebin.com/fr6dDMp5

alexn
  • 57,867
  • 14
  • 111
  • 145

3 Answers3

1

Have you seen WMI Tasks: Process? http://msdn.microsoft.com/en-us/library/aa394599%28VS.85%29.aspx

shaans
  • 534
  • 2
  • 5
  • Yes, i've thought about using WMI. That would also enable me to fetch scheduled tasks (if i understand MSDN correctly). – alexn Nov 11 '10 at 08:22
1

As I stated in my question, i solved this in a pretty straight forward way using Process.GetProcesses(string machineName) which can get processes on a remote machine. Source here: http://pastebin.com/fr6dDMp5

alexn
  • 57,867
  • 14
  • 111
  • 145
0

Have you considered to use XYNT Service ( http://www.codeproject.com/KB/system/xyntservice.aspx )?

It can run your console applications as a windows service and resetart them, if they stop. You don't have to modify your existing services.

Dennis
  • 2,132
  • 3
  • 21
  • 28