Nagios Monitoring
Nagios, IT altyapısının 7/24 izlenmesini sağlayan açık kaynak monitoring platformudur.
Nagios Kurulumu
# Bağımlılıklar
sudo dnf install -y httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp
Nagios kullanıcısı
sudo useradd nagios
sudo groupadd nagcmd
sudo usermod -a -G nagcmd nagios
sudo usermod -a -G nagcmd apache
Nagios Core indirme ve kurulum
cd /tmp
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.13.tar.gz
tar xzf nagios-4.4.13.tar.gz
cd nagios-4.4.13
./configure --with-command-group=nagcmd
make all
sudo make install
sudo make install-init
sudo make install-commandmode
sudo make install-config
sudo make install-webconf
Admin kullanıcısı
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Servisleri başlat
sudo systemctl enable --now nagios
sudo systemctl enable --now httpd
Nagios Plugins
# Plugin kurulumu
cd /tmp
wget https://nagios-plugins.org/download/nagios-plugins-2.4.6.tar.gz
tar xzf nagios-plugins-2.4.6.tar.gz
cd nagios-plugins-2.4.6
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
sudo make install
Host Tanımı
# /usr/local/nagios/etc/objects/hosts.cfg
define host {
use linux-server
host_name webserver01
alias Web Server 01
address 192.168.1.10
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
}
define hostgroup {
hostgroup_name linux-servers
alias Linux Servers
members webserver01, webserver02
}
Service Tanımları
define service {
use generic-service
host_name webserver01
service_description SSH
check_command check_ssh
}
define service {
use generic-service
host_name webserver01
service_description HTTP
check_command check_http
}
define service {
use generic-service
host_name webserver01
service_description Disk Usage
check_command check_nrpe!check_disk
}
define service {
use generic-service
host_name webserver01
service_description CPU Load
check_command check_nrpe!check_load
}
NRPE Agent Kurulumu (Client)
# Client sunucuda
sudo dnf install -y nrpe nagios-plugins-all
/etc/nagios/nrpe.cfg
allowed_hosts=127.0.0.1,192.168.1.5
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w 20% -c 10% -p /
command[check_mem]=/usr/lib64/nagios/plugins/check_mem -w 80 -c 90
sudo systemctl enable --now nrpe
Sonuç
Nagios ile proaktif monitoring yapılarak sorunlar önceden tespit edilebilir. Email/SMS alarm entegrasyonu kritiktir.