Icinga

From HackerNet
Jump to: navigation, search

Icinga är ett monitoreringssystem som kollar tillgänglighet på servrar och tjänster. Det är tänkt som en nyskriven och förbättrad variant av nagios. Icinga är open source.

Installation

sudo apt-get -y install software-properties-common && sudo add-apt-repository ppa:formorer/icinga
sudo apt update && sudo apt install icinga icinga-doc icinga-idoutils mysql-server libdbd-mysql mysql-client
sudo usermod -a -G nagios www-data
sudo nano /etc/default/icinga
IDO2DB=yes
sudo service ido2db start
sudo cp /usr/share/doc/icinga-idoutils/examples/idoutils.cfg-sample /etc/icinga/modules/idoutils.cfg
sudo service icinga restart
sudo chmod u+s `which ping`

http://host/icinga, icingaadmin

Konfiguration

Icinga kan övervaka med agenter eller kolla "öppna" tjänster.

Utan agent

sudo nano /etc/icinga/objects/hackernet.cfg
define host {
       use                     generic-host
       host_name               www.hackernet.se
       alias                   The Best Web Server
       address                 212.107.156.238
}

define service {
       use                     generic-service
       host_name               www.hackernet.se
       service_description     HTTP
       check_command           check_http
}
sudo service icinga reload

Övervakning med agent.

På klient:

sudo apt install nagios-plugins nagios-nrpe-server
sudo nano /etc/nagios/nrpe.cfg
server_address=client_IP
allowed_hosts=ICINGA_IP
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/vda
sudo service nagios-nrpe-server restart

På icinga:

sudo nano /etc/icinga/objects/yourhost.cfg
define host {
       use                     generic-host
       host_name               wordpress-1
       alias                   My first wordpress server
       address                 10.128.xxx.xxx
       }

Ping:

define service {
       use                             generic-service
       host_name                       wordpress-1
       service_description             PING
       check_command                   check_ping!100.0,20%!500.0,60%
       }

SSH

define service {
       use                             generic-service
       host_name                       wordpress-1
       service_description             SSH
       check_command                   check_ssh
       notifications_enabled           0
       }

Load:

define service {
       use                             generic-service
       host_name                       wordpress-1
       service_description             Current Load
       check_command                   check_load!5.0!4.0!3.0!10.0!6.0!4.0
       }

Current Users:

define service {
       use                             generic-service
       host_name                       wordpress-1
       service_description             Current Users
       check_command                   check_users!20!50
       }

Disk Space:

define service {
       use                             generic-service
       host_name                       wordpress-1
       service_description             Disk Space
       check_command                   check_all_disks!20%!10%
       }
sudo service icinga reload