monit-general
[Top][All Lists]
Advanced

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

Re: noalert for specific if statement in service check


From: Martin Pala
Subject: Re: noalert for specific if statement in service check
Date: Thu, 29 Nov 2012 16:53:56 +0100

The exec action is executed any time the rule matches - if you need to execute it only once, you can handle it in the script. 

Regards,
Martin


On Nov 28, 2012, at 2:05 AM, Britt Treece <address@hidden> wrote:

I wish it was capable of alerting separately for each test, but I think these are both acceptable alternatives.

Is there a simple way to make it exec for a true test just once rather than every time it tests true?


On Tue, Nov 27, 2012 at 2:43 PM, Martin Pala <address@hidden> wrote:
Yes, the "noalert" cannot be used in the test context - it is valid for the whole check. You can filter out specific event types by type (using "not on { events_list }") but not based on specific value. In your case you can use the exec action which can be used to send alerts on per-test level:

--8<--
check filesystem data with path /dev/sdb
    if space usage > 90% for 5 times within 15 cycles then exec "/usr/bin/mail -s filesystem_data_full address@hidden"
    if space usage > 95% then exec "/usr/bin/mail -s filesystem_data_full address@hidden address@hidden"
--8<--

or create custom script where you can use MONIT_* environment variables to read the event context and process it accordingly (send alerts, etc.)

Regards,
Martin


On Nov 26, 2012, at 10:17 PM, Britt Treece <address@hidden> wrote:

> I have two set alert emails in the global section of my config
>
> set alert address@hidden
> set alert address@hidden
>
> I would like usera to get all alerts and userb to only get some alerts.  Specifically I would like userb to only get alerts for filesystem space usage if it's over 95%. I tried the following configuration for the filesystem check but the noalert statement appears to function only for the check not for a specific if test
>
>   check filesystem data with path /dev/sdb
>     if space usage > 90% for 5 times within 15 cycles then alert
>       noalert address@hidden
>     if space usage > 95% then alert
>
> Is there a correct way to configure this?  I am using monit 5.4.1.
>
> Thanks,
>
> Britt Treece
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


reply via email to

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