From source » Historique » Version 84
  Patrice Nadeau, 2016-09-10 10:44 
  
| 1 | 18 | Patrice Nadeau | {{TOC}} | 
|---|---|---|---|
| 2 | |||
| 3 | 25 | Patrice Nadeau | h1. Installation à partir des sources  | 
| 4 | 1 | Patrice Nadeau | |
| 5 | 7 | Patrice Nadeau | L'installation à partir des sources permet  | 
| 6 | 6 | Patrice Nadeau | * d'avoir la version la plus récente  | 
| 7 | 78 | Patrice Nadeau | * n'est pas relier à une plate-forme spécifique (i686 vs x86_64 vs ARM)  | 
| 8 | 6 | Patrice Nadeau | |
| 9 | 1 | Patrice Nadeau | h2. Prérequis  | 
| 10 | 78 | Patrice Nadeau | |
| 11 | h3. Un serveur web fonctionnel  | 
||
| 12 | |||
| 13 | > Apache est utilisé dans ce document  | 
||
| 14 | 1 | Patrice Nadeau | |
| 15 | 79 | Patrice Nadeau | h3. Outils et librairies de développement  | 
| 16 | |||
| 17 | 45 | Patrice Nadeau | Installer les utilitaires pour la compilation et la librairie de développement SSL:  | 
| 18 | 35 | Patrice Nadeau | |
| 19 | openSUSE :  | 
||
| 20 | 5 | Patrice Nadeau | <pre><code class="bash">  | 
| 21 | 45 | Patrice Nadeau | zypper install make gcc libopenssl-devel  | 
| 22 | 35 | Patrice Nadeau | </code></pre>  | 
| 23 | |||
| 24 | 36 | Patrice Nadeau | Ubuntu/Debian :  | 
| 25 | 35 | Patrice Nadeau | <pre><code class="bash">  | 
| 26 | 47 | Patrice Nadeau | sudo apt-get install make gcc libssl-dev  | 
| 27 | 5 | Patrice Nadeau | </code></pre>  | 
| 28 | 4 | Patrice Nadeau | |
| 29 | 9 | Patrice Nadeau | h2. Fichiers  | 
| 30 | |||
| 31 | 74 | Patrice Nadeau | > Les dernières versions sont disponibles au  | 
| 32 | * https://www.nagios.org/downloads/core-stay-informed/  | 
||
| 33 | * https://www.nagios.org/downloads/nagios-plugins/  | 
||
| 34 | 72 | Patrice Nadeau | |
| 35 | 2 | Patrice Nadeau | Télécharger  | 
| 36 | 1 | Patrice Nadeau | <pre><code class="bash">  | 
| 37 | mkdir ~/tmp  | 
||
| 38 | cd ~/tmp  | 
||
| 39 | 73 | Patrice Nadeau | wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.2.1.tar.gz  | 
| 40 | 74 | Patrice Nadeau | wget https://nagios-plugins.org/download/nagios-plugins-2.1.2.tar.gz  | 
| 41 | 3 | Patrice Nadeau | </code></pre>  | 
| 42 | 1 | Patrice Nadeau | |
| 43 | 9 | Patrice Nadeau | h2. Création de l'usager et groupe  | 
| 44 | |||
| 45 | 37 | Patrice Nadeau | openSUSE :  | 
| 46 | 3 | Patrice Nadeau | <pre><code class="bash">  | 
| 47 | useradd nagios  | 
||
| 48 | groupadd nagcmd  | 
||
| 49 | 11 | Patrice Nadeau | /usr/sbin/groupadd nagios  | 
| 50 | 1 | Patrice Nadeau | usermod -a -G nagcmd nagios  | 
| 51 | 11 | Patrice Nadeau | usermod -a -G nagios nagios  | 
| 52 | 24 | Patrice Nadeau | # Permet de soumettre des check via l'interface web  | 
| 53 | usermod -a -G nagcmd wwwrun  | 
||
| 54 | 65 | Patrice Nadeau | usermod -a -G nagios wwwrun  | 
| 55 | 37 | Patrice Nadeau | </code></pre>  | 
| 56 | |||
| 57 | Debian/Ubuntu :  | 
||
| 58 | <pre><code class="bash">  | 
||
| 59 | sudo useradd nagios  | 
||
| 60 | sudo groupadd nagcmd  | 
||
| 61 | sudo /usr/sbin/groupadd nagios  | 
||
| 62 | sudo usermod -a -G nagcmd nagios  | 
||
| 63 | sudo usermod -a -G nagios nagios  | 
||
| 64 | # Permet de soumettre des check via l'interface web  | 
||
| 65 | 1 | Patrice Nadeau | sudo usermod -a -G nagcmd www-data  | 
| 66 | 65 | Patrice Nadeau | sudo usermod -a -G nagios www-data  | 
| 67 | 9 | Patrice Nadeau | </code></pre>  | 
| 68 | |||
| 69 | 17 | Patrice Nadeau | h2. Nagios Core  | 
| 70 | |||
| 71 | h3. Compilation  | 
||
| 72 | 1 | Patrice Nadeau | |
| 73 | 9 | Patrice Nadeau | <pre><code class="bash">  | 
| 74 | 75 | Patrice Nadeau | tar xvf nagios-4.2.1.tar.gz  | 
| 75 | cd ~/tmp/nagios-4.2.1  | 
||
| 76 | 9 | Patrice Nadeau | ./configure --with-command-group=nagcmd  | 
| 77 | make all  | 
||
| 78 | 39 | Patrice Nadeau | </code></pre>  | 
| 79 | |||
| 80 | 76 | Patrice Nadeau | h3. Installation  | 
| 81 | 39 | Patrice Nadeau | |
| 82 | <pre><code class="bash">  | 
||
| 83 | sudo make install  | 
||
| 84 | sudo make install-init  | 
||
| 85 | sudo make install-commandmode  | 
||
| 86 | sudo make install-config  | 
||
| 87 | 77 | Patrice Nadeau | sudo make install-html  | 
| 88 | 3 | Patrice Nadeau | </code></pre>  | 
| 89 | 14 | Patrice Nadeau | |
| 90 | 19 | Patrice Nadeau | h3. Configuration de l'usager web  | 
| 91 | 14 | Patrice Nadeau | |
| 92 | 41 | Patrice Nadeau | openSUSE :  | 
| 93 | 14 | Patrice Nadeau | <pre><code class="bash">  | 
| 94 | htpasswd2 -c /usr/local/nagios/etc/htpasswd.users nagiosadmin  | 
||
| 95 | 80 | Patrice Nadeau | systemctl restart apache2.service  | 
| 96 | 41 | Patrice Nadeau | </code></pre>  | 
| 97 | |||
| 98 | Ubuntu/Debian :  | 
||
| 99 | <pre><code class="bash">  | 
||
| 100 | sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin  | 
||
| 101 | sudo systemctl restart apache2.service  | 
||
| 102 | 14 | Patrice Nadeau | </code></pre>  | 
| 103 | 16 | Patrice Nadeau | |
| 104 | 22 | Patrice Nadeau | h2. Nagios Plugins  | 
| 105 | |||
| 106 | h3. Compilation  | 
||
| 107 | |||
| 108 | <pre><code class="bash">  | 
||
| 109 | 43 | Patrice Nadeau | cd ~/tmp  | 
| 110 | 81 | Patrice Nadeau | tar xvf nagios-plugins-2.1.2.tar.gz  | 
| 111 | 82 | Patrice Nadeau | cd nagios-plugins-2.1.2  | 
| 112 | 1 | Patrice Nadeau | ./configure --with-nagios-user=nagios --with-nagios-group=nagios  | 
| 113 | 43 | Patrice Nadeau | make  | 
| 114 | sudo make install  | 
||
| 115 | 22 | Patrice Nadeau | </code></pre>  | 
| 116 | |||
| 117 | 26 | Patrice Nadeau | h2. Nagios Remote Plugin Executor  | 
| 118 | |||
| 119 | 83 | Patrice Nadeau | > https://exchange.nagios.org/directory/Addons/Monitoring-Agents/NRPE--2D-Nagios-Remote-Plugin-Executor/details  | 
| 120 | |||
| 121 | 29 | Patrice Nadeau | Ce « add-on » se divise en deux parties  | 
| 122 | 31 | Patrice Nadeau | * Le deamon _NRPE_ qui roule comme agent sur la machine sous surveillance  | 
| 123 | 33 | Patrice Nadeau | * Le « plugin » _nrpe_check_ qui roule sur le serveur Nagios pour exécuter les vérifications sur des machines distantes.  | 
| 124 | 1 | Patrice Nadeau | |
| 125 | 29 | Patrice Nadeau | h3. Téléchargement  | 
| 126 | |||
| 127 | 26 | Patrice Nadeau | <pre><code class="bash">  | 
| 128 | 48 | Patrice Nadeau | mkdir ~/tmp  | 
| 129 | 1 | Patrice Nadeau | cd ~/tmp  | 
| 130 | 83 | Patrice Nadeau | wget https://github.com/NagiosEnterprises/nrpe/archive/3.0.1.tar.gz  | 
| 131 | 50 | Patrice Nadeau | # Décompresse le fichier  | 
| 132 | 84 | Patrice Nadeau | tar xvf 3.0.1.tar.gz  | 
| 133 | cd 3.0.1  | 
||
| 134 | 26 | Patrice Nadeau | </code></pre>  | 
| 135 | 1 | Patrice Nadeau | |
| 136 | 29 | Patrice Nadeau | h3. Compilation  | 
| 137 | |||
| 138 | 50 | Patrice Nadeau | openSUSE :  | 
| 139 | 1 | Patrice Nadeau | <pre><code class="bash">  | 
| 140 | ./configure  | 
||
| 141 | make all  | 
||
| 142 | </code></pre>  | 
||
| 143 | 50 | Patrice Nadeau | |
| 144 | 51 | Patrice Nadeau | Debian :  | 
| 145 | 50 | Patrice Nadeau | <pre><code class="bash">  | 
| 146 | ./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/arm-linux-gnueabihf  | 
||
| 147 | make all  | 
||
| 148 | </code></pre>  | 
||
| 149 | |||
| 150 | 31 | Patrice Nadeau | |
| 151 | h4. Installation  | 
||
| 152 | |||
| 153 | Un fois compilés, les exécutables ne sont pas copiés au bons endroits. On doit donc le faire manuellement.  | 
||
| 154 | |||
| 155 | 32 | Patrice Nadeau | h5. check_nrpe  | 
| 156 | |||
| 157 | 52 | Patrice Nadeau | openSUSE:  | 
| 158 | 31 | Patrice Nadeau | <pre><code class="bash">  | 
| 159 | 67 | Patrice Nadeau | mkdir -p /usr/local/nagios/libexec  | 
| 160 | 31 | Patrice Nadeau | cp src/check_nrpe /usr/local/nagios/libexec  | 
| 161 | 71 | Patrice Nadeau | cp sample-config/nrpe.cfg /etc  | 
| 162 | 52 | Patrice Nadeau | </code></pre>  | 
| 163 | |||
| 164 | Debian/Ubuntu :  | 
||
| 165 | <pre><code class="bash">  | 
||
| 166 | sudo cp src/check_nrpe /usr/local/nagios/libexec  | 
||
| 167 | 71 | Patrice Nadeau | cp sample-config/nrpe.cfg /etc  | 
| 168 | 29 | Patrice Nadeau | </code></pre>  | 
| 169 | 32 | Patrice Nadeau | |
| 170 | h5. NRPE  | 
||
| 171 | |||
| 172 | 34 | Patrice Nadeau | Problème #31  | 
| 173 | 26 | Patrice Nadeau | |
| 174 | 55 | Patrice Nadeau | h2. Daemon  | 
| 175 | 1 | Patrice Nadeau | |
| 176 | 56 | Patrice Nadeau | openSUSE :  | 
| 177 | 20 | Patrice Nadeau | <pre><code class="bash">  | 
| 178 | systemctl enable nagios  | 
||
| 179 | 1 | Patrice Nadeau | </code></pre>  | 
| 180 | |||
| 181 | 58 | Patrice Nadeau | Debian/Ubuntu :  | 
| 182 | 57 | Patrice Nadeau | > Ne semble pas nécessaire  | 
| 183 | |||
| 184 | 53 | Patrice Nadeau | h3. Vérification de la configurations  | 
| 185 | |||
| 186 | openSUSE:  | 
||
| 187 | 22 | Patrice Nadeau | <pre><code class="bash">  | 
| 188 | 1 | Patrice Nadeau | /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg  | 
| 189 | 53 | Patrice Nadeau | </code></pre>  | 
| 190 | |||
| 191 | Debian/Ubuntu :  | 
||
| 192 | <pre><code class="bash">  | 
||
| 193 | sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg  | 
||
| 194 | 22 | Patrice Nadeau | </code></pre>  | 
| 195 | 20 | Patrice Nadeau | |
| 196 | 55 | Patrice Nadeau | h3. Lancement du daemon  | 
| 197 | 54 | Patrice Nadeau | |
| 198 | openSUSE :  | 
||
| 199 | 20 | Patrice Nadeau | <pre><code class="bash">  | 
| 200 | 22 | Patrice Nadeau | systemctl start nagios  | 
| 201 | 54 | Patrice Nadeau | </code></pre>  | 
| 202 | |||
| 203 | Debian/Ubuntu :  | 
||
| 204 | <pre><code class="bash">  | 
||
| 205 | sudo systemctl start nagios3.service  | 
||
| 206 | 1 | Patrice Nadeau | </code></pre>  | 
| 207 | 28 | Patrice Nadeau | |
| 208 | La page est disponible à http://server.domain/nagios  |