Monit: Difference between revisions
From James's Wiki
No edit summary |
No edit summary |
||
Line 27: | Line 27: | ||
sudo monit status | sudo monit status | ||
==Systemd .service file== | |||
# This file is systemd template for monit service. To | |||
# register monit with systemd, place the monit.service file | |||
# to the /lib/systemd/system/ directory and then start it | |||
# using systemctl (see bellow). | |||
# | |||
# Enable monit to start on boot: | |||
# systemctl enable monit.service | |||
# | |||
# Start monit immediately: | |||
# systemctl start monit.service | |||
# | |||
# Stop monit: | |||
# systemctl stop monit.service | |||
# | |||
# Status: | |||
# systemctl status monit.service | |||
[Unit] | |||
Description=Pro-active monitoring utility for unix systems | |||
After=network.target | |||
[Service] | |||
Type=simple | |||
KillMode=process | |||
ExecStart=/usr/local/bin/monit -I | |||
ExecStop=/usr/local/bin/monit quit | |||
ExecReload=/usr/local/bin/monit reload | |||
Restart = on-abnormal | |||
[Install] | |||
WantedBy=multi-user.target |
Revision as of 01:36, 20 January 2018
sudo nano /etc/monit/monitrc
changed:
set alert ractive74@gmail.com
set httpd port 2812 and use address localhost # only accept connection from localhost allow localhost # allow localhost to connect to the server and
check system $HOST if loadavg (1min) > 4 then alert if loadavg (5min) > 2 then alert if cpu usage > 95% for 10 cycles then alert if memory usage > 75% then alert if swap usage > 25% then alert
check network public with interface eth0 if failed link then alert
sudo systemctl restart monit
sudo monit -t
sudo monit start all
sudo monit status
Systemd .service file
# This file is systemd template for monit service. To # register monit with systemd, place the monit.service file # to the /lib/systemd/system/ directory and then start it # using systemctl (see bellow). # # Enable monit to start on boot: # systemctl enable monit.service # # Start monit immediately: # systemctl start monit.service # # Stop monit: # systemctl stop monit.service # # Status: # systemctl status monit.service [Unit] Description=Pro-active monitoring utility for unix systems After=network.target [Service] Type=simple KillMode=process ExecStart=/usr/local/bin/monit -I ExecStop=/usr/local/bin/monit quit ExecReload=/usr/local/bin/monit reload Restart = on-abnormal [Install] WantedBy=multi-user.target