Установка и настройка Nagios и NRPE через yum (из репозитория) CentOS 6
ГлавнаяSupportАдминистраторамMonitoringУстановка и настройка Nagios и NRPE через yum (из репозитория) CentOS 6
Установка и настройка Nagios и NRPE через yum (из репозитория) CentOS 6 Установка и настройка Nagios и NRPE через yum (из репозитория) CentOS 6
Шаг 1 - установка пакетов на сервер мониторинга (главный сервер)
1 2 3 4 5 | rpm -Uvh http: //dl .fedoraproject.org /pub/epel/6/x86_64/epel-release-6-8 .noarch.rpm rpm -Uvh http: //rpms .famillecollet.com /enterprise/remi-release-6 .rpm yum -y install nagios nagios-plugins-all nagios-plugins-nrpe nrpe php httpd chkconfig httpd on && chkconfig nagios on service httpd start && service nagios start |
1 2 3 4 | dd if = /dev/zero of= /swap bs=1024 count=2097152 mkswap /swap && chown root. /swap && chmod 0600 /swap && swapon /swap echo /swap swap swap defaults 0 0 >> /etc/fstab echo vm.swappiness = 0 >> /etc/sysctl .conf && sysctl -p |
Шаг 2 - Задаем пароль для пользователя
Задаем Nagios Admin Panel пароль:1 | htpasswd -c /etc/nagios/passwd nagiosadmin |
Теперь мы можем зайти в панель управления:
1 | http: //IP_ сервер /nagios |

Теперь мы должны добавить наши хосты, которые будут контролироваться Nagios. Например, мы будем мониторить vps.xagon-italy.com.ua (46.105.232.75).
Из открытых портов, мы можем следить за пинг, любые открытые порты, такие как веб-сервер, сервер электронной почты и т.д.
Для внутренних служб, которые слушают на локальном хосте, таких как MySQL, Memcached, системные службы, нам нужно будет использовать NRPE.
Now we should add our hosts that will be monitored by Nagios. For example, we will use cloudmail.tk (198.211.107.218) and emailocean.tk (198.211.112.99). From public ports, we can monitor ping, any open ports such as webserver, e-mail server, etc. For internal services that are listening on localhost, such as MySQL, memcached, system services, we will need to use NRPE.
Шаг 3 - Установка NRPE on сервер-клиент
1 2 3 4 | rpm -Uvh http: //dl .fedoraproject.org /pub/epel/6/x86_64/epel-release-6-8 .noarch.rpm rpm -Uvh http: //rpms .famillecollet.com /enterprise/remi-release-6 .rpm yum -y install nagios nagios-plugins-all nrpe chkconfig nrpe on |
Убедитесь в том , чтобы изменить allowed_hosts к собственным значениям.
Редактирование /etc/nagios/nrpe.cfg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | log_facility=daemon pid_file= /var/run/nrpe/nrpe .pid server_port=5666 nrpe_user=nrpe nrpe_group=nrpe allowed_hosts=164.132.214.41 # ip_адрес_нагиус_сервера dont_blame_nrpe=1 debug=0 command_timeout=60 connection_timeout=300 include_dir= /etc/nrpe .d/ command [check_users]= /usr/lib64/nagios/plugins/check_users -w 5 -c 10 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 /dev/vda command [check_zombie_procs]= /usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z command [check_total_procs]= /usr/lib64/nagios/plugins/check_procs -w 150 -c 200 command [check_procs]= /usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ |
Вы можете также изменить , когда для запуска предупреждения или критические предупреждения - выше наборов. Конфигурации предупреждения на 20% свободного места на диске остальные, и критические оповещения на 10% свободного места.
Мы должны также внести правила настройки брандмауэра, чтобы разрешить соединения с нашего сервера мониторинга:
1 2 3 4 5 | iptables -N NRPE iptables -I INPUT -s 0 /0 -p tcp --dport 5666 -j NRPE iptables -I NRPE -s 198.211.117.251 -j ACCEPT iptables -A NRPE -s 0 /0 -j DROP /etc/init .d /iptables save |
1 | service nrpe start |
Шаг 4 - Додаем настройки на Monitoring Server
Создаем файлы конфигурации наших серверов-клиентов на мониторинг сервере:1 2 3 | echo "cfg_dir=/etc/nagios/servers" >> /etc/nagios/nagios .cfg cd /etc/nagios/servers touch vps.xagon-italy.com.ua.cfg |
1 | vi /etc/nagios/servers/vps .xagon-italy.com.ua.cfg |
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 | define host { use linux-server host_name vps.xagon-italy.com.ua.cfg alias vps.xagon-italy.com.ua.cfg address 46.105.232.75 } define service { use generic-service host_name vps.xagon-italy.com.ua.cfg service_description PING check_command check_ping!100.0,20%!500.0,60% } define service { use generic-service host_name vps.xagon-italy.com.ua.cfg service_description SSH check_command check_ssh notifications_enabled 0 } define service { use generic-service host_name vps.xagon-italy.com.ua.cfg service_description Current Load check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0 } |
1 2 | chown -R nagios. /etc/nagios service nagios restart |
Шаг 5 - Мониторим добавленный сервер в Nagios
1 | http: //IP_ сервер /nagios |
2012-2025 © Web site development. Developed by ABCname