Utilisation de NRPE pour monitorer des serveurs avec Nagios PDF Imprimer Envoyer
Note des utilisateurs: / 4
MauvaisTrès bien 
Écrit par Xavier   
Dimanche, 16 Mars 2008 18:36

1) Installation et configuration du serveur NRPE sur Debian Etch 4

Trés bon tutoriel : http://blog.lolo.org/?p=11

Téléchargement sur le site de Nagios de NRPE 2.12

tar xzf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure -disable-ssl
make all
make install-plugin
make install-daemon
make install-daemon-config

Je n'ai pas réussi à faire fonctionner nrpe avec xinet.d -> création d'un nrpe.sh dans etc/init.d
Les droits dont du genre 755 avec comme user/groupe : root/root

#! /bin/sh
#
# skeleton example file to build /etc/init.d/ scripts.
# This file should be used to construct scripts for /etc/init.d.
#
# Written by Miquel van Smoorenburg .
# Modified for Debian
# by Ian Murdock .
#
# Version: @(#)skeleton 1.9 26-Feb-2001 miquels at cistron.nl
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/nagios/bin/nrpe
NAME=nrpe
DESC=nrpe
CONFIG=/usr/local/nagios/etc/nrpe.cfg

test -x $DAEMON || exit 0

# Include nagios-nrpe defaults if available
if [ -f /etc/default/nagios-nrpe ] ; then
. /etc/default/nagios-nrpe
fi

set -e

case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet \
--exec $DAEMON -- -c $CONFIG -d $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --oknodo \
--exec $DAEMON
echo "$NAME."
;;
#reload)
#
# If the daemon can reload its config files on the fly
# for example by sending it SIGHUP, do it here.
#
# If the daemon responds to changes in its config file
# directly anyway, make this a do-nothing entry.
#
# echo "Reloading $DESC configuration files."
# start-stop-daemon --stop --signal 1 --quiet --pidfile \
# /var/run/$NAME.pid --exec $DAEMON
#;;
restart|force-reload)
#
# If the "reload" option is implemented, move the "force-reload"
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart".
#
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --oknodo \
--exec $DAEMON
sleep 1
start-stop-daemon --start --quiet \
--exec $DAEMON -- -c $CONFIG -d $DAEMON_OPTS
echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac

exit 0

Puis ajouter nrpe au démarrage :

update-rc.d nrpe defaults 99

Puis configurer nrpe.cfg dans /usr/local/nagios/etc

server_address=IP locale

allowed_hosts=127.0.0.1,IP du serveur Nagios, IP locale

Il faut aussi ajouter le service nrpe/tcp dans le fichier /etc/services

nrpe 5666/tcp

Et lancer le service :

/etc/init.d nrpe start

S'il démarre correctement, 2 vérifications :

netstat -at | grep nrpe

et

/usr/local/nagios/libexec/check_nrpe -H localhost

Et normalement tout doit rouler après.

2) Installation et configuration du client NRPE

  • Sur un serveur Windows 2003

Télécharger NRPE for windows

http://www.nagiosexchange.org/Windows.49.0.html?&tx_netnagext_pi1[p_view]=1156

Package tout prêt.

Une fois installé, en ligne de commande désinstaller le service pour désactiver ssl.

Dans C:\Program Files\Nagios NRPE Agent\bin

nrpe_nt.exe -u

puis

nrpe_nt.exe -i -n

Configurer nrpe.cfg

allowed_hosts=IP du serveur Nagios

configurer vos commandes

command[pdm_disk_c]=check_pdm.exe --disk --drive C: -w 90 -c 95
command[pdm_disk_d]=check_pdm.exe --disk --drive D: -w 90 -c 95
command[pdm_cpuload]=check_pdm.exe --processor -w 50 -c 80
command[pdm_memload]=check_pdm.exe --memory -w 95 -c 99

J'ai trouvé un site avec d'autres commandes bien utiles :

http://www.itefix.no/phpws/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=58&MMN_position=157:157

Notamment : check_ad, check_dell

Il suffit de placer l'éxécutable dans bin, d'ajouter des lignes de commandes dans nrpe.cfg du serveur windows et de créer des services type check_nrpe avec comme argument !check_ad dans Centreon et de relancer les services Nagios.

Créér la commande sur centreoon :

define command {
command_name CHECK_NRPE
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}

Et le service correspondant : par exemple pdm_disk_c qui lance check_nrpe et en argument !pdm_disk_c


  • Sur un serveur Debian distant

Création user nagios

/usr/sbin/useradd nagios
passwd nagios
/usr/sbin/groupadd nagios
/usr/sbin/usermod -G nagios nagios

Installations des plugins nagios

wget http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install

Puis voir 1) pour l'installation de NRPE

  • Sur un serveur Red Hat

Pareil que sur le debian distant sauf :

Ajout su service au démarrage de la machine

Relance de service :

/sbin/service nrpe restart

et le fichier nrpe dans init.d

#!/bin/bash
##
##### Script for running daemon nrpe for nagios
##### Created By dreamnelphe
##
DIR=/usr/local/nagios
DAEMON=$DIR/bin/nrpe
CONF=$DIR/etc/nrpe.cfg
DAEMONARG1=-c
DAEMONARG2=-d
PIDFILE=/var/run/nrpe.pid
test -x $DAEMON || exit 0
test -d $CONFIG_DIR || exit 0
case "$1" in
start)
echo -n "Starting nrpe pour nagios : "
$DAEMON $DAEMONARG1 $CONF $DAEMONARG2
echo "Done."
;;
stop)
echo -n "Stopping nrpe for nagios : "
PID=`cat $PIDFILE`
kill $PID
rm $PIDFILE
echo "Done."
;;
restart)
echo "Restarting nrpe for nagios : "
echo ""
sh $0 stop
sh $0 start
echo ""
echo "nrpe for nagios has restarted."
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 1
;;
esac
exit 0

3) Utilisation de scripts perl

Check MSMSQL

http://www.nagiosexchange.org/Others.152.0.html?&tx_netnagext_pi1[p_view]=434

Check Exchange avec NSClient

http://nagioswiki.com/wiki/index.php/Nagios_Checks_for_Exchange_Server_200x

 

To be continued..

Mise à jour le Mercredi, 08 Septembre 2010 08:56
 

Commentaires 

 
0 #1 semiramida 01-08-2011 15:46
This is the most informed writing I’ve ever seen on this subject.
Citer
 

Ajouter un Commentaire


Code de sécurité
Rafraîchir