From source » Historique » Version 38
  Patrice Nadeau, 2015-02-08 09:39 
  
| 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 | * n'est pas relier à une plate-forme spécifique (i686 vs x86_64 vs ARM) | ||
| 8 | |||
| 9 | 10 | Patrice Nadeau | Les test ont été fait à partir d'un BeagleBone Black sous openSUSE 13.2. | 
| 10 | 8 | Patrice Nadeau | |
| 11 | 4 | Patrice Nadeau | h2. Prérequis | 
| 12 | 1 | Patrice Nadeau | |
| 13 | 6 | Patrice Nadeau | Installer les utilitaires pour la compilation : | 
| 14 | 35 | Patrice Nadeau | |
| 15 | openSUSE : | ||
| 16 | 5 | Patrice Nadeau | <pre><code class="bash"> | 
| 17 | zypper install make gcc | ||
| 18 | 35 | Patrice Nadeau | </code></pre> | 
| 19 | |||
| 20 | 36 | Patrice Nadeau | Ubuntu/Debian : | 
| 21 | 35 | Patrice Nadeau | <pre><code class="bash"> | 
| 22 | sudo apt-get install make gcc | ||
| 23 | 5 | Patrice Nadeau | </code></pre> | 
| 24 | 4 | Patrice Nadeau | |
| 25 | 9 | Patrice Nadeau | h2. Fichiers | 
| 26 | |||
| 27 | 2 | Patrice Nadeau | Télécharger | 
| 28 | 1 | Patrice Nadeau | <pre><code class="bash"> | 
| 29 | 21 | Patrice Nadeau | mkdir ~/tmp | 
| 30 | cd ~/tmp | ||
| 31 | 1 | Patrice Nadeau | wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.8.tar.gz | 
| 32 | wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz | ||
| 33 | 3 | Patrice Nadeau | </code></pre> | 
| 34 | 1 | Patrice Nadeau | |
| 35 | 9 | Patrice Nadeau | h2. Création de l'usager et groupe | 
| 36 | |||
| 37 | 37 | Patrice Nadeau | openSUSE : | 
| 38 | 3 | Patrice Nadeau | <pre><code class="bash"> | 
| 39 | useradd nagios | ||
| 40 | groupadd nagcmd | ||
| 41 | 11 | Patrice Nadeau | /usr/sbin/groupadd nagios | 
| 42 | 1 | Patrice Nadeau | usermod -a -G nagcmd nagios | 
| 43 | 11 | Patrice Nadeau | usermod -a -G nagios nagios | 
| 44 | 24 | Patrice Nadeau | # Permet de soumettre des check via l'interface web | 
| 45 | usermod -a -G nagcmd wwwrun | ||
| 46 | 37 | Patrice Nadeau | </code></pre> | 
| 47 | |||
| 48 | Debian/Ubuntu : | ||
| 49 | <pre><code class="bash"> | ||
| 50 | sudo useradd nagios | ||
| 51 | sudo groupadd nagcmd | ||
| 52 | sudo /usr/sbin/groupadd nagios | ||
| 53 | sudo usermod -a -G nagcmd nagios | ||
| 54 | sudo usermod -a -G nagios nagios | ||
| 55 | # Permet de soumettre des check via l'interface web | ||
| 56 | sudo usermod -a -G nagcmd www-data | ||
| 57 | 9 | Patrice Nadeau | </code></pre> | 
| 58 | |||
| 59 | 17 | Patrice Nadeau | h2. Nagios Core | 
| 60 | |||
| 61 | h3. Compilation | ||
| 62 | 1 | Patrice Nadeau | |
| 63 | 9 | Patrice Nadeau | <pre><code class="bash"> | 
| 64 | 38 | Patrice Nadeau | tar xvf nagios-4.0.8.tar.gz | 
| 65 | 21 | Patrice Nadeau | cd ~/tmp/nagios-4.0.8 | 
| 66 | 9 | Patrice Nadeau | ./configure --with-command-group=nagcmd | 
| 67 | make all | ||
| 68 | 12 | Patrice Nadeau | make install | 
| 69 | make install-init | ||
| 70 | make install-commandmode | ||
| 71 | make install-config | ||
| 72 | 13 | Patrice Nadeau | make install-webconf | 
| 73 | 3 | Patrice Nadeau | </code></pre> | 
| 74 | 14 | Patrice Nadeau | |
| 75 | 19 | Patrice Nadeau | h3. Configuration de l'usager web | 
| 76 | 14 | Patrice Nadeau | |
| 77 | <pre><code class="bash"> | ||
| 78 | htpasswd2 -c /usr/local/nagios/etc/htpasswd.users nagiosadmin | ||
| 79 | 15 | Patrice Nadeau | systemctl restart apache2 | 
| 80 | 14 | Patrice Nadeau | </code></pre> | 
| 81 | 16 | Patrice Nadeau | |
| 82 | 22 | Patrice Nadeau | h2. Nagios Plugins | 
| 83 | |||
| 84 | h3. Compilation | ||
| 85 | |||
| 86 | <pre><code class="bash"> | ||
| 87 | cd ~/tmp/nagios-plugin | ||
| 88 | ./configure --with-nagios-user=nagios --with-nagios-group=nagios | ||
| 89 | make | ||
| 90 | make install | ||
| 91 | </code></pre> | ||
| 92 | |||
| 93 | 26 | Patrice Nadeau | h2. Nagios Remote Plugin Executor | 
| 94 | |||
| 95 | 29 | Patrice Nadeau | Ce « add-on » se divise en deux parties | 
| 96 | 31 | Patrice Nadeau | * Le deamon _NRPE_ qui roule comme agent sur la machine sous surveillance | 
| 97 | 33 | Patrice Nadeau | * Le « plugin » _nrpe_check_ qui roule sur le serveur Nagios pour exécuter les vérifications sur des machines distantes. | 
| 98 | 1 | Patrice Nadeau | |
| 99 | 29 | Patrice Nadeau | h3. Téléchargement | 
| 100 | |||
| 101 | 26 | Patrice Nadeau | <pre><code class="bash"> | 
| 102 | http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz | ||
| 103 | </code></pre> | ||
| 104 | 1 | Patrice Nadeau | |
| 105 | h3. Compilation | ||
| 106 | 29 | Patrice Nadeau | |
| 107 | <pre><code class="bash"> | ||
| 108 | # Installe les librairies de développement SSL | ||
| 109 | 30 | Patrice Nadeau | zypper install libopenssl-devel | 
| 110 | 29 | Patrice Nadeau | # Décompresse le fichier | 
| 111 | tar xvf nrpe-2.15.tar.gz | ||
| 112 | cd nrpe-2.15 | ||
| 113 | 1 | Patrice Nadeau | # lance la compilation | 
| 114 | ./configure | ||
| 115 | make all | ||
| 116 | 31 | Patrice Nadeau | </code></pre> | 
| 117 | |||
| 118 | h4. Installation | ||
| 119 | |||
| 120 | Un fois compilés, les exécutables ne sont pas copiés au bons endroits. On doit donc le faire manuellement. | ||
| 121 | |||
| 122 | 32 | Patrice Nadeau | h5. check_nrpe | 
| 123 | |||
| 124 | 31 | Patrice Nadeau | <pre><code class="bash"> | 
| 125 | cp src/check_nrpe /usr/local/nagios/libexec | ||
| 126 | 29 | Patrice Nadeau | </code></pre> | 
| 127 | 32 | Patrice Nadeau | |
| 128 | h5. NRPE | ||
| 129 | |||
| 130 | 34 | Patrice Nadeau | Problème #31 | 
| 131 | 26 | Patrice Nadeau | |
| 132 | 23 | Patrice Nadeau | h2. Services | 
| 133 | 1 | Patrice Nadeau | |
| 134 | 20 | Patrice Nadeau | <pre><code class="bash"> | 
| 135 | systemctl enable nagios | ||
| 136 | 1 | Patrice Nadeau | </code></pre> | 
| 137 | |||
| 138 | 22 | Patrice Nadeau | Vérifier si les fichiers de configurations sont bon | 
| 139 | <pre><code class="bash"> | ||
| 140 | /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg | ||
| 141 | </code></pre> | ||
| 142 | 20 | Patrice Nadeau | |
| 143 | 22 | Patrice Nadeau | Lancer Nagios | 
| 144 | 20 | Patrice Nadeau | <pre><code class="bash"> | 
| 145 | 22 | Patrice Nadeau | systemctl start nagios | 
| 146 | 1 | Patrice Nadeau | </code></pre> | 
| 147 | 28 | Patrice Nadeau | |
| 148 | La page est disponible à http://server.domain/nagios | 
