Icinga

From HackerNet
Revision as of 15:57, 4 July 2015 by Helikopter (talk | contribs)
Jump to: navigation, search
        1. WIP

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 install software-properties-common && sudo add-apt-repository ppa:formorer/icinga
sudo apt-get update && sudo apt-get install icinga2 mysql-server mysql-client git && sudo apt-get install icinga2-ido-mysql
mysql -u root -p
sudo icinga2 feature enable livestatus && sudo service icinga2 restart
sudo usermod -a -G nagios www-data
sudo icinga2 feature enable compatlog && sudo icinga2 feature enable ido-mysql && sudo icinga2 feature enable command
sudo service icinga2 restart
git clone git://git.icinga.org/icingaweb2.git && sudo mv icingaweb2 /usr/share/icingaweb
cd /usr/share/icingaweb && sudo tasksel install lamp-server
./bin/icingacli setup config webserver apache --document-root /usr/share/icingaweb/public
sudo service apache2 restart && sudo a2enmod rewrite && sudo service apache2 restart
sudo mkdir /etc/icingaweb2 && sudo chmod 777 -R /etc/icingaweb2
sudo su www-data --shell=/bin/bash -c "mkdir -m 2770 /etc/icingaweb2; head -c 12 /dev/urandom | base64 | tee /etc/icingaweb2/setup.token; chmod 0660 /etc/icingaweb2/setup.token;";
sudo apt-get install php5-ldap && sudo service apache2 restart && sudo apt-get -y install php5-intl && sudo apt-get -y install php5-gd php5-imagick && sudo service apache2 restart 

http://host/icinga-web, 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

Plugins

sudo apt-get install nagios-plugins