monit-general
[Top][All Lists]
Advanced

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

Re: [monit] Monit to take action if outage is still there on its n'th in


From: Martin Pala
Subject: Re: [monit] Monit to take action if outage is still there on its n'th instance eg 4th
Date: Thu, 02 Jul 2009 21:19:10 +0200
User-agent: Thunderbird 2.0.0.22 (X11/20090608)

I have tested it (with monit-5.0.3), it works:


unicorn:~/svn/monit$ sudo ./monit -vIc /etc/monitrc
Runtime constants:
 Control file       = /etc/monitrc
 Log file           = syslog
 Pid file           = /var/run/monit.pid
 Debug              = True
 Log                = True
 Use syslog         = True
 Is Daemon          = True
 Use process engine = True
 Poll time          = 5 seconds with start delay 0 seconds
 Expect buffer      = 256 bytes
 Mail server(s)     = 127.0.0.1:25 with timeout 5 seconds
 Mail from          = address@hidden
 Mail subject       = monit alert --  $EVENT $SERVICE
 Mail message       = $EVENT Service $SERV..(truncated)
 Start monit httpd  = False
 Alert mail to      = address@hidden
   Alert on         = All events

The service list contains the following entries:

Remote Host Name      = myhost
 Monitoring mode      = active
ICMP = if failed Echo Request count 3 with timeout 5 seconds 4 times within 4 cycle(s) then exec '/bin/true' timeout 0 cycle(s) else if succeeded 1 times within 1 cycle(s) then alert ICMP = if failed Echo Request count 3 with timeout 5 seconds 1 times within 1 cycle(s) then alert else if succeeded 1 times within 1 cycle(s) then alert

System Name           = unicorn
 Monitoring mode      = active

-------------------------------------------------------------------------------
monit: pidfile '/var/run/monit.pid' does not exist
Starting monit daemon
'unicorn' Monit started
Monit instance changed notification is sent to address@hidden

[1st cycle]
'myhost' icmp ping failed
'myhost' failed ICMP test [Echo Request]
'myhost' icmp ping failed
'myhost' failed ICMP test [Echo Request]
ICMP failed notification is sent to address@hidden
'myhost' icmp ping failed, skipping any port connection tests

[2nd cycle]
'myhost' icmp ping failed
'myhost' failed ICMP test [Echo Request]
'myhost' icmp ping failed
'myhost' failed ICMP test [Echo Request]
'myhost' icmp ping failed, skipping any port connection tests

[3rd cycle]
'myhost' icmp ping failed
'myhost' failed ICMP test [Echo Request]
'myhost' icmp ping failed
'myhost' failed ICMP test [Echo Request]
'myhost' icmp ping failed, skipping any port connection tests

[4th cycle]
'myhost' icmp ping failed
'myhost' failed ICMP test [Echo Request]
ICMP failed notification is sent to address@hidden
'myhost' exec: /bin/true
'myhost' icmp ping failed, skipping any port connection tests



=> alert was sent on first cycle and program (and another alert) executed on 4th cycle


The test configuration is as follows:

--8<--
set daemon 5
set logfile syslog facility log_daemon
set mailserver 127.0.0.1
set mail-format {from: address@hidden
set alert address@hidden

check host myhost with address 10.1.2.3
   if failed icmp type echo then alert
   if failed icmp type echo for 4 cycles then exec "/bin/true"
--8<--


Can you run monit with -vI options and check output?


Thanks,
Martin


George wrote:
Hello I tried this

check host myhost with address 10.1.2.3
if failed icmp type echo then alert if failed icmp type echo for 4 cycles then exec "/srv/crons/monit/monit_scripts/testSMS.php"

But it kept alerting and not once did it send the sms on the fourth try, what do i cahnge above?

Thanks
George


On Wed, 2009-07-01 at 22:26 +0200, Martin Pala wrote:
Hi,

you can add second test for the same service which will trigger the action, for example something like this:

check host myhost with address 10.1.2.3
   if failed icmp type echo then ...
   if failed icmp type echo for 4 cycles then ...


Martin



George wrote:
> Hi there,
> > I have been using monit to monitor my network, whenever there is a > network outage i have configured it to send sms alerts for action. > However the network has really grown and as thus I sometimes get excess > alerts. Sometimes the links failures passes the third or fourth test. > > What I wanted to know is if there is a way I can set monit to send > alerts if the link outage is still there in for instance the fourth run. > I run monit as a daemon with interval of about 300 secs. > In this case I would expect monit to take the defined action if the > outage is still there in its fourth instance. > > Warm regards
> George
> > > ------------------------------------------------------------------------ > > --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general


--
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]