linux:monit
This is an old revision of the document!
Table of Contents
Monit
Installation
sudo apt update sudo apt install monit sudo systemctl start monit sudo systemctl enable monit sudo systemctl status monit
Monit als Dienst einrichten
/lib/systemd/system/monit.service
erstellen:
# 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 below). # # 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-online.target Documentation=man:monit(1) https://mmonit.com/wiki/Monit/HowTo [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 StandardOutput=null [Install] WantedBy=multi-user.target
Monit aktivieren und starten:
sudo systemctl enable monit.service sudo systemctl start monit.service sudo systemctl status monit.service
Konfiguration
/etc/monit/conf-enabled/monit.conf
erstellen:
set httpd port 2812 and use address localhost # only accept connection from localhost (drop if you use M/Monit) allow localhost # allow localhost to connect to the server and allow admin:monit # require user 'admin' with password 'monit'
Befehle
sudo monit reload sudo monit status
monit
Usage: monit [options]+ [command] Options are as follows: -c file Use this control file -d n Run as a daemon once per n seconds -g name Set group name for monit commands -l logfile Print log information to this file -p pidfile Use this lock file in daemon mode -s statefile Set the file monit should write state information to -I Do not run in background (needed when run from init) --id Print Monit's unique ID --resetid Reset Monit's unique ID. Use with caution -B Batch command line mode (do not output tables or colors) -t Run syntax check for the control file -v Verbose mode, work noisy (diagnostic output) -vv Very verbose mode, same as -v plus log stacktrace on error -H [filename] Print SHA1 and MD5 hashes of the file or of stdin if the filename is omitted; monit will exit afterwards -V Print version number and patchlevel -h Print this text Optional commands are as follows: start all - Start all services start <name> - Only start the named service stop all - Stop all services stop <name> - Stop the named service restart all - Stop and start all services restart <name> - Only restart the named service monitor all - Enable monitoring of all services monitor <name> - Only enable monitoring of the named service unmonitor all - Disable monitoring of all services unmonitor <name> - Only disable monitoring of the named service reload - Reinitialize monit status [name] - Print full status information for service(s) summary [name] - Print short status information for service(s) report [up|down|..] - Report state of services. See manual for options quit - Kill the monit daemon process validate - Check all services and start if not running procmatch <pattern> - Test process matching pattern
linux/monit.1679533508.txt.gz · Last modified: 2024/02/17 19:03 (external edit)