Projet

Général

Profil

NRPE » Historique » Révision 18

Révision 17 (Patrice Nadeau, 2017-06-01 18:09) → Révision 18/39 (Patrice Nadeau, 2017-07-27 16:45)

h1. Nagios Remote Plugin Executor 

 > https://exchange.nagios.org/directory/Addons/Monitoring-Agents/NRPE--2D-Nagios-Remote-Plugin-Executor/details 

 Ce « add-on » se divise en deux parties 
 * Le « plugin » _check_nrpe_ qui roule sur le serveur Nagios pour exécuter les vérifications sur des machines distantes. 
 * Le deamon _nrpe_ qui roule comme agent sur la machine sous surveillance 

 {{TOC}} 

 h2. Prérequis 

 <pre><code class="bash"> 
 zypper install make gcc libopenssl-devel 
 # Remove if already installed with the OS 
 zypper remove nrpe 
 # Remove the one installed from source 
 
  /usr/local/nagios/bin/nrpe-uninstall all 
 </code></pre> 

 

 h2. Création de l'usager 

 <pre><code class="bash"> 
 useradd nagios 
 groupadd nagcmd 
 /usr/sbin/groupadd nagios 
 usermod -a -G nagcmd nagios 
 usermod -a -G nagios nagios 
 </code></pre> 

 h2. Téléchargement 

 <pre><code class="bash"> 
 mkdir ~/tmp 
 cd ~/tmp 
 wget https://github.com/NagiosEnterprises/nrpe/archive/nrpe-3.1.0.tar.gz 
 # Décompresse le fichier 
 tar xvf nrpe-3.1.0.tar.gz 
 cd nrpe-nrpe-3.1.0 
 </code></pre> 

 h2. check_nrpe 

 <pre><code class="bash"> 
 # openSUSE 
 ./configure 
 # Debian/Ubuntu 
 ./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/arm-linux-gnueabihf 
 # All Linux 
 make clean 
 make check_nrpe 
 make install-plugin 
 </code></pre> 

 Un fois compilés, les exécutables ne sont pas copiés au bons endroits. On doit donc le faire manuellement. 

 <pre><code class="bash"> 
 # openSUSE 
 mkdir -p /usr/local/nagios/libexec 
 cp src/check_nrpe /usr/local/nagios/libexec 
 cp sample-config/nrpe.cfg /etc 
 # Debian/Ubuntu 
 sudo cp src/check_nrpe /usr/local/nagios/libexec 
 cp sample-config/nrpe.cfg /etc 
 </code></pre> 

 h2. nrpe 

 <pre><code class="bash"> 
 # openSUSE 
 ./configure --enable-command-args 
 # All Linux 
 make clean 
 make nrpe 
 make install-daemon 
 make install-config 
 make install-init 
 systemctl enable nrpe.service 
 systemctl start nrpe.service 
 </code></pre> 

 Ouvrir dans le pare-feu (yast firewall) le port *TCP 5666* 

 Éditer le fichier */etc/nrpe.cfg* et modifier les lignes suivantes : 
 <pre><code class="text"> 
 # Add Nagios server (IP or FQDN) 
 allowed_hosts=127.0.0.1,::1 
 # Permit Remote execution 
 dont_blame_nrpe=1 
 </code></pre>