I'm using Monit for system monitoring. If i enable monitoring on a service it shows 'initializing' in the Status row. This can take a while. I wonder what Monit is doing in that time, since the used start script should return in under 2 secs max.
Asked
Active
Viewed 7,441 times
2 Answers
10
If you look in /etc/monit/monitrc, you'll see one of the options is "set daemon" which controls how often Monit checks services. Mine is set at 120. So that is the quickest Monit will update what it reports. The script might return in 2 seconds, but if yours is set like mine Monit won't check it again for another 118 seconds thereafter.
LawrenceC
- 75,182
2
Solved my monit initialization delay caused by a non-responsive SMTP mail server.
Commenting out these two lines in /etc/monit/monitrc were the isloated config change I applied to make my monit restarts really fast!
# set mailserver smtp.sendgrid.com
# username "apikey" password "SG.."
These /var/log/monit.log entries helped:
[EDT Jun 9 06:28:32] error : Cannot create socket
to [smtp.sendgrid.com]:25 -- Connection timed out
[EDT Jun 9 06:28:32] error : Cannot open a connection to the mailserver 'smtp.sendgrid.com:25' -- Operation now in progress
[EDT Jun 9 06:28:32] error : Mail: No mail servers are available
monit -V
This is Monit version 5.16
Built with ssl, with pam and with large files
Copyright (C) 2001-2016 Tildeslash Ltd. All Rights Reserved.
lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
uname -a
Linux prime3prod 4.4.0-1084-aws #94-Ubuntu SMP Fri May 17 13:10:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Taylor Brockman
- 121