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