NRPE » Historique » Version 39
Patrice Nadeau, 2018-08-17 17:12
1 | 26 | Patrice Nadeau | # Nagios Remote Plugin Executor |
---|---|---|---|
2 | 1 | Patrice Nadeau | |
3 | > https://exchange.nagios.org/directory/Addons/Monitoring-Agents/NRPE--2D-Nagios-Remote-Plugin-Executor/details |
||
4 | |||
5 | Ce « add-on » se divise en deux parties |
||
6 | * Le « plugin » _check_nrpe_ qui roule sur le serveur Nagios pour exécuter les vérifications sur des machines distantes. |
||
7 | * Le deamon _nrpe_ qui roule comme agent sur la machine sous surveillance |
||
8 | |||
9 | 4 | Patrice Nadeau | {{TOC}} |
10 | 3 | Patrice Nadeau | |
11 | 26 | Patrice Nadeau | ## Prérequis |
12 | 8 | Patrice Nadeau | |
13 | 26 | Patrice Nadeau | ```bash |
14 | 12 | Patrice Nadeau | zypper install make gcc libopenssl-devel |
15 | 10 | Patrice Nadeau | # Remove if already installed with the OS |
16 | zypper remove nrpe |
||
17 | 13 | Patrice Nadeau | # Remove the one installed from source |
18 | 18 | Patrice Nadeau | /usr/local/nagios/bin/nrpe-uninstall all |
19 | 26 | Patrice Nadeau | ``` |
20 | 8 | Patrice Nadeau | |
21 | 26 | Patrice Nadeau | ## Création de l'usager |
22 | 14 | Patrice Nadeau | |
23 | 26 | Patrice Nadeau | ```bash |
24 | 14 | Patrice Nadeau | useradd nagios |
25 | groupadd nagcmd |
||
26 | /usr/sbin/groupadd nagios |
||
27 | usermod -a -G nagcmd nagios |
||
28 | usermod -a -G nagios nagios |
||
29 | 26 | Patrice Nadeau | ``` |
30 | 14 | Patrice Nadeau | |
31 | 26 | Patrice Nadeau | ## Téléchargement |
32 | 1 | Patrice Nadeau | |
33 | 38 | Patrice Nadeau | > Version 3.2.1 |
34 | 22 | Patrice Nadeau | |
35 | 26 | Patrice Nadeau | ```bash |
36 | 1 | Patrice Nadeau | mkdir ~/tmp |
37 | 35 | Patrice Nadeau | cd ~/tmp |
38 | wget https://github.com/NagiosEnterprises/nrpe/archive/master.zip |
||
39 | unzip master.zip |
||
40 | cd nrpe-master |
||
41 | ``` |
||
42 | |||
43 | 26 | Patrice Nadeau | ## check_nrpe |
44 | 1 | Patrice Nadeau | |
45 | 21 | Patrice Nadeau | Sur le serveur Nagios |
46 | |||
47 | 26 | Patrice Nadeau | ```bash |
48 | 1 | Patrice Nadeau | # openSUSE |
49 | ./configure |
||
50 | 7 | Patrice Nadeau | # Debian/Ubuntu |
51 | 1 | Patrice Nadeau | ./configure --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/arm-linux-gnueabihf |
52 | # All Linux |
||
53 | make clean |
||
54 | make check_nrpe |
||
55 | make install-plugin |
||
56 | 26 | Patrice Nadeau | ``` |
57 | 1 | Patrice Nadeau | |
58 | Un fois compilés, les exécutables ne sont pas copiés au bons endroits. On doit donc le faire manuellement. |
||
59 | |||
60 | 27 | Patrice Nadeau | ```bash |
61 | 29 | Patrice Nadeau | # openSUSE |
62 | 27 | Patrice Nadeau | mkdir -p /usr/local/nagios/libexec |
63 | 1 | Patrice Nadeau | cp src/check_nrpe /usr/local/nagios/libexec |
64 | 27 | Patrice Nadeau | cp sample-config/nrpe.cfg /etc |
65 | 29 | Patrice Nadeau | # Debian/Ubuntu |
66 | 1 | Patrice Nadeau | sudo cp src/check_nrpe /usr/local/nagios/libexec |
67 | cp sample-config/nrpe.cfg /etc |
||
68 | 29 | Patrice Nadeau | ``` |
69 | 1 | Patrice Nadeau | |
70 | 28 | Patrice Nadeau | ## nrpe |
71 | 1 | Patrice Nadeau | |
72 | 20 | Patrice Nadeau | Pour les machines « sous surveillance » |
73 | 1 | Patrice Nadeau | |
74 | 31 | Patrice Nadeau | ```bash |
75 | 1 | Patrice Nadeau | # openSUSE |
76 | 9 | Patrice Nadeau | ./configure --enable-command-args |
77 | 1 | Patrice Nadeau | # All Linux |
78 | make clean |
||
79 | make nrpe |
||
80 | make install-daemon |
||
81 | make install-config |
||
82 | make install-init |
||
83 | systemctl enable nrpe.service |
||
84 | systemctl start nrpe.service |
||
85 | 30 | Patrice Nadeau | ``` |
86 | 15 | Patrice Nadeau | |
87 | Ouvrir dans le pare-feu (yast firewall) le port *TCP 5666* |
||
88 | 16 | Patrice Nadeau | |
89 | 36 | Patrice Nadeau | ```bash |
90 | firewall-cmd --permanent --add-service=nrpe |
||
91 | firewall-cmd --reload |
||
92 | ``` |
||
93 | |||
94 | 39 | Patrice Nadeau | Éditer le fichier **/usr/local/nagios/etc/nrpe.cfg** et modifier les lignes suivantes : |
95 | 33 | Patrice Nadeau | |
96 | ```text |
||
97 | 16 | Patrice Nadeau | # Add Nagios server (IP or FQDN) |
98 | 24 | Patrice Nadeau | allowed_hosts=127.0.0.1,::1,nagios.fqdn |
99 | 1 | Patrice Nadeau | dont_blame_nrpe=1 |
100 | 39 | Patrice Nadeau | ``` |
101 | |||
102 | Mettre en commentaires les commandes suivantes |
||
103 | |||
104 | ```bash |
||
105 | #command[check_users]=/usr/local/nagios/lib/check_users -w 5 -c 10 |
||
106 | #command[check_load]=/usr/local/nagios/lib/check_load -r -w .15,.10,.05 -c .30,.25,.20 |
||
107 | #command[check_hda1]=/usr/local/nagios/lib/check_disk -w 20% -c 10% -p /dev/hda1 |
||
108 | #command[check_zombie_procs]=/usr/local/nagios/lib/check_procs -w 5 -c 10 -s Z |
||
109 | #command[check_total_procs]=/usr/local/nagios/lib/check_procs -w 150 -c 200 |
||
110 | ``` |
||
111 | |||
112 | Et enlever les commentaires |
||
113 | |||
114 | ```bash |
||
115 | command[check_users]=/usr/local/nagios/lib/check_users $ARG1$ |
||
116 | command[check_load]=/usr/local/nagios/lib/check_load $ARG1$ |
||
117 | command[check_disk]=/usr/local/nagios/lib/check_disk $ARG1$ |
||
118 | command[check_swap]=/usr/local/nagios/lib/check_swap $ARG1$ |
||
119 | command[check_cpu_stats]=/usr/local/nagios/lib/check_cpu_stats.sh $ARG1$ |
||
120 | command[check_mem]=/usr/local/nagios/lib/custom_check_mem -n $ARG1$ |
||
121 | 32 | Patrice Nadeau | ``` |
122 | 25 | Patrice Nadeau | |
123 | Ce fichier contient aussi les items à vérifier ainsi que leurs paramètres. |