piatok 28. februára 2020

Inštalácia Monit na CentOS7

Ako som inštaloval Monit na CentOS7:




1. najprv update systému: 

yum update

2. pridáme epel repozitár

yum install epel-release

3. nainštalujeme monit

yum install monit

4. Naštartujeme monit a spravíme enable (aby nabootval po štarte)

systemctl enable monit
systemctl start monit

5. Konfiguračný súbor sa nachádza v /etc/monitrc

[root@test24 ~]# ll /etc/monitrc
-rw-------. 1 root root 12974 Dec 26  2017 /etc/monitrc

defaultne to je nastavené, aby to checklo každých 30 sekúnd
set daemon  30              # check services at 30 seconds intervals





nastavenie mailserveru:

# set mailserver mail.bar.baz,               # primary mailserver
set 10.24.113.111 port 25


nastavenie logov: 


[root@test24 ~]# vi /etc/monit.d/logging






pridanie basic služieb:

[root@test24 ~]# cat /etc/monit.d/system

## System
check system $HOST
  if loadavg (5min) > 3 then alert
  if loadavg (15min) > 1 then alert
  if memory usage > 80% for 4 cycles then alert
  if swap usage > 20% for 4 cycles then alert
  # Test the user part of CPU usage
  if cpu usage (user) > 80% for 2 cycles then alert
  # Test the system part of CPU usage
  if cpu usage (system) > 20% for 2 cycles then alert
  # Test the i/o wait part of CPU usage
  if cpu usage (wait) > 80% for 2 cycles then alert
  # Test CPU usage including user, system and wait. Note that
  # multi-core systems can generate 100% per core
  # so total CPU usage can be more than 100%
  if cpu usage > 200% for 4 cycles then alert



## Network
check network eth0 with interface eth0
  start program = "/sbin/ifup eth0"
  stop program = "/sbin/ifdown eth0"
  if failed link then restart
  if failed link then alert
  if changed link then alert


 6. reštartujeme službu monit

systemctl restart monit


Môžeme sa hrať

zdroj: https://www.webfoobar.com/node/49

Žiadne komentáre:

Zverejnenie komentára