Assalamuallaikum wr.wb
Di postingan kali ini gw mau share soal Networking Monitoring, ini installnya di OS debian, ok langsung saja
1. Konfigurasi Monit.
#vim /etc/monit/monitrc
set httpd port 2812 and
use address localhost # only accept connection from localhost
allow localhost # allow localhost to connect to the server and
allow admin:admin # require user ‘admin’ with password ‘monit’
2. Restart Monit
/etc/init.d/monit start
Jika Monit tidak bisa direstart kemudian muncul seperti berikut:
# /etc/init.d/monit start
Starting daemon monitor: monit won’t be started/stopped
unless it it’s configured
please configure monit and then edit /etc/default/monit
and set the “startup” variable to 1 in order to allow
monit to start
Cara untuk error diatas adalah edit /etc/default/monit kemudian cari variabel startup=0 diganti menjadi startup=1.
4. Menambahkan Service yang ingin dimonitor. Misalkan service yang dimonitor adalah system server, apache2, mysql, ssh dan permission path bin.
# check system server
check system localhost
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
if memory usage > 75% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
#Monitoring Apache2 Service
check process apache2 with pidfile /var/run/apache2.pid
start program = “/etc/init.d/apache2 start”
stop program = “/etc/init.d/apache2 stop”
if cpu is greater than 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if totalmem > 200.0 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
group server
#Monitoring Mysql Service
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
#Monitoring SSH service
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 directory for permission.
check directory bin with path /bin
if failed permission 755 then unmonitor
if failed uid 0 then unmonitor
if failed gid 0 then unmonitor
5. Akeses Monit via Browser.
http://localhost:2812
Done . sumber artikel ini dari SINI .
Sekian postingan dari saya, semoga bermanfaat ^_^ , Arigatou ^_^ .
Post a Comment
Post a Comment