Monit: Difference between revisions
From James's Wiki
No edit summary |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
manual install: | |||
wget https://mmonit.com/monit/dist/binary/5.25.2/monit-5.25.2-linux-arm.tar.gz | |||
tar zxvf monit-5.25.2-linux-arm.tar.gz | |||
cd monit-5.25.2/ | |||
sudo cp bin/monit /usr/local/bin/ | |||
cp conf/monitrc /etc/ | |||
then the monitrc file is in /etc/ not /ect/monit | |||
if installed with apt systemd file is already in. | if installed with apt systemd file is already in. | ||
Line 6: | Line 19: | ||
set alert ractive74@gmail.com | set alert ractive74@gmail.com | ||
set mailserver smtp.gmail.com port 587 | set mailserver smtp.gmail.com port 587 | ||
username "MYUSER" password "MYPASSWORD" | username "MYUSER" password "MYPASSWORD" | ||
using tlsv12 | using tlsv12 | ||
Line 29: | Line 42: | ||
sudo monit status | sudo monit status | ||
monit not starting up correctly on reboot...so I deleted the init.d/monit script and made a monit.service file | |||
# This file is systemd template for monit service. To | # This file is systemd template for monit service. To | ||
# register monit with systemd, place the monit.service file | # register monit with systemd, place the monit.service file | ||
Line 35: | Line 49: | ||
# using systemctl (see bellow). | # using systemctl (see bellow). | ||
# | # | ||
# Enable monit to start on boot: | # Enable monit to start on boot: | ||
# systemctl enable monit.service | # systemctl enable monit.service | ||
# | # | ||
# Start monit immediately: | # Start monit immediately: | ||
# systemctl start monit.service | # systemctl start monit.service | ||
# | # | ||
Line 54: | Line 68: | ||
Type=simple | Type=simple | ||
KillMode=process | KillMode=process | ||
ExecStart=/usr/ | ExecStart=/usr/bin/monit -c /etc/monit/monitrc -I | ||
ExecStop=/usr | ExecStop=/usr/bin/monit quit | ||
ExecReload=/usr | ExecReload=/usr/bin/monit reload | ||
Restart = on-abnormal | Restart = on-abnormal | ||
[Install] | [Install] | ||
WantedBy=multi-user.target | WantedBy=multi-user.target |
Latest revision as of 13:35, 27 October 2018
manual install:
wget https://mmonit.com/monit/dist/binary/5.25.2/monit-5.25.2-linux-arm.tar.gz
tar zxvf monit-5.25.2-linux-arm.tar.gz
cd monit-5.25.2/
sudo cp bin/monit /usr/local/bin/
cp conf/monitrc /etc/
then the monitrc file is in /etc/ not /ect/monit
if installed with apt systemd file is already in.
sudo nano /etc/monit/monitrc
changed:
set alert ractive74@gmail.com
set mailserver smtp.gmail.com port 587 username "MYUSER" password "MYPASSWORD" using tlsv12
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
monit not starting up correctly on reboot...so I deleted the init.d/monit script and made a monit.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/bin/monit -c /etc/monit/monitrc -I ExecStop=/usr/bin/monit quit ExecReload=/usr/bin/monit reload Restart = on-abnormal [Install] WantedBy=multi-user.target