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