C# remote watchdog
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 schedule开发者_StackOverflow社区r:
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
Have you seen WMI Tasks: Process? http://msdn.microsoft.com/en-us/library/aa394599%28VS.85%29.aspx
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
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.
精彩评论