Life without names.
Creative Live! Cam Notebook Pro (VF0400) in Ubuntu 8.04. 4 steps. ATI Catalyst 8.9. Part 1
Sep 12
1
#sudo apt-get install monit
1
#sudo cp /etc/monit/monitrc /etc/monit/monitrc_orginal
1
#sudo vim /etc/monit/monitrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
set daemon  60
set logfile syslog facility log_daemon
set mailserver localhost
set mail-format { from: monit@servername.com }
set alert root@localhost
set httpd port 2812 and
SSL ENABLE
PEMFILE  /var/certs/monit.pem
allow admin:test
 
check process proftpd with pidfile /var/run/proftpd.pid
start program = "/etc/init.d/proftpd start"
stop program  = "/etc/init.d/proftpd stop"
if failed port 21 protocol ftp then restart
if 5 restarts within 5 cycles then timeout
 
check process sshd with pidfile /var/run/sshd.pid
start program  "/etc/init.d/ssh start"
stop program  "/etc/init.d/ssh stop"
if failed port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
 
check process mysql with pidfile /var/run/mysqld/mysqld.pid
group database
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
if failed host 127.0.0.1 port 3306 then restart
if 5 restarts within 5 cycles then timeout
 
check process apache with pidfile /var/run/apache2.pid
group www
start program = "/etc/init.d/apache2 start"
stop program  = "/etc/init.d/apache2 stop"
if failed host www.example.com port 80 protocol http
and request "/monit/token" then restart
if cpu is greater than 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if totalmem > 500 MB for 5 cycles then restart
if children > 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if 3 restarts within 5 cycles then timeout
 
check process postfix with pidfile /var/spool/postfix/pid/master.pid
group mail
start program = "/etc/init.d/postfix start"
stop  program = "/etc/init.d/postfix stop"
if failed port 25 protocol smtp then restart
if 5 restarts within 5 cycles then timeout

more detail of configuration you can get on tis sites
http://www.tildeslash.com/monit/

http://www.debian-administration.org/users/Steve/weblog/32

—————–

1
2
3
4
#sudo mkdir /var/certs
#cd /var/certs
 
#sudo vim /var/certs/monit.cnf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# create RSA certs - Server
 
RANDFILE = ./openssl.rnd
 
[ req ]
default_bits = 1024
encrypt_key = yes
distinguished_name = req_dn
x509_extensions = cert_type
 
[ req_dn ]
countryName = Country Name (2 letter code)
countryName_default = MO
 
stateOrProvinceName             = State or Province Name (full name)
stateOrProvinceName_default     = State or Province Name
 
localityName                    = Locality Name (eg, city)
localityName_default            = Locality Name
 
organizationName                = Organization Name (eg, company)
organizationName_default        = Organization Name
 
organizationalUnitName          = Organizational Unit Name (eg, section)
organizationalUnitName_default  = Organizational Unit Name
 
commonName                      = Common Name (FQDN of your server)
commonName_default              = Common Name
 
emailAddress                    = Email Address
emailAddress_default            = root@monit.mo
 
[ cert_type ]
nsCertType = server
1
2
3
4
5
6
#sudo openssl req -new -x509 -days 365 -nodes -config ./monit.cnf -out /var/certs/monit.pem -keyout /var/certs/monit.pem
#sudo openssl gendh 512 >> /var/certs/monit.pem
#sudo openssl x509 -subject -dates -fingerprint -noout -in /var/certs/monit.pem
#sduo chmod 700 /var/certs/monit.pem
 
#sudo vim /etc/default/monit
1
2
3
4
5
6
7
8
9
10
11
# Defaults for monit initscript
# sourced by /etc/init.d/monit
# installed at /etc/default/monit by maintainer scripts
# Fredrik Steen <stone@debian.org>
 
# You must set this variable to for monit to start
startup=1
 
# To change the intervals which monit should run uncomment
# and change this variable.
CHECK_INTERVALS=60
1
2
#sudo /etc/init.d/monit start
#w3m https://localhost:2812/

done

Share/Save

One Response to “Monit in Ubuntu 8.04 Server”

  1. Learn Technology with Monit « Cooncat Publishing Says:

    [...] Monit to run is very simple. Thanks to no-names.biz, I’ve modified their howto posting to show you how to just get it running on Ubuntu 8.04 (Hardy), and I’ve used nano instead of [...]


    View this Comment in:

Leave a Reply