ellem has asked for the wisdom of the Perl Monks concerning the following question:

I need to monitor an application running on a W2K server. The application is Lotus Notes R5. I need some help getting started. Modules, things to consider, etc. Basically when the Notes server crashes I'd like a script to notice this and restart the application.
I have used/written some network monitoring apps but it's just not the same thing.
any help would be appreciated.

(PS I have since fixed R5 so it doesn't crash every Saturday night but a plan B would be nice.)
--
lmoran@wtsgSPAM.com
print "\x{263a}"

Replies are listed 'Best First'.
Re: Monitoring an application
by the_slycer (Chaplain) on Jun 08, 2001 at 22:46 UTC
    There are some Win32 modules that could come in handy for this.

    Win32::Service <- List, start, stop services
    Win32::Eventlog <- Assuming that it writes to the event log

    If all you want to do is restart the service when it crashes, you can do that from within Windows - just set the recovery option on N failure to restart the service. Why bother reinventing a fully functional wheel?

    You may also want to check the ActiveState Mailing Lists for people that have done this sort of thing before. Particularily the perl-win32-admin list.
      Due to *some Microsoft* problem (according to Lotus) R5 won't run as a service (like it does on every other W2K machine in the world) on my mahine. MS ((predictably) says it is a Lotus problem; so glad I pay for tech support.)
      --
      lmoran@wtsgSPAM.com
      print "\x{263a}"
Re: Monitoring an application
by frag (Hermit) on Jun 09, 2001 at 00:45 UTC
    Maybe invoke Lotus Notes on the server with Win32::Process::Create, then wait indefinately for it to end (i.e. via $processobject->Wait(INFINITE)). Then, loop back to reinvoke it IF it appears to have died for a reason where you know you can just start it back up again. I.e., if it's dying for a good reason, like because a crucial file has gotten corrupted, then this sort of solution would bring the server to a screeching halt as it goes through an infinite loop of start-crash-start-crash-start-crash. Maybe only restart it depending on the value of Win32::GetLastError.

    Disclaimer: I know bupkiss about both Lotus Notes, and Win32 servers. You might want to check out Dave Roth's books and web site; he's written some books on using Perl for Win32 Administration.

    -- Frag.

      it took me 5 reads to get what you were saying (b/c I am, despite test scores in the mid 80s, dumb) but now that I have grasped what you are saying this IS BETTER than monitoring it! I will begin on this immediately.

      I own Dave Roth's book on Win32 Perl Sys Admining and I will use it to implement this idea thank you!
      --
      lmoran@wtsgSPAM.com
      print "\x{263a}"
Re: Monitoring an application
by busunsl (Vicar) on Jun 11, 2001 at 10:11 UTC
    Have a look at mon.

    It is a complete monitoring application written in perl.