http://qs1969.pair.com?node_id=531604

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

All, for a general script which monitor a process status and page when it is down; only page once for an event until event is fixed. As an option, have it check the status again within x minute before sending a page. Does any one have any idea how this can be done? I was thinking of a bolean value (saving it to file/db) which keep track if an alert has been sent or not. Thanks.

Replies are listed 'Best First'.
Re: script to monitor and page...
by gloryhack (Deacon) on Feb 21, 2006 at 04:44 UTC
    I'm very happy with mon. If you try it, go for a more recent "development" version, as the "stable" version is old and the development versions are quite stable.
Re: script to monitor and page...
by McDarren (Abbot) on Feb 21, 2006 at 04:17 UTC
    Which OS are you working on?

    For Win32, you probably want to look at Win32::Process::Info. For *nix, then you could try Proc::ProcessTable.

    Also, there are plenty of off-the-shelf monitoring packages that will do what you want (and a whole lot more). This site lists a whole stack of them. My personal favourites are Big Brother and Nagios. For Win32 systems monitoring, WhatsUp Gold also seems pretty okay.

    Cheers,
    Darren :)

      Yes. I am aware of BigBrother,Nagios, and Proc::ProcessTable. I was hoping to get ideas on how to keep track if an alert has been sent and if it is sent then don't sent it again. Any idea?
        Well it depends on the solution you choose. It is possible to configure Nagios to do this, see here.

        And I'm pretty sure that Big Brother can also be configured to warn/page only once per alert - but again, check the docs.

        If you were just monitoring a single or a few processes and rolling your own simple monitor using Proc::ProcessTable, then it's just a matter of working out exactly what you want, and then defining a few rules. For example, you may set a flag once an alert goes off and a notification is sent, and then only reset the flag after either the alert goes away, or a certain time has elapsed. Writing a script should be the easy part - it's defining the business rules and getting them right that is the tricky bit :)

        Cheers,
        Darren :)

Re: script to monitor and page...
by saintmike (Vicar) on Feb 21, 2006 at 04:07 UTC
    I'm not following, but I guess the answer is nagios.