Ruby script process monitoring on windows -
i want monitor ruby script process remotely on windows. know how on unix based system, god or similar monitoring framework, issue want have windows.
basically, want couple of things:
- monitor whether script running
- if script stops, should restarted
- send status of script remote server (this not important, can write option myself)
maybe can suggest it.
please note prefer have monitoring solution written in ruby, expand further.
i found on forum www.ruby-forum.com , adapted bit you can see if process (script) still runs. restarting , reporting can handle presume ?
require 'win32ole' procs = win32ole.connect("winmgmts:\\\\.") procs.instancesof("win32_process").each |p| puts p.commandline if p.name == 'ruby.exe' end
here available attributes
class win32_process : cim_process { string caption; string commandline; string creationclassname; datetime creationdate; string cscreationclassname; string csname; string description; string executablepath; uint16 executionstate; string handle; uint32 handlecount; datetime installdate; uint64 kernelmodetime; uint32 maximumworkingsetsize; uint32 minimumworkingsetsize; string name; string oscreationclassname; string osname; uint64 otheroperationcount; uint64 othertransfercount; uint32 pagefaults; uint32 pagefileusage; uint32 parentprocessid; uint32 peakpagefileusage; uint64 peakvirtualsize; uint32 peakworkingsetsize; uint32 priority; uint64 privatepagecount; uint32 processid; uint32 quotanonpagedpoolusage; uint32 quotapagedpoolusage; uint32 quotapeaknonpagedpoolusage; uint32 quotapeakpagedpoolusage; uint64 readoperationcount; uint64 readtransfercount; uint32 sessionid; string status; datetime terminationdate; uint32 threadcount; uint64 usermodetime; uint64 virtualsize; string windowsversion; uint64 workingsetsize; uint64 writeoperationcount; uint64 writetransfercount; };
Comments
Post a Comment