Мониторинг с помощью диска Nagios — NRPE — Linux

У меня возникла проблема с сервисом Nagios/NRPE:

Я выполнил настройку каждого из файлов, но не распознал ответ nagios, отправленный NRPE на клиенте:

Файл: /etc/nagios/nrpe.cfg (клиент)

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/mapper/VG_opt-LV_opt
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

Файл: services.cfg (Servidor)

define service{
  use                   generic-service
  host_name             192.168.160.10, 192.168.160.11, 192.168.160.12
  service_description   Disk Space
  notification_options w,u,c,r
  check_command         check_nrpe!check_disk
}

Явно перезапускал сервисы на клиенте и сервере и прочие консультации через NRPE результаты получаются, так как кол-во процессов ЦП и ОЗУ это проблема с check_disk.

Результат, полученный с помощью локального check_disk:

DISK OK - free space: /opt 34024 MB (76% inode=98%);| /opt=10522MB;37544;42237;0;46930

Результат через Интернет

Disk SpaceUNKNOWN    2014-09-26 09:18:31    0d 15h 52m 53s    4/4    (No output returned from plugin) 

еще более странно, когда с сервера nagios я получаю результаты.

$ ./check_nrpe -H 192.168.160.10 -c check_disk
DISK OK - free space: /opt 33389 MB (74% inode=98%);| /opt=11156MB;37544;42237;0;46930

Через Интернет:

**(No output returned from plugin)**

(No output returned from plugin)
NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad ([email protected])
Version: 2.15
Last Modified: 09-06-2013
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: Anonymous DH Mode, OpenSSL 0.9.6 or higher required
\nUsage: check_nrpe -H <host> [ -b <bindaddr> ] [-4] [-6] [-n] [-u] [-p <port>] [-t <timeout>] [-c <command>] [-a <arglist...>]
\nOptions:
-h = Print this short help.
-l = Print licensing information.
-n = Do no use SSL
-u = Make socket timeouts return an UNKNOWN state instead of CRITICAL
<host> = The address of the host running the NRPE daemon
<bindaddr> = bind to local address
-4 = user ipv4 only
-6 = user ipv6 only
[port] = The port on which the daemon is running (default=5666)
[timeout] = Number of seconds before connection times out (default=10)
[command] = The name of the command that the remote daemon should run
[arglist] = Optional arguments that should be passed to the command. Multiple
arguments should be separated by a space. If provided, this must be
the last option supplied on the command line.
\nNote:
This plugin requires that you have the NRPE daemon running on the remote host.
You must also have configured the daemon to associate a specific plugin command
with the [command] option you are specifying here. Upon receipt of the
[command] argument, the NRPE daemon will run the appropriate plugin command and
send the plugin output and return code back to *this* plugin. This allows you
to execute plugins on remote hosts and 'fake' the results to make Nagios think
the plugin is being run locally.
\n

person Jhosman    schedule 29.09.2014    source источник
comment
Это натянуто, но как определяется команда check_nrpe?   -  person Alain Collins    schedule 09.10.2014


Ответы (1)


Это может быть давно назрело, но я должен был подготовить ответ.

@AlainCollins прокомментировал:

..как определяется команда check_nrpe?

define command{
  command_name    check_nrpe
  command_line    /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$
}

Выше приведена базовая команда check_nrpe. Проблема, с которой вы столкнулись, заключается в том, что вы пытаетесь запустить определенные команды из nrpe.cfg, которые не требуют аргументов. Когда вы определяете команду, $ARG2$ в приведенном выше определении команды NRPE находится там, где '-a' получает свое значение. Таким образом, если вы указываете первый аргумент '-c' в качестве команды check_disk, она не получает значение для $ARG2$.

Чтобы решить эту проблему, у вас есть 2 варианта:

1) Добавьте заполнитель "!" в определение Дисковое пространство check_command после аргумента команды:

define service{
  use                   generic-service
  host_name             192.168.160.10, 192.168.160.11, 192.168.160.12
  service_description   Disk Space
  notification_options w,u,c,r
  check_command         check_nrpe!check_disk!
}

2) Используйте команду «check_nrpe_1arg», указанную в /etc/nagios-plugins/config/check_nrpe.cfg — эта команда предназначена для плагинов, не требующих аргументов, и может использоваться так же, как и обычная команда check_nrpe. :

define command{ 
  command_name check_nrpe_1arg
  command_line /usr/lib64/nagios/plugins/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

nagios

person lgroschen    schedule 05.01.2017