четверг, 1 декабря 2011 г.

Nagios + NRPE мониторинг процессов на серверах

(ОС: Debian 5.0)

В nagios.cfg выставляем check_external_commands = 1

Правим права на /var/lib/nagios3/rw/nagios.cmd (chown nagios:www-data, chmod g+rx)
Для мониторинга внутренних процессов на никсовых машинах (cpu,memory,disks and etc) требуется на хосты которые мониторятся поставить nagios-nrpe-server, а на машину с nagios поставить nagios-nrpe-plugin)
Настрока NRPE демона на сервере рабочие процессы которого необходимо мониторить
/etc/nagios/nrpe.cfg
server_address=172.16.0.22            # IP который будет слушать NRPE
server_port=5666                # порт на котором будет NRPE
allowed_hosts=127.0.0.1,172.16.0.17        # хосты которым разрешено подключаться к NRPE (здесь вставляем адрес машины с nagios)
dont_blame_nrpe=1                # разрешить использовать аргументы
Пример файла с описанием служб под мониторингом NRPE в nagios,
# Define a service to check the number of currently logged in
# users on the local machine.  Warning if > 20 users, critical
# if > 50 users.

define service{
use                             generic-service         ; Name of service template to use
host_name                       nagclient.training.int
service_description             Current Users
check_command                   check_nrpe!check_users!172.16.0.22 -a 20 50
}

# Define a service to check the number of currently running procs
# on the local machine.  Warning if > 250 processes, critical if
# > 400 processes.

define service{
use                             generic-service         ; Name of service template to use
host_name                       nagclient.training.int
service_description             Total Processes
check_command                   check_nrpe!check_total_procs!172.16.0.22 -a 250 400
}

# Define a service to check the load on the local machine.

define service{
use                             generic-service         ; Name of service template to use
host_name                       nagclient.training.int
service_description             Current Load
check_command                   check_nrpe!check_load!172.16.0.22 -a 16,11,6 31,26,21
}
Для возможности использования всех остальных скриптов из /usr/lib/nagios/plugins править конфиг /etc/nagios/nrpe.cfg на сервере который хотим мониторить
# COMMAND PREFIX
# This option allows you to prefix all commands with a user-defined string.
# A space is automatically added between the specified prefix string and the
# command line from the command definition.
#
# *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! ***
# Usage scenario:
# Execute restricted commmands using sudo.  For this to work, you need to add
# the nagios user to your /etc/sudoers.  An example entry for alllowing
# execution of the plugins from might be:
#
# nagios          ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
#
# This lets the nagios user run all commands in that directory (and only them)
# without asking for a password.  If you do this, make sure you don’t give
# random users write access to that directory or its contents!

# command_prefix=/usr/bin/sudo

# DEBUGGING OPTION
# This option determines whether or not debugging messages are logged to the
# syslog facility.
# Values: 0=debugging off, 1=debugging on
Веб-интерфейс для конфигурирования Nagios http://www.nagiosql.org/

Комментариев нет:

Отправить комментарий