Author Topic: new Monit cfg  (Read 140 times)

0 Members and 3 Guests are viewing this topic.

Offline
*
new Monit cfg
« on: February 15, 2025, 12:04:00 AM »
Quote
set daemon 300             # Check services at 5-minute intervals
with start delay 45        # Wait 45 seconds before starting checks

set log syslog             # Log output to syslog
set logfile /var/log/monit.log  # Additionally log to a specific file

set pidfile /var/run/monit.pid   # Define PID file location
set idfile /var/.monit.id        # Monit ID file location
set statefile /var/.monit.state  # Monit state file location

set mailserver localhost         # Mailserver for sending alerts
set alert your email  # Alert email address

set eventqueue
  basedir /var/monit    # Event queue directory
  slots 100             # Number of slots in the event queue

# HTTP interface settings
set httpd port 2812 and
    use address localhost        # Only listen on localhost
    allow localhost              # Allow connections from localhost
    allow admin:xxxxxx    # Use a strong password and consider using HTTPS
    ssl enable
    pemfile /etc/pki/tls/private/hostname.pem # Correct path to SSL certificate

# Include additional configuration files
include /etc/monit.d/*

# Apache monitoring
check process apache with pidfile /var/run/httpd/httpd.pid
    start program = "/usr/bin/systemctl start httpd.service" with timeout 15 seconds
    stop program = "/usr/bin/systemctl stop httpd.service"

# Nginx monitoring
check process nginx_service with pidfile /var/run/nginx.pid
    start program = "/usr/bin/systemctl start nginx.service" with timeout 15 seconds
    stop program = "/usr/bin/systemctl stop nginx.service"

# System monitoring
check system localhost
    if loadavg (1min) > 4 then alert
    if loadavg (5min) > 2 then alert
    if memory usage > 75% then alert
    if swap usage > 25% then alert
    if cpu usage (user) > 70% then alert
    if cpu usage (system) > 30% then alert
    if cpu usage (wait) > 20% then alert

Offline
*****
Re: new Monit cfg
« Reply #1 on: February 15, 2025, 03:23:00 PM »
What are you wanting to say / show about your config values?

Offline
*****
Re: new Monit cfg
« Reply #2 on: February 15, 2025, 08:11:41 PM »
Yea, ditch Monit, and disable it.
I wish CWP would stop forcing you to install the damn thing to get rid of the notification.
If the server hoses, so would Monit.

Check out:
UptimeRobot at https://uptimerobot.com/
or
HetrixTools at https://hetrixtools.com/

They both have Free level until you reach a certain number of monitors. And they both have the pros & cons, depending on what you want to use it for.