====== Centreon - Alerta ====== ===== Intro ===== Site officiel : [[https://alerta.io/]] Le but est de fournir une vue épurée des warning/critical par rapport à l'affichage Centreon. Exemple d'affichage (tiré du site officiel) : | {{:espace_bua:exploitation:alerta_console-002.png?direct |}} | ===== Mise en place ===== Mady a mis en place Alerta dans un docker host de dev et l'a publié via une VIP sur le F5 de dev. __VirtualServer :__ ''dev.ameli.etd.intranet.justice.gouv.fr'' = ''10.62.16.39:443''\\ __Pool :__ alerta = ''1.1.0.50:8080''\\ __Node :__ ''1.1.0.50'' VIP sur le RPVJ : [[https://10.62.16.39/]] ===== Intégration Centreon Alerta ===== Ci-dessous ce que j'ai fait pour mettre en place l'intégration Centreon -> Alerta. [[https://github.com/alerta/nagios-alerta]] yum install git curl gcc make libcurl-devel jansson-devel FIXME + j'ai aussi dû installer la ''glib2 dev'' car sinon le make ne se faisait pas. Code repris du github, pour Nagios4 : $ git clone https://github.com/alerta/nagios-alerta.git $ cd nagios-alerta $ make nagios4 $ sudo make install › Interface web\\ › configuration\\ › pollers\\ › engine configuration\\ › centreon engine poller-recette\\ › onglet Data\\ › + Add a new entry\\ › ''/usr/lib/nagios/alerta-neb.o http://1.1.0.50:8080/api key=524vBuwv5o54oMYAqtWqQjgvo-lwBH__6c8uVcsF''\\ | {{:espace_bua:exploitation:alerta_centreon_1.png?direct|}} | | {{:espace_bua:exploitation:alerta_centreon_1bis.png?direct |}} | | {{:espace_bua:exploitation:alerta_centreon_2.png?direct |}} | J'ai reloadé la conf, le ''broker_module'' est bien présent dans ''aa.cfg'' mais je ne le vois pas dans le fichier de log ''/var/log/centreon-engine/centengine.log'' alors qu'il y a bien les 2 autres ''broker_module''.\\ Par contre il ya la ligne suivante, qui peut indiquer que Centreon n'arrive pas à charger le module ''alerta-neb.o'' bien qu'aucun nom de module ne soit explicité dans le message :\\ ''[1586309824] [20901] Warning: Broker modules cannot be changed nor reloaded'' Ajout de la commande ''check_heartbeat_alerta'' et contenant ''/usr/lib/nagios/plugins/check_dummy 0''. Ajout du service ''Heartbeat'' au host ''inf5ssupt707-poller-recette''. | {{:espace_bua:exploitation:alerta_centreon_service-heartbeat.png?600 |}} | Le check_dummy ne doit pas être présent d'où le unknown, le but c'est comme le deadmanswitch, c'est d'envoyer régulièrement une alerte bidon à alerta. | {{:espace_bua:exploitation:alerta_centreon_service-heartbeat_unknown.png?600 |}} | Je n'ai pas ajouté d'output dans la configuration du broker car je n'en trouve aucune qui pourrait correspondre.\\ Ce doit être l'étape finale qu'il manque pour que ça fonctionne. ===== C'est un échec ===== J'ai trouvé un article de blog sur Internet, en français en + : [[https://blog.tuxops.fr/forward-centreon-alerts-to-alerta/]]\\ Le blog était down quand je l'ai trouvé, j'ai envoyé un email à son administrateur (ghiles.kdh@gmail.com), il a rétabli l'accès. Au final je n'avais rien loupé. Dans le doute, j'ai copié le fichier dans ''/usr/lib64/nagios'', et j'ai bien pensé à changer le path dans la conf web.\\ En comparant avec les 2 autres modules .so je me suis rendu compte qu'il manquait l'attribut exécutable donc j'ai fait un ''chmod +x /usr/lib64/nagios/alerta-neb.o''. Rechargement de la conf : ''systemctl stop centengine && systemctl restart cbd && systemctl start centengine && systemctl status cbd && systemctl status centengine'' Mais dans les logs je constate une erreur ''undefined symbol: clear_volatile_macros'' :\\ ''[1586346110] [24422] Error: Could not load module '/usr/lib64/nagios/alerta-neb.o': load library failed: /usr/lib64/nagios/alerta-neb.o: undefined symbol: clear_volatile_macros'' Dans le fichier de log : [1586346105] [20901] Caught SIGTERM, shutting down ... [1586346106] [20901] Successfully shutdown ... (PID=20901) [1586346106] [20901] Event broker module '/usr/lib64/centreon-engine/externalcmd.so' deinitialized successfully [1586346107] [20901] Event broker module '/usr/lib64/nagios/cbmod.so' deinitialized successfully [1586346108] [24422] Centreon Engine 19.10.12 starting ... (PID=24422) [1586346108] [24422] Local time is Wed Apr 8 13:41:48 2020 [1586346108] [24422] LOG VERSION: 2.0 [1586346110] [24422] Event broker module '/usr/lib64/centreon-engine/externalcmd.so' initialized successfully [1586346110] [24422] Centreon Broker: log applier: applying 1 logging objects [1586346110] [24422] Event broker module '/usr/lib64/nagios/cbmod.so' initialized successfully [1586346110] [24422] Error: Could not load module '/usr/lib64/nagios/alerta-neb.o': load library failed: /usr/lib64/nagios/alerta-neb.o: undefined symbol: clear_volatile_macros [1586346118] [24422] Event loop start at Wed Apr 8 13:41:58 2020 [1586346118] [24422] Configuration loaded, main loop starting. Bon du coup j'ai fait le make avec ''nagios3'' au lieu de ''nagios4'' mais ça me donne une autre erreur de ''undefined symbol'' :\\ ''[1586348486] [25228] Error: Could not load module '/usr/lib64/nagios/alerta-neb.o': load library failed: /usr/lib64/nagios/alerta-neb.o: undefined symbol: logit'' Le log complet : [1586348477] [24422] Caught SIGTERM, shutting down ... [1586348478] [24422] Successfully shutdown ... (PID=24422) [1586348478] [24422] Event broker module '/usr/lib64/centreon-engine/externalcmd.so' deinitialized successfully [1586348479] [24422] Event broker module '/usr/lib64/nagios/cbmod.so' deinitialized successfully [1586348484] [25228] Centreon Engine 19.10.12 starting ... (PID=25228) [1586348484] [25228] Local time is Wed Apr 8 14:21:23 2020 [1586348484] [25228] LOG VERSION: 2.0 [1586348486] [25228] Event broker module '/usr/lib64/centreon-engine/externalcmd.so' initialized successfully [1586348486] [25228] Centreon Broker: log applier: applying 1 logging objects [1586348486] [25228] Event broker module '/usr/lib64/nagios/cbmod.so' initialized successfully [1586348486] [25228] Error: Could not load module '/usr/lib64/nagios/alerta-neb.o': load library failed: /usr/lib64/nagios/alerta-neb.o: undefined symbol: logit [1586348495] [25228] Event loop start at Wed Apr 8 14:21:35 2020 [1586348495] [25228] Configuration loaded, main loop starting. La commande ''nm'' trouve bien le symbol pourtant (ici nagios3) : [root@inf5ssupt707 nagios-alerta]# nm /usr/lib64/nagios/alerta-neb.o 0000000000001ca0 T log_info U logit 0000000000001cb0 T log_warning [root@inf5ssupt707 nagios-alerta]# ===== Avec les modules Nagios Core ===== J'ai téléchargé Nagios Core sur le site officiel puis j'ai suivi la doc officielle : [[https://assets.nagios.com/downloads/nagioscore/docs/Nagios-Core-Installing-On-Centos7.pdf]] J'ai installé ''unzip'' qui est un prérequis puis j'ai : * ''%%tar xvzf nagios-4.4.5.tar.gz%%'' * ''%%cd nagios-4.4.5/%%'' * ''%%./configure --with-command-group=nagcmd%%'' * ''%%make all%%'' * ''%%cd base/%%'' * ''%%cp *.o /usr/lib64/nagios/%%'' Puis re ''systemctl stop centengine && systemctl restart cbd && systemctl start centengine && systemctl status cbd && systemctl status centengine'' Mais toujours la même erreur : ''undefined symbol: clear_volatile_macros'' {{tag>Centreon Alerta Supervision Monitoring}}