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