LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-01-2009, 01:00 PM   #1
steve51184
Member
 
Registered: Dec 2006
Posts: 381

Rep: Reputation: 30
help me setup monit please :)


right i'm using monit to monitor mysql, apache, and ssd here my config:


Quote:
set daemon 60
set logfile syslog facility log_daemon
set mailserver server.ip
set mail-format { from: monit@server1.domain.com }
set alert email
set httpd port 2812 and
allow adminassword

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 H045 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.thereddwarf.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
i have a few questions:

1. is the config right?

2. is this just to monitor if these 3 services are down? (ie nothing else but to check if there down and to restart if they are)

3. is there a way to have it restart the services is they use a lot of cpu/ram

i'm really interested in question 3 as apache and sometime mysql uses a lot of ram like 1gb+ (but i do have 4gb)

Last edited by steve51184; 08-01-2009 at 01:04 PM.
 
Old 08-03-2009, 03:27 AM   #2
jahic.mersudin
LQ Newbie
 
Registered: Sep 2008
Posts: 12

Rep: Reputation: 0
if have no idea what u are doing try using webmin that has simple web interface and check config from there
 
Old 08-03-2009, 03:43 AM   #3
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by steve51184
1. is the config right?
Dunno but I'll guess if monit starts everything is fine. Else try the -I option to monit. It just lingers aroud in the foreground and you might see what it does does not do.

Quote:
Originally Posted by steve51184
2. is this just to monitor if these 3 services are down? (ie nothing else but to check if there down and to restart if they are)
Dunno but as you only have three check process lines inside your config I incline to it.

Quote:
Originally Posted by steve51184
3. is there a way to have it restart the services is they use a lot of cpu/ram
Take a look here. this is an example for restarting apache in certain circumstances. Should give you an idea how to setup things for mysql and ssh as well.

http://mmonit.com/wiki/Monit/MonitorApacheStatus


Just a hint. I'd be carefull with restarting (stopping) ssh automaticly. Might lead to lockdown of box cause the sshd does not come up for some reason.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Monit parameters linuxfia Linux - Software 8 06-04-2009 10:55 AM
Monit and Mysql bichonfrise74 Linux - Newbie 2 05-04-2009 11:47 AM
little help getting monit working please steve51184 Linux - Software 1 02-24-2009 04:56 PM
Disappointed from Monit, need advice lusine Linux - Newbie 1 02-07-2009 06:09 AM
Problem with Setting up monit helptonewbie Linux - Software 2 07-29-2007 04:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration