Centos 5.3 + Nagios

Sziasztok,

egy nagios-os problemaval szeretnem a velemenyetek+segitsegetek kerni. Mar minden forumot, how-tot vegig olvastam amit tudtam, es mar kezd nagyon zoldulni a fejem meg mindig nincs meg a megoldas.
Diohejban: egy centos 5.3-an futo nagios szerverrel szeretnek, 10-15 masik centos 5.3 es rhel 5 szervert monitorozni, nrpe-vel par alap szolgaltatast, semmi extra. (disk usage, swap, ssh, stb) Epitettem egy virtual (vmware) centos 5.3-at monitorozni a nagios szerveremmel, kitapasztalni, es beallitani a konfigokat, megdolgoztam vele, de popeccul megy minden, pont ahogy akarom.
Sajnos az eles szervereken ez nem igy megy. Probaltam mindent ugy csinalni ahogy a teszt szerveren, de az osszes nrpe alapu check-ekket elhajtja, azzal hogy "NRPE: Unable to read output ". A webes feluleten pedig vagy warning vagy unkown statuszu. Vegig zongoraztam parszor, nem a szokasos xinetd para, hogy hogy ssl_hanshake blabla.(hozzateszem, nem xinetd demon kezeli, hanem dedikaltam egy kulon processzt neki, a log szerint akapcsolat letre is jon koztuk.) Tuzfalon termeszetesen atmegy, telnetezni is tudok az 5666-os porton rajuk, a teszt check_nrpe plugin is mukodik, odavissza megkapom a nagios verzio szamot. Forumok szerint, a jogosultsagok miatt, kaphatom ezt az uzenetet, de a teszt szerverem ami szinten ugyanaz az oprednszer, ugyanazokkal a beallitasokkal, mukodik!!! es ha az osszes nrpe file-t (/etc/nagios/nrpe.cfg /usr/lib/nagios/plugin/check_nrpe) a nagiosnak adom chownal es chgrp-al akkor is marad a hiba jelenseg. Ha a nrpe.cfg-t debug modra allitom, akkor se dob nekem semmi tobb infot..
Merre induljak, miket csekkoljak? total begolyozok mar tole:))))

koszi elore is ha tudtok nekem valamit mondani

udv
Jack

Hozzászólások

Ha azon a szerveren futtatod le az nrpe plugin-t amirol szeretnel infot kapni kapsz valamit? Probald meg root-kent is, es nagios felhasznalokent.
Ha check_nrpe visszaadja a verzioszamot, akkor a nagios szerver ok, valamint a kapcsolat is ok, tehat az nrpe pluginok nem akarnak valahogy lefutni. Valoszinuleg jogosultsagi gond lesz, de lehet hogy az nrpe configjaban vannak a parancsok rosszul megadva (pl rossz helyre mutat).

-------------------------------
“The 0 in Raid 0 stands for how many files you’re going to get back if something goes wrong” :)

Olvastam, már hogy odaadtad a nagiosnak, de esetleg?

chgrp nagios /usr/local/nagios/libexec/*
chmod 4750 /usr/local/nagios/libexec/*

Én akkor kaptam ilyet, ha tényleg nem volt jogom a távoli gépen root joghoz kötött plugint futtatni. Például a check_smart ilyen. Ezt a suoders-el tudod megoldani.

ilyen nekem nincs, gondolom ez is jo:
chgrp nagios /usr/lib/nagios/*
chmod 4750 /usr/lib/nagios/*

de ez mar megvan.

szoval akkor a tavoli gep, sudoerrs file-jaban kell turkalnom? igazabol mar ezt is nezegettem, de kicsit feltem hozza, nyulni, pontosan akkor mit is kell ott es kinek adni?

Akkor ott vannak a pluginek abban a könyvtárban amit belinkeltél? Pontosan milyen nrpe parancsot szerettél volna futtatni a távoli gép monitorozására?
Ha az Nrpe.cfg-t belinkelnéd akkor többet lehetne mondani.

visudo majd:

nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_ide_smart /vagy az amit szeretnél/

hat egyik nrpe-t hasznalo pluginom se mukodik :
ezeket a parancsokat a nagios szerverrol adtam ki, a monitorozando szerver ip-jevel:

[root@nagios ~]# /usr/lib/nagios/plugins/check_nrpe -H 192.168.x.xxx
NRPE v2.12
[root@nagios ~]# /usr/lib/nagios/plugins/check_nrpe -H 192.168.x.xxx -c check_disk
NRPE: Unable to read output
[root@nagios ~]# /usr/lib/nagios/plugins/check_nrpe -H 192.168.x.xxx -c check_swap
NRPE: Unable to read output

ez pedig a monitorozando szerver nrpe.cfg-je (ugye az kell, es nem a nagios szerver nrpe.cfg-je?)

[root@lsc ~]# more /etc/nagios/nrpe.cfg
#############################################################################
# Sample NRPE Config File
# Written by: Ethan Galstad (nagios@nagios.org)
#
# Last Modified: 11-23-2007
#
# NOTES:
# This is a sample configuration file for the NRPE daemon. 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.
#############################################################################

# LOG FACILITY
# The syslog facility that should be used for logging purposes.

log_facility=daemon

# 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=/var/run/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

#server_address=127.0.0.1

# 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 HOST ADDRESSES
# This is an optional comma-delimited list of IP address or hostnames
# that are allowed to talk to the NRPE daemon.
#
# Note: The daemon only does rudimentary checking of the client's IP
# address. I would highly recommend adding entries in your /etc/hosts.allow
# file to allow only the specified host to connect to the port
# you are running this daemon on.
#
# NOTE: This option is ignored if NRPE is running under either inetd or xinetd

allowed_hosts=127.0.0.1,172.17.x.xxx #(nagios szerver cime)

# 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=1

# 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

# CONNECTION TIMEOUT
# This specifies the maximum number of seconds that the NRPE daemon will
# wait for a connection to be established before exiting. This is sometimes
# seen where a network problem stops the SSL being established even though
# all network sessions are connected. This causes the nrpe daemons to
# accumulate, eating system resources. Do not set this too low.

connection_timeout=300

# 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=

# 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=
#include_dir=

# COMMAND DEFINITIONS
# Command definitions that this daemon will run. Definitions
# are in the following format:
#
# command[]=
#
# When the daemon receives a request to return the results of
# it will execute the command specified by the argument.
#
# Unlike Nagios, the command line cannot contain macros - it must be
# typed exactly as it should be executed.
#
# Note: Any plugins that are used in the command lines must reside
# on the machine that this daemon is running on! The examples below
# assume that you have plugins installed in a /usr/local/nagios/libexec
# directory. Also note that you will have to modify the definitions below
# to match the argument format the plugins expect. Remember, these are
# examples only!

# The following examples use hardcoded command arguments...

command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200

###########OWN CONFIG###########################
command[check_disk]=sudo /usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda2
command[check_swap]=sudo /usr/lib/nagios/plugins/check_swap -w 20% -c 10%

# The following examples allow user-supplied arguments and can
# only be used if the NRPE daemon was compiled with support for
# command arguments *AND* the dont_blame_nrpe directive in this
# config file is set to '1'. This poses a potential security risk, so
# make sure you read the SECURITY file before doing this.

#command[check_users]=/usr/lib/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
#command[check_load]=/usr/lib/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
#command[check_disk]=/usr/lib/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
#command[check_procs]=/usr/lib/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$

kezdek total megorulni ettol:))

a nagios pluginok (/usr/lib/nagios/plugins) es az nrpe config file (/etc/nagios/nrpe.cfg) a nagios user-e es a nagios csoporte is, mind a nagios szerveren mind a monitorozando hoszton.
a sudoers fileban mind a nagios szerveren mind a monitorozando hoszton meg van adva hogy :

nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/

es megse megy:(((
mi lehet meg a gond???

Mire kell figyelni?

A távoli gépen a kérdéses pluginok lefutnak-e. (nagios userrel, roottal, bárhogy)
Engedélyezed az nrpe configban, hogy a nagiost futtató gép kapcsolódjon hozzá?
az nrpe confban én beállítottam az összes futtatndó plugint, így opciók nélkül futtatható a szerveren
újraindítottad az nrpe-t a helyes config megadása után?

KAMI | 神
--
Támogatás | OxygenOffice | Fordításaim és SeaMonkey

a monitorozando, remote host-on a parancsok:

rootkent localhost check:
[root@lsc ~]# /usr/lib/nagios/plugins/check_nrpe -H localhost
NRPE v2.12

rootkent disk check, ami a nrpe configba bevan allitva (ellenkezo esetbe command not defined hibat kapnek nem?)
[root@lscp ~]# /usr/lib/nagios/plugins/check_nrpe -H localhost -c check_disk
NRPE: Unable to read output

tehat mar a root-al SE megy ez !!

az nrpe.cfg-ben pedig igy van megadva ez a sor:

command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/sda2 (ami egy LVM diszk egyebkent)

itt ha sudo van a parancs elott, akkor warningot jelezz a grafikus feluleten (persze marad az NRPE: Unable to read output), ha kiveszem a sudo-t visszarakja siman unkown-ra

nagios userrel a monitorozando, remote host-on pontosan ezt kapom, tehat a check_nrpe localhostra lefut, de a check disk mar nem.

Ha ugyanezeket a parancsokat nem localhost-tal futtatom, hanem a nagios szerver ip-jevel, akkor mindent rendben visszakapok. (nagios szerveren is bevan allitba minden ami nrpe-s csomag)

mindketto 32 bites oprendszer
a nagios szerver (centos 5.3 final):
[root@nagios ~]# uname -a
Linux nagios 2.6.18-128.el5 #1 SMP Wed Jan 21 10:44:23 EST 2009 i686 athlon i386 GNU/Linux

a monitorozando host (centos 5.2 final):
[root@lsc ~]# uname -a
Linux lsc 2.6.18-92.1.18.el5 #1 SMP Wed Nov 12 09:30:27 EST 2008 i686 i686 i386 GNU/Linux

most kozben odavissza tolom a plugin csekkeket. A check_nrpe MINDEN esetben lefut, tehat ha nagios szerverol inditom a monitorozando host fele, es vissza fele is, tehat a monitorozandorol inditva a nagios szerver fele, root es nagios userrel is.
Ha hozza rakom a chech_nrpe -H 192.168.x.xxx -c check_disk kiegeszitest akkor jonnek a gondok.
Ha a nagios szerverrol inditom a remote host ip-jevel akkor ELUTASIT. Ha a remote hoston inditom localhostal, akkor is ELUTASIT.

MUKOOOOODIKKKKKKKKK!!!!!

Nagyon koszonom mindegyikototoknek, a kereszt kerdeseitek rakenyszeritett hogy vegig nezzek mindent egyessevel es megvan a hiba!!! Megiscsak en rontottam el es nem a nagios a hulye:)))
Nem is merem elmondani mit, mert olyan kis hulyeseg volt!!!

Most egy szerver kesz, epitem ki a tobbire a cuccot, remelem nem kell ide irnom tobbet ebben a temaban:)
Megegyszer nagyon koszi mindenkinek, okosabb lettem sokkal!!

udv
Jack

ez meg annal is durvabb..

najo.. szoval kisse kavaros volt a fejemben ez az nrpe cucc, marmint hogy melyik oldalon milyen szolgaltatasnak kell futnia. Tesztgepen mindig minden csomagot felraktam, de az eles szervereken probaltam csak ami feltetlen szukseges. Na mar most nemes egyszeruseggel, lemaradttak az ellenorzo pluginok a remote host-on csak maga az check_nrpe plugin volt fent..., mivel fejemben ugy allt ossze, hogy az nrpe_check atdobja a nagios szerverre es eleg ott lennie a pluginnak fent.

Szoval ennyi, de megtanultam rendesen most, ughogy big thx mindenkinek:))

Olyan durva, hogy szohoz sem juttok mar? :D

Ha mar igy belejottunk, egy elmeleti kerdesem lenne meg, ha nem haragszotok meg erte.
Ezt mar megoldottam, csak erdekel hogyan is mukodik ez.
Szoval mikor eloszor felraktam az nrpe plugint, es beallitottam neki az 5666-os az /etc/service-s -ben, majd pedig belottem a /etc/xinet.d/nrpe configban a szukseges dolgokat. Igen am, de ez sehogyan se mukodott, barmit is csinaltam, ssl handshake error-t kaptam. Kis utan guglizassal, vilagossa valt, egyik leggyakoribb problema, es mik lehetnek az okai.
3 napot gyurtem, minden lehetseges gugli talalatott vegig probaltam, de semmi. Aztan vegul xinetd kikerulve, a etc/xinet.d/nrpe config filet egyszeruen torolve, majd pedig /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d paranccsal, kikerulve a szuperdemont, sajat demont kapott, varlogmessageben jol lathato volt, hogy kapcsolodtak.
Ezek utan szuperrul ment minden, es megy is.
Annyi lenne csak a kerdes, hogy ez jo megoldas e, mik az elonyei es hatranyai a xinetd hasznalatanak?