From source » Historique » Version 79
Patrice Nadeau, 2016-09-10 10:25
| 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 | 15 | Patrice Nadeau | systemctl restart apache2 |
| 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 | 1 | Patrice Nadeau | tar xvf nagios-plugins-2.0.3.tar.gz |
| 111 | 63 | Patrice Nadeau | cd /nagios-plugins-2.0.3 |
| 112 | 22 | Patrice Nadeau | ./configure --with-nagios-user=nagios --with-nagios-group=nagios |
| 113 | 1 | Patrice Nadeau | make |
| 114 | 43 | Patrice Nadeau | # openSUSE |
| 115 | 1 | Patrice Nadeau | make install |
| 116 | 43 | Patrice Nadeau | # Debian/Ubuntu |
| 117 | sudo make install |
||
| 118 | 22 | Patrice Nadeau | </code></pre> |
| 119 | |||
| 120 | 26 | Patrice Nadeau | h2. Nagios Remote Plugin Executor |
| 121 | |||
| 122 | 29 | Patrice Nadeau | Ce « add-on » se divise en deux parties |
| 123 | 31 | Patrice Nadeau | * Le deamon _NRPE_ qui roule comme agent sur la machine sous surveillance |
| 124 | 33 | Patrice Nadeau | * Le « plugin » _nrpe_check_ qui roule sur le serveur Nagios pour exécuter les vérifications sur des machines distantes. |
| 125 | 1 | Patrice Nadeau | |
| 126 | 29 | Patrice Nadeau | h3. Téléchargement |
| 127 | |||
| 128 | 26 | Patrice Nadeau | <pre><code class="bash"> |
| 129 | 66 | Patrice Nadeau | mkdir ~/tmp |
| 130 | 48 | Patrice Nadeau | cd ~/tmp |
| 131 | 44 | Patrice Nadeau | wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz |
| 132 | 50 | Patrice Nadeau | # Décompresse le fichier |
| 133 | tar xvf nrpe-2.15.tar.gz |
||
| 134 | cd nrpe-2.15 |
||
| 135 | 26 | Patrice Nadeau | </code></pre> |
| 136 | 1 | Patrice Nadeau | |
| 137 | 29 | Patrice Nadeau | h3. Compilation |
| 138 | |||
| 139 | 50 | Patrice Nadeau | openSUSE : |
| 140 | 1 | Patrice Nadeau | <pre><code class="bash"> |
| 141 | ./configure |
||
| 142 | make all |
||
| 143 | </code></pre> |
||
| 144 | 50 | Patrice Nadeau | |
| 145 | 51 | Patrice Nadeau | Debian : |
| 146 | 50 | Patrice Nadeau | <pre><code class="bash"> |
| 147 | ./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/arm-linux-gnueabihf |
||
| 148 | make all |
||
| 149 | </code></pre> |
||
| 150 | |||
| 151 | 31 | Patrice Nadeau | |
| 152 | h4. Installation |
||
| 153 | |||
| 154 | Un fois compilés, les exécutables ne sont pas copiés au bons endroits. On doit donc le faire manuellement. |
||
| 155 | |||
| 156 | 32 | Patrice Nadeau | h5. check_nrpe |
| 157 | |||
| 158 | 52 | Patrice Nadeau | openSUSE: |
| 159 | 31 | Patrice Nadeau | <pre><code class="bash"> |
| 160 | 67 | Patrice Nadeau | mkdir -p /usr/local/nagios/libexec |
| 161 | 31 | Patrice Nadeau | cp src/check_nrpe /usr/local/nagios/libexec |
| 162 | 71 | Patrice Nadeau | cp sample-config/nrpe.cfg /etc |
| 163 | 52 | Patrice Nadeau | </code></pre> |
| 164 | |||
| 165 | Debian/Ubuntu : |
||
| 166 | <pre><code class="bash"> |
||
| 167 | sudo cp src/check_nrpe /usr/local/nagios/libexec |
||
| 168 | 71 | Patrice Nadeau | cp sample-config/nrpe.cfg /etc |
| 169 | 29 | Patrice Nadeau | </code></pre> |
| 170 | 32 | Patrice Nadeau | |
| 171 | h5. NRPE |
||
| 172 | |||
| 173 | 34 | Patrice Nadeau | Problème #31 |
| 174 | 26 | Patrice Nadeau | |
| 175 | 55 | Patrice Nadeau | h2. Daemon |
| 176 | 1 | Patrice Nadeau | |
| 177 | 56 | Patrice Nadeau | openSUSE : |
| 178 | 20 | Patrice Nadeau | <pre><code class="bash"> |
| 179 | systemctl enable nagios |
||
| 180 | 1 | Patrice Nadeau | </code></pre> |
| 181 | |||
| 182 | 58 | Patrice Nadeau | Debian/Ubuntu : |
| 183 | 57 | Patrice Nadeau | > Ne semble pas nécessaire |
| 184 | |||
| 185 | 53 | Patrice Nadeau | h3. Vérification de la configurations |
| 186 | |||
| 187 | openSUSE: |
||
| 188 | 22 | Patrice Nadeau | <pre><code class="bash"> |
| 189 | 1 | Patrice Nadeau | /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg |
| 190 | 53 | Patrice Nadeau | </code></pre> |
| 191 | |||
| 192 | Debian/Ubuntu : |
||
| 193 | <pre><code class="bash"> |
||
| 194 | sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg |
||
| 195 | 22 | Patrice Nadeau | </code></pre> |
| 196 | 20 | Patrice Nadeau | |
| 197 | 55 | Patrice Nadeau | h3. Lancement du daemon |
| 198 | 54 | Patrice Nadeau | |
| 199 | openSUSE : |
||
| 200 | 20 | Patrice Nadeau | <pre><code class="bash"> |
| 201 | 22 | Patrice Nadeau | systemctl start nagios |
| 202 | 54 | Patrice Nadeau | </code></pre> |
| 203 | |||
| 204 | Debian/Ubuntu : |
||
| 205 | <pre><code class="bash"> |
||
| 206 | sudo systemctl start nagios3.service |
||
| 207 | 1 | Patrice Nadeau | </code></pre> |
| 208 | 28 | Patrice Nadeau | |
| 209 | La page est disponible à http://server.domain/nagios |