Добавляем новый сервер в мониторинг nagios

Добавляем новый сервер в мониторинг nagios Как добавить сервер в мониторинг nagios
images/development/development/nagios.png

Скрипт, который может помочь установить nagios
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
/usr/sbin/useradd -m nagios
passwd nagios
efefgegege
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd apache
/usr/sbin/usermod -a -G nagcmd nobody
wget http://assets.nagios.com/downloads/nagiosplugins/nagios-plugins-1.5.tar.gz
tar xzf nagios-plugins-1.5.tar.gz
cd nagios-plugins-1.5
yum install gcc gcc-c++ #(буває їх не знаходить)
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
yum -y install xinetd openssl-devel
 
cd ..
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
tar -xzf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure --enable-ssl
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-xinetd
echo "nrpe 5666/tcp # nrpe" >> /etc/services
echo "nrpe 5666/udp # nrpe" >> /etc/services
service xinetd restart
 
iptables -A OUTPUT -p tcp --dport 5666 -j ACCEPT
iptables -A INPUT -p tcp --dport 5666 -j ACCEPT
iptables -A FORWARD -p tcp --dport 5666 -j ACCEPT
iptables -A FORWARD -p udp --dport 5666 -j ACCEPT
iptables -A INPUT -p udp --dport 5666 -j ACCEPT
iptables -A OUTPUT -p udp --dport 5666 -j ACCEPT
Дальше вручную:
1
2
vi /etc/xinetd.d/nrpe
only_from = 127.0.0.1 >> only_from = 127.0.0.1 XXX.XXX.XXX.XXX # ip на котором nagios - сервер
Открываем НА УДАЛЕННОМ СЕРВЕРЕ и добавляем в самый низ следующие строки (ВНИМАНИЕ, там уже будут похожие строки их или комментируем или удаляем)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
vi /usr/local/nagios/etc/nrpe.cfg
 
-------------------------------------------
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 25,15,10
command[check_disk1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 250 -c 350
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 20% -c 10%
command[check_http]=/usr/local/nagios/libexec/check_http -H 127.0.0.1 -w 5 -c 10
command[check_ssh]=/usr/local/nagios/libexec/check_ssh -H 127.0.0.1 -p 22 -t 60
 
sda1 нужно удалять в большинстве случаев
а если порт будет 2222, то ………...check_ssh2222 -H 127.0.0.1 -p 2222 -t 60
-------------------------------------------
На СЕРВЕРЕ НАГИОС
1
2
3
4
5
cd /usr/local/nagios/etc/objects/   # создаем файл с конфигом для впс по аналогу остальных
vi /usr/local/nagios/etc/nagios.cfg # создаем в конфиге строку для впс по аналогу остальных
 
service nagios restart
service xinetd restart - на обеих серверах
More
hit.ua: посетителей за сегодня