![]() Now it’s time to set some services and processes to be monitored by Monit. Now you can visit your Monit web interface at the following address: IP_OR_DOMAIN:2812 Make sure to change your username and password to something strong like below: set httpd port 2812 andĪllow MonitAdmin: 5PbTLadz # require user 'MonitAdmin' with password '5PbTLadz' #allow localhost # allow localhost to connect to the server and #use address localhost # only accept connection from localhost Use address localhost # only accept connection from localhostĪllow localhost # allow localhost to connect to the server andĪllow admin:monit # require user 'admin' with password 'monit'īy default, Monit only listens on “localhost” and only answers to “localhost” as well, So if you want to be able to connect to your Monit interface from anywhere, you have to comment the following lines: set httpd port 2812 and In the Monit global configuration file, scroll down to the following block: set httpd port 2812 and You can set your preferred Email address to get alerts and reports from Monit with the following command: set mailserver port 25 set alert Initial Configurationįor doing some configuration you need to open your Monit global configuration file with the command below: nano /etc/monitrc Enable the web interface You can check your Monit service status with the command below: systemctl status monit Automatic email alerts sent at event triggers.įor installing Monit you need to add the EPEL repository first: yum install epel-releaseĪfter that you can install Monit easily using: yum install monitĪfter the installation process is finished, you can execute the following commands to start Monit service and make it run at startup: systemctl start monit systemctl enable monit.Monitoring of running services, and the ability to start, kill or restart.Capability to act on out-of-bounds values for CPU, RAM, disk, file size, age and more.Automatic process maintenance in a lightweight package.Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations, for example, Monit can prevent your services from getting stopped.īelow are some of the main benefits of using Monit: PS - My monit cycle length is 10s, hence the actions in the log snippit are 30s apart.Monit is a free open source utility for managing and monitoring, processes, programs, files, directories and filesystems on a UNIX system. Why is monit performing my restart action on unspecified cycles? May 24 14:05:25 monit: 'mydaemon' start: /etc/init.d/mydaemon May 24 14:05:25 monit: 'mydaemon' stop: /etc/init.d/mydaemon May 24 14:05:25 monit: 'mydaemon' trying to restart May 24 14:05:25 monit: 'mydaemon' status failed (1) for /usr/local/sbin/my_check.sh - Error: testing! May 24 14:04:54 monit: 'mydaemon' start: /etc/init.d/mydaemon May 24 14:04:54 monit: 'mydaemon' stop: /etc/init.d/mydaemon May 24 14:04:54 monit: 'mydaemon' trying to restart May 24 14:04:54 monit: 'mydaemon' status failed (1) for /usr/local/sbin/my_check.sh - Error: testing! May 24 14:04:24 monit: 'mydaemon' start: /etc/init.d/mydaemon May 24 14:04:24 monit: 'mydaemon' stop: /etc/init.d/mydaemon May 24 14:04:24 monit: 'mydaemon' trying to restart May 24 14:04:24 monit: 'mydaemon' status failed (1) for /usr/local/sbin/my_check.sh - Error: testing! ![]() ![]() May 24 14:03:54 monit: 'mydaemon' start: /etc/init.d/mydaemon May 24 14:03:54 monit: 'mydaemon' stop: /etc/init.d/mydaemon May 24 14:03:54 monit: 'mydaemon' trying to restart May 24 14:03:54 monit: 'mydaemon' status failed (1) for /usr/local/sbin/my_check.sh - Error: testing! Things work almost as expected - every 3 cycles monit performs the check or takes an action, though as you might guess by the comment in the config, what I am seeing in my logs is that on cycle 3, 4, and 5 monit will also perform the restart action: May 24 14:03:24 monit: 'mydaemon' status failed (1) for /usr/local/sbin/my_check.sh - Error: testing! If status = 1 for 6 cycles then unmonitor If status = 1 for 4 cycles then exec "/bin/true" # Trick monit into doing a restart + hitting our local alert ![]() START PROGRAM "/etc/init.d/mydaemon start" ![]() My config is this: CHECK program mydaemon with path "/usr/local/sbin/my_check.sh" I want to do this check every few cycles so as to avoid being a burden on the app. I am using Monit 5.5 with the CHECK PROGRAM directive to execute an external script that does some work to verify if my app is functioning properly. ![]()
0 Comments
Leave a Reply. |