monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: alerting when service is down and then up again?


From: Martin Pala
Subject: Re: alerting when service is down and then up again?
Date: Mon, 16 Aug 2010 16:56:56 +0200

The next monit version will allow to customize the service non-existence condition. Changelog excerpt:

--8<--
* Allow to override default action when service doesn't exist (for example process
  is not running, file doesn't exist). Default action is service restart, it can be
  customized with following statement now:
      if [does] not exist [[<x> times within] <y> cycles] then <action1>
     [else if succeeded   [[<x> times within] <y> cycles] then <action2>]
  For example instead of default restart action:
      check file with path /cifs/mydata
        if does not exist for 5 cycles then exec "/usr/bin/mount_cifs.sh"
--8<--


On Aug 16, 2010, at 3:43 PM, Josh Sharpe wrote:

I don't think you read my question.  I want to trigger an exec statement when services go up/down - Can I do that?

The alert action is implicit - just add the alert statement ahead of check definition (global):

    set alert address@hidden

When the service will go down or up, you will receive alerts. There is no need to add explicit alert action to start program.

Regards,
Martin



On Aug 16, 2010, at 3:40 AM, Josh Sharpe wrote:

I set this monitor up:

check process order_approval with pidfile /rails/veloracing/current/tmp/pids/order_approval.pid
  start program = "start_order_approval"

I can't figure out how to alert when monit discovers that service is down and then alert me when the service is back up...

I guess I could alter this to be:

start program = "alert_that_service_is_down && start_order_approval && alert_that_service_is_up"

...but that's kinda hackey, and will send erroneous alerts if I trigger it through the webservice.

Basically, I need to trigger a script (not monit's 'alert' mechanism) when monit discovers the service is down, and a different script when monit recognizes that the service is running again.

Thanks!
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general


reply via email to

[Prev in Thread] Current Thread [Next in Thread]