Created
April 7, 2010 17:50
-
-
Save ijin/359189 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get -y install libssl-dev bison flex | |
wget http://mmonit.net/monit/dist/monit-5.1.1.tar.gz | |
tar xvfz monit-5.1.1.tar.gz | |
cd monit-5.1.1 | |
./configure | |
make | |
sudo make install | |
### Configure monitrc ### | |
cat > monit.sed << EOF | |
s/# \(set daemon 120\)/\1/ | |
s/# \(set logfile syslog facility log_daemon\)/\1/ | |
/set mailserver/i\set mailserver localhost port 8025 | |
s/# \(set eventqueue\)/\1/ | |
s/# \( *slots 100.*\)/\1/ | |
/set mail-format/c\set mail-format { from: [email protected] } | |
s/# \(set httpd port 2812 and\)/\1/ | |
s/# \( *allow admin.*\)/\1/ | |
s/# *\(include \/etc\/monit\.d\/\*\)/\1/ | |
EOF | |
sed -f monit.sed monitrc | sudo tee /etc/monitrc | |
sudo chmod 600 /etc/monitrc | |
sudo mkdir /etc/monit.d | |
cd .. | |
rm -rf monit-5.1.1* | |
### Configure sudo ### | |
#sed -i -e 's/\(Cmnd_Alias *SOFTWARE.*\)/\1, \/usr\/local\/bin\/monit/' /etc/sudoers | |
### Configure auto-startup and respawn | |
cat >> /etc/init/monit.conf <<EOF | |
# Run monit in standard run-levels | |
description "monit daemon" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
exec /usr/local/bin/monit -Ic /etc/monitrc | |
EOF | |
sudo start monit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment