Перейти к содержимому
Калькуляторы

Nagios и nrpe проблема с настройкой nrpe

Доброго времени суток.

 

У меня возникла проблема с настройкой плагина nrpe c сервером nagios 3v.

Суть проблемы есть сервер Debian 6.0.5 с настроенным и работающим nagios, но нужно мониторить сервер СentOS с asteriks на борту на доступ к шлюзу.

Вроде все настроено как полагается,плагин nrpe 2.13.

Hо при запуске команды для проверки на сервере с nagios /usr/local/nagios/libexec/check_nrpe -H 192.168.12.253 -p5666 -c check_ping -H 172.0.5.1

CHECK_NRPE: Socket timeout after 10 seconds.

 

в iptables вот такие записи:

 

Chain INPUT (policy ACCEPT)

target prot opt source destination

fail2ban-BadBots tcp -- anywhere anywhere multiport dports http,https

fail2ban-FTP tcp -- anywhere anywhere tcp dpt:ftp

fail2ban-PBX-GUI tcp -- anywhere anywhere

fail2ban-SIP all -- anywhere anywhere

fail2ban-SSH tcp -- anywhere anywhere tcp dpt:ssh

 

Chain FORWARD (policy ACCEPT)

target prot opt source destination

 

Chain OUTPUT (policy ACCEPT)

target prot opt source destination

 

Chain fail2ban-BadBots (1 references)

target prot opt source destination

RETURN all -- anywhere anywhere

 

Chain fail2ban-FTP (1 references)

target prot opt source destination

RETURN all -- anywhere anywhere

 

Chain fail2ban-PBX-GUI (1 references)

target prot opt source destination

RETURN all -- anywhere anywhere

 

Chain fail2ban-SIP (1 references)

target prot opt source destination

RETURN all -- anywhere anywhere

 

Chain fail2ban-SSH (1 references)

target prot opt source destination

RETURN all -- anywhere anywhere

 

 

Содержание nrpe.cfg

#############################################################################
# NRPE Config File for Opsview
# 
# NOTES:
# It needs to be located on the remote host that is running the NRPE 
# daemon, not the host from which the check_nrpe client is being executed.
#############################################################################


# PID FILE
# The name of the file in which the NRPE daemon should write it's process ID
# number.  The file is only written if the NRPE daemon is started by the root
# user and is running in standalone mode.

pid_file=/usr/local/nagios/var/nrpe.pid



# PORT NUMBER
# Port number we should wait for connections on.
# NOTE: This must be a non-priviledged port (i.e. > 1024).
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

server_port=5666



# SERVER ADDRESS
# Address that nrpe should bind to in case there are more than one interface
# and you do not want nrpe to bind on all interfaces.
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd




# NRPE USER
# This determines the effective user that the NRPE daemon should run as.  
# You can either supply a username or a UID.
# 
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

nrpe_user=nagios



# NRPE GROUP
# This determines the effective group that the NRPE daemon should run as.  
# You can either supply a group name or a GID.
# 
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

nrpe_group=nagios

allowed_hosts=172.16.124.99

# COMMAND ARGUMENT PROCESSING
# This option determines whether or not the NRPE daemon will allow clients
# to specify arguments to commands that are executed.  This option only works
# if the daemon was configured with the --enable-command-args configure script
# option.  
#
# *** ENABLING THIS OPTION IS A SECURITY RISK! *** 
# Read the SECURITY file for information on some of the security implications
# of enabling this variable.
#
# Values: 0=do not allow arguments, 1=allow command arguments

dont_blame_nrpe=0



# 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

debug=0



# COMMAND TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# allow plugins to finish executing before killing them off.

command_timeout=60



# WEEK RANDOM SEED OPTION
# This directive allows you to use SSL even if your system does not have
# a /dev/random or /dev/urandom (on purpose or because the necessary patches
# were not applied). The random number generator will be seeded from a file
# which is either a file pointed to by the environment valiable $RANDFILE
# or $HOME/.rnd. If neither exists, the pseudo random number generator will
# be initialized and a warning will be issued.
# Values: 0=only seed from /dev/[u]random, 1=also seed from weak randomness

#allow_weak_random_seed=1



# INCLUDE CONFIG FILE
# This directive allows you to include definitions from an external config file.

#include=<somefile.cfg>



# INCLUDE CONFIG DIRECTORY
# This directive allows you to include definitions from config files (with a
# .cfg extension) in one or more directories (with recursion).

#include_dir=<somedirectory>
#include_dir=<someotherdirectory>



# BASIC COMMAND DEFINITIONS
# NOTE: additional command definitions should be put into a file in 
# 	/usr/local/nagios/etc/local/<config>.cfg
# with checks in
# 	/usr/local/nagios/libexec/local/xxx
#
# All entries should be in the following form

command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$
command[check_load]=/usr/local/nagios/libexec/check_load $ARG1$
command[check_disk]=/usr/local/nagios/libexec/check_disk $ARG1$
command[check_swap]=/usr/local/nagios/libexec/check_swap $ARG1$
command[check_procs]=/usr/local/nagios/libexec/check_procs $ARG1$
command[check_memory]=/usr/local/nagios/libexec/check_memory $ARG1$
command[check_file_age]=/usr/local/nagios/libexec/check_file_age $ARG1$
command[check_mailq]=/usr/local/nagios/libexec/check_mailq $ARG1$
command[check_hpjd]=/usr/local/nagios/libexec/check_hpjd $ARG1$
command[check_ntp]=/usr/local/nagios/libexec/check_ntp $ARG1$
command[check_snmp]=/usr/local/nagios/libexec/check_snmp $ARG1$
command[check_time]=/usr/local/nagios/libexec/check_time $ARG1$
command[check_tcp]=/usr/local/nagios/libexec/check_tcp $ARG1$
command[check_ping]=/usr/local/nagios/libexec/check_ping -H $HOSTADDRESS$

# Additional configuration files for local modifications
include_dir=/usr/local/nagios/etc/nrpe_local



 

Содержание nrpe

# default: on
# description: NRPE (Nagios Remote Plugin Executor)
service nrpe
{
      	flags           = REUSE
       socket_type     = stream    
port		= 5666   
      	wait            = no
       user            = nagios
group		= nagios
      	server          = /usr/local/nagios/bin/nrpe
       server_args     = -c /usr/local/nagios/etc/nrpe.cfg --inetd
      	log_on_failure  += USERID
       disable         = no
only_from       = 172.16.124.99
nrpe 		5666/tcp 
}

 

 

Подскажите что такое может быть? Может я просто элементарной ошибки не вижу?

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

А в логах что?в конфиге добавьте server_address=IP_машины где nrpe сервер. 172.16.124.99- тачка с nagios?

Изменено пользователем roysbike

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Вы неверно понимаете принцип работы nrpe.

В этой строке

/usr/local/nagios/libexec/check_nrpe -H 192.168.12.253 -p5666 -c check_ping -H 172.0.5.1

у вас два ключа '-H'. Второй применяется к check_nrpe, а не к check_ping как вы хотите. В итоге второй перебивает первый и nagios пытается подключиться к 172.0.5.1, а не к 192.168.12.253 как вы хотите. Можете tcpdump'ом проверить.

 

Аргументы команды передаются на удаленный сервер с nrpe через ключ '-a', но у вас в конфиге nrpe обработка аргументов запрещена, ибо это небезопасно, о чем и говорится CapsLock'ом

# *** ENABLING THIS OPTION IS A SECURITY RISK! ***

# Read the SECURITY file for information on some of the security implications

# of enabling this variable.

#

# Values: 0=do not allow arguments, 1=allow command arguments

 

dont_blame_nrpe=0

 

в общем я советую сделать так:

1) На сервере с nagios использовать команду

check_nrpe -H 192.168.12.253 -p5666 -c check_gateway

2) На сервере с nrpe прописать в конфиге

command[check_gateway]=/usr/local/nagios/libexec/check_ping -H 172.0.5.1

Поделиться сообщением


Ссылка на сообщение
Поделиться на других сайтах

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

×   Вставлено в виде отформатированного текста.   Вставить в виде обычного текста

  Разрешено не более 75 смайлов.

×   Ваша ссылка была автоматически встроена.   Отобразить как ссылку

×   Ваш предыдущий контент был восстановлен.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.