Monit and laptops

Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Monit and laptops

David Blank-Edelman-2
Hi-

Have loved Monit for many years. This is the first time I’ve considered using it on a laptop so I thought I would write to see if there is anything I should be wary of.

Here’s the situation: I have a laptop that will randomly just start losing 70%+ of packets. If I cycle the interface (ifconfig en0 down then up) it always resets and is fine for another random while. Have been trying to debug this for months, but just decided in the meantime I should find a way to automate this cycle the network in a packet loss situation “fix”.

It seems like Monit would do just fine with a config that said “ping this address and if you have N failures in time T (or cycles), cycle the interface”. My only concern is how it might handle situations when the laptop sleeps or partially sleeps (or wakes up and doesn’t have wifi for a bit). I don’t think I’d want it to be flapping things in those cases.

Should I worry about this?  Is there perhaps a clever way to say “only go into corrective mode after N number of successful pings have occurred” as a way to make sure it is only taking action when the laptop is actually in use? Any other concerns?

Thanks!

     — dNb
Reply | Threaded
Open this post in threaded view
|

Re: Monit and laptops

Lutz Mader
Hello David,
I use monit on a Macbook, this works well.

> It seems like Monit would do just fine with a config that said “ping this address and if you have N failures in time T (or cycles), cycle the interface”. My only concern is how it might handle situations when the laptop sleeps or partially sleeps (or wakes up and doesn’t have wifi for a bit). I don’t think I’d want it to be flapping things in those cases.

But you are right, a wake-up or a switch to a other wlan is a problem.

I configure monitrc to use the Macbook hostname to bind to.

use address macbook.local

And monit monitor themselves, to bind to an interface after the wake-up.

check host Monit with address macbookpro.local
  start program "/usr/local/bin/monit reload"
  if failed port 2812 with protocol https username "guest" password "guest"
     and request "/_ping" with status >= 200
     with ssl options {verify: disable, selfsigned: allow}
     with timeout 30 seconds for 3 cycles then start
#  if failed port 2812 with timeout 30 seconds for 3 cycles then start
#     else if recovered then alert
  if 3 restarts within 10 cycles then unmonitor

With regards,
Lutz

Reply | Threaded
Open this post in threaded view
|

RE: Monit and laptops

Tomich,John
If you just stop the artifact, won't a process reboot activate it again?  Safer to uninstall, or at least untarget.




If you are not the intended recipient of this message (including attachments) or if you have received this message in error, immediately notify us and delete it and any attachments.

If you do not wish to receive any email messages from Edward Jones, excluding administrative communications, please email this request to [hidden email] from the email address you wish to unsubscribe.

For important additional information related to this email, visit  http://www.edwardjones.com/disclosures/email.html. Edward D. Jones & Co., L.P. d/b/a Edward Jones, 12555 Manchester Road, St. Louis, MO 63131 © Edward Jones. All rights reserved.


-----Original Message-----
From: monit-general <monit-general-bounces+john.tomich=[hidden email]> On Behalf Of Lutz Mader
Sent: Wednesday, October 7, 2020 1:59 PM
To: This is the general mailing list for monit <[hidden email]>
Subject: Re: Monit and laptops

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.


Hello David,
I use monit on a Macbook, this works well.

> It seems like Monit would do just fine with a config that said “ping this address and if you have N failures in time T (or cycles), cycle the interface”. My only concern is how it might handle situations when the laptop sleeps or partially sleeps (or wakes up and doesn’t have wifi for a bit). I don’t think I’d want it to be flapping things in those cases.

But you are right, a wake-up or a switch to a other wlan is a problem.

I configure monitrc to use the Macbook hostname to bind to.

use address macbook.local

And monit monitor themselves, to bind to an interface after the wake-up.

check host Monit with address macbookpro.local
  start program "/usr/local/bin/monit reload"
  if failed port 2812 with protocol https username "guest" password "guest"
     and request "/_ping" with status >= 200
     with ssl options {verify: disable, selfsigned: allow}
     with timeout 30 seconds for 3 cycles then start #  if failed port 2812 with timeout 30 seconds for 3 cycles then start
#     else if recovered then alert
  if 3 restarts within 10 cycles then unmonitor

With regards,
Lutz

Reply | Threaded
Open this post in threaded view
|

Re: Monit and laptops

David Blank-Edelman-2
In reply to this post by Lutz Mader
Hi Lutz-

Thanks for this snippet. I noticed you listed two separate hosts (macbook.and macbookpro.local)., Was that significant or just a typo in the message?

I’m trying to make sure I understand the logic, though.

If I’m reading it right, it says

- if I can’t connect to the internal web server within 30 seconds of 3 cycles, try to reload monit (which would reset the count?)
- if I tried to reload 3 times within 10 cycles, then stop trying

If that understanding is correct, how does it ever get out of the unmonitored state again?

If you could say a bit more about why you did it this way, I’d really appreciate it.

Sorry if this seems like very basic questions.

   — dNb

> On Oct 7, 2020, at 4:58 PM, Lutz Mader <[hidden email]> wrote:
>
> Hello David,
> I use monit on a Macbook, this works well.
>
>> It seems like Monit would do just fine with a config that said “ping this address and if you have N failures in time T (or cycles), cycle the interface”. My only concern is how it might handle situations when the laptop sleeps or partially sleeps (or wakes up and doesn’t have wifi for a bit). I don’t think I’d want it to be flapping things in those cases.
>
> But you are right, a wake-up or a switch to a other wlan is a problem.
>
> I configure monitrc to use the Macbook hostname to bind to.
>
> use address macbook.local
>
> And monit monitor themselves, to bind to an interface after the wake-up.
>
> check host Monit with address macbookpro.local
>  start program "/usr/local/bin/monit reload"
>  if failed port 2812 with protocol https username "guest" password "guest"
>     and request "/_ping" with status >= 200
>     with ssl options {verify: disable, selfsigned: allow}
>     with timeout 30 seconds for 3 cycles then start
> #  if failed port 2812 with timeout 30 seconds for 3 cycles then start
> #     else if recovered then alert
>  if 3 restarts within 10 cycles then unmonitor
>
> With regards,
> Lutz
>


Reply | Threaded
Open this post in threaded view
|

Re: Monit and laptops

Lutz Mader
Hello,
this is a typo only.

> Thanks for this snippet. I noticed you listed two separate hosts (macbook.and macbookpro.local).

I use the local macbook host name to bind to and check this name.


> check host Monit with address macbookpro.local
>   start program "/usr/local/bin/monit reload"
>   if failed port 2812 with protocol https username "guest" password
"guest"
>      and request "/_ping" with status >= 200
>      with ssl options {verify: disable, selfsigned: allow}
>      with timeout 30 seconds for 3 cycles then start
>   if 3 restarts within 10 cycles then unmonitor

The check run every cycle and try to login to the monitor, if the logon
failed tree times the start command will executed.
If the Monit monitoring will be stopped it never started again. In
general the logon succeded after the start (the monit reload) command.
But I try to prevent useless/endless recovery after a give time, this is
the reason I disable the check themselfe.

> Sorry if this seems like very basic questions.

The question is reasonable, I use "start" only, the "restart" check does
not work (perhaps). I will check this, I find "start" requests only but
no "unmonitor" request in the log files. On the other hand, after the
first "monit reload" the monitor will response all the time.

With regards,
Lutz