I need monit.conf for directadmin

alipour66m

Verified User
Joined
Feb 22, 2013
Messages
69
hello I'm using apache 2.4.10 mysql 5.6
I need monit.conf for directadmin

APACHE
check process apache with pidfile /run/apache2.pid
start program = "/etc/init.d/apache2 start" with timeout 60 seconds
stop program = "/etc/init.d/apache2 stop"

MYSQL
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group mysql
start program = "/etc/init.d/mysqld start"
stop program = "/etc/init.d/mysqld stop"
if failed host 127.0.0.1 port 3306 then restart
if 5 restarts within 5 cycles then timeout


I need a full config
thanks
 
Last edited:
Hello,

I doubt you will get help here with your question. If you need monit only for monitoring status of the services on directadmin server, then that's a duplication and is unnecessary thing. Directadmin already has a monitoring system from a box and can restart a service if it finds it's down. So why do you need monit for this?
 
Someone told me that monit is good for me
and now I see that it is not good for me.
thanks
 
Last edited:
Configure Monit

The configuration file of monit in Centos or RedHat is /etc/monit.conf. Type the following command to edit
[root@lifelinux ~]# vi /etc/monit.conf

Sampe configuration file
set daemon 60
set logfile /var/log/monit.log
set mailserver localhost
set mail-format { from: [email protected]
subject: $SERVICE $EVENT at $DATE
message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION.
}
set alert [email protected]
include /etc/monit.d/*

Now to monitor Apache, create a file /etc/monit.d/httpd, enter
[root@lifelinux ~]# vi /etc/monit.d/httpd

Add following content
check process httpd with pidfile /var/run/httpd.pid
group apache
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if failed host 127.0.0.1 port 80
protocol http then restart
if 5 restarts within 5 cycles then timeout

MySQL server restart configuration directives
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group mysql
start program = "/etc/init.d/mysqld start"
stop program = "/etc/init.d/mysqld stop"
if failed host 127.0.0.1 port 3306 then restart
if 5 restarts within 5 cycles then timeout

SSH server configuration directives
check process sshd with pidfile /var/run/sshd.pid
start program "/etc/init.d/sshd start"
stop program "/etc/init.d/sshd stop"
if failed host 127.0.0.1 port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout

Type the following command to start monit
[root@lifelinux ~]# /etc/init.d/monit start

You can verify that monit is started from /var/log/monit.log log file:
[root@lifelinux ~]# tail -f /var/log/monit.log

Sample ouputs
[ICT May 12 14:51:18] info : 'system_server2.domain.com' Monit started
 
Last edited:
Back
Top