![]() In this example, we test if a file is older # than 15 minutes and assume something is wrong if its not updated. # check filesystem datafs with path /dev/sdb1 # start program = "/bin/mount /data" # stop program = "/bin/umount /data" # if failed permission 660 then unmonitor # if failed uid root then unmonitor # if failed gid disk then unmonitor # if space usage > 80% for 5 times within 15 cycles then alert # if space usage > 99% then stop # if inode usage > 30000 then alert # if inode usage > 99% then stop # group server # Check a file's timestamp. Other services, # such as databases, may depend on this resource and an automatically graceful # stop may be cascaded to them before the filesystem will become full and data # lost. # check process apache with pidfile /usr/local/apache/logs/httpd.pid # start program = "/etc/init.d/httpd start" with timeout 60 seconds # stop program = "/etc/init.d/httpd stop" # if cpu > 60% for 2 cycles then alert # if cpu > 80% for 5 cycles then restart # if totalmem > 200.0 MB for 5 cycles then restart # if children > 250 then restart # if loadavg(5min) greater than 10 for 8 cycles then stop # if failed host port 80 protocol http # and request "/somefile.html" # then restart # if failed port 443 protocol https with timeout 15 seconds then restart # if 3 restarts within 5 cycles then unmonitor # depends on apache_bin # group server # Check filesystem permissions, uid, gid, space and inode usage. This service depends on another service (apache_bin) which # is defined above. In case the service is restarted very often and the # problem remains, it is possible to disable monitoring using the TIMEOUT # statement. If the process is not running, Monit will restart # it by default. Check its resource usage such as cpu and memory, # and number of children. # set ssl # group server # Check that a process is running, in this case Apache, and that it respond # to HTTP and HTTPS requests. # set statefile /var/.monit.state # Set global SSL options (just most common options showed, see manual for # full list). If it is on temporary filesystem, the # state will be lost on reboot which may be convenient in some situations. If # the state file is stored on a persistent filesystem, Monit will recover # the monitoring state across reboots. ![]() By default the file is placed in $HOME/.monit.state. # set idfile /var/.monit.id # Set the location of the Monit state file which saves monitoring states # on each cycle. By # default the file is placed in $HOME/.monit.id. The id is generated and stored on first Monit start. By default this file is stored in $HOME/.monit.pid # set pidfile /var/run/monit.pid # Set the location of the Monit id file which stores the unique id for the # Monit instance. ![]() If you want to log to a standalone log file instead, # specify the full path to the log file # set logfile syslog # Set the location of the Monit lock file which stores the process id of the # running Monit instance. # Global section # Start Monit in the background (run as a daemon): # set daemon 30 # check services at 30 seconds intervals # with start delay 240 # optional: delay the first check by 4-minutes (by # default Monit check immediately after Monit start) # Set syslog logging. For # information about the control file and a complete list of statements and # options, please have a look in the Monit manual. # Below you will find examples of some frequently used statements. All path's MUST BE FULLY QUALIFIED, starting with '/'. # Monit control file # Comments begin with a '#' and extend through the end of the line. Why is it necessary?Īfter this, if I just started monit, it would come up OK, but the issue is reproducible - if a reload it again, the same thing happens. Also, it is interesting that it shuts down the HTTP server on reload. The most suspicious thing is that it reports syntax error for the first, extremely innocuous line from the monitrc that is just a comment, so it should be fine. Could it be an issue with signal handling and synchronization? ![]() So instead of reloading the configuration file, monit dies. Oct 14 10:10:16 HOST monit: '' Monit 5.15_beta2 started Oct 14 10:10:20 HOST monit: Reinitializing monit daemon Oct 14 10:10:20 HOST monit: Awakened by the SIGHUP signal#012Reinitializing Monit - Control file '/etc/monitrc' Oct 14 10:10:20 HOST monit: Shutting down Monit HTTP server Oct 14 10:10:20 HOST monit: Monit HTTP server stopped Oct 14 10:10:20 HOST monit: /etc/monitrc:1: syntax error '#' Oct 14 10:10:20 HOST monit: monit daemon died
0 Comments
Leave a Reply. |