Supervision avec Shinken [height=3cm]robotrougealpha.png

38
Supervision avec Shinken Benoit Métrot [email protected] UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers) Rencontres Mathrice Caen, Mars 2013 Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers)) Shinken Rencontres Mathrice Caen, Mars 2013 1 / 38

Transcript of Supervision avec Shinken [height=3cm]robotrougealpha.png

Page 1: Supervision avec Shinken [height=3cm]robotrougealpha.png

Supervision avec Shinken

Benoit Mé[email protected]

UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers)

Rencontres MathriceCaen, Mars 2013

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 1

/ 38

Page 2: Supervision avec Shinken [height=3cm]robotrougealpha.png

Plan

1 Introduction

2 Architecture et composants

3 Mise en oeuvre

4 Outils complémentaires

5 Conclusion

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 2

/ 38

Page 3: Supervision avec Shinken [height=3cm]robotrougealpha.png

Progression

1 Introduction

2 Architecture et composants

3 Mise en oeuvre

4 Outils complémentaires

5 Conclusion

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 3

/ 38

Page 4: Supervision avec Shinken [height=3cm]robotrougealpha.png

Retour en arrière...

Décembre 2011Services réseau → NagiosRessources locales → NRPEAlertes → E-Mail, pas d’escaladesSondes → Plugins standards + développements Bash ou PerlMetrologie (CPU, disque, charge...) → Munin

Pourquoi changer ?Deux outils pour la supervision/métrologie (Centreon ?)Lenteurs constatées dans les check (IPMI)Ralentissement du développement Nagios [Gabès(2010)]Envie de passer à la haute disponibilité

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 4

/ 38

Page 5: Supervision avec Shinken [height=3cm]robotrougealpha.png

Mon cahier des charges

Test des protocoles standards (HTTP, SMTP, IMAP, LDAP...)Intégration de test locaux (Sondes, jobs cron)Coupler supervision/metrologie (minimiser les requetes)Interface Web de visualisation (Auth Apache)Minimiser les alertes (dépendances, escalades)Configuration en mode texte (versions)Réutilisation des sondes existentesProduit Open-Source, modulaire

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 5

/ 38

Page 6: Supervision avec Shinken [height=3cm]robotrougealpha.png

Lequel choisir ?

CentreonUsine

Authentification Web

Réutilise la config. Nagios

Intègre la métrologie

IcingaFork de Nagios

Modularité

Sondes réutilisables

Config. réutilisables

ZabbixAgent à déployer

Config. full web

Auth. web

-

ShinkenPas de paquets Debian

PNP4Nagios à ajouter

Interface Thruk à ajouter

Dépendances de services

Système distribué

Modularité

Sondes réutilisables

Config. réutilisables

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 6

/ 38

Page 7: Supervision avec Shinken [height=3cm]robotrougealpha.png

Progression

1 Introduction

2 Architecture et composants

3 Mise en oeuvre

4 Outils complémentaires

5 Conclusion

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 7

/ 38

Page 8: Supervision avec Shinken [height=3cm]robotrougealpha.png

Fonctionnalités I

ShinkenSupervision de toute l’informatique (systèmes, réseau, infrastructureapplications utilisateurs)

Surveillance active avec des sondes (compatibles Nagios)

Surveillance passive (NSCA, NRPE, SNMP)

Notifications des administrateurs et utilisateurs (Email, SMS,Twitter, tableau de bord)Notifications intelligentes

I Périodes de maintenanceI EscaladesI Isolation de la cause principale

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 8

/ 38

Page 9: Supervision avec Shinken [height=3cm]robotrougealpha.png

Fonctionnalités II

Modules pour faciliter l’intégrationI Etat courant et historique (Livestatus)I Données de performanceI Journaux d’activité

Interface Web de visualisation intégrée WebUI

Compatible avec Nagios (configuration, sondes)

Indicateur orienté métier (la production avant tout)

Support de reseaux complexes (DMZ) et multi-sites

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 9

/ 38

Page 10: Supervision avec Shinken [height=3cm]robotrougealpha.png

Modularité - Découpage des rôles [Gabès(2012a)] I

ArbiterLecture, gestion de la configurationDécoupage de la configuration et répartition vers les autres service

SchedulerGestion de l’état des élémentsCorrélation (séparation des problèmes sources et des impacts)Ordonnancements des taches (verifications, notifications)

PollerExécution des taches de controle (sondes)Renvoi des resultats au Scheduler

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 10

/ 38

Page 11: Supervision avec Shinken [height=3cm]robotrougealpha.png

Modularité - Découpage des rôles [Gabès(2012a)] II

ReactionnerEmission des notifications issues du scheduler

BrokerMise à jour des interfaces (visualisation d’état, graphiques deperformance)Files de Morceaux de données reçues du scheduler vers les modulesdu broker.

ReceiverReçoit des ordres ou de nouvelles informations qui seront pousséesvers l’Arbiter

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 11

/ 38

Page 12: Supervision avec Shinken [height=3cm]robotrougealpha.png

Synthèse

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 12

/ 38

Page 13: Supervision avec Shinken [height=3cm]robotrougealpha.png

Sonde

Sonde (plugin)Une sonde est un exécutable [Rousse(2010)], ou un script, effectuantune vérification et renvoyant un code de retour et au moins une lignede texte sur sa sortie standard (contenant éventuellement desdonnées de performance).

Codes de retour :0 → Service OK, Hote UP1 → Service WARNING, Hote DOWN ou UNREACHABLE2 → Service CRITICAL, Hote DOWN ou UNREACHABLE3 → Service UNKNOWN, Hote DOWN ou UNREACHABLE

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 13

/ 38

Page 14: Supervision avec Shinken [height=3cm]robotrougealpha.png

Reste à explorer...

Supervision des machines Windows avec check_wmi_plusHaut disponiblité : chaque élément de shinken (arbiter, scheduler,poller) est multipliable à souhaitDécouverte automatique du réseau (génération d’éléments deconfiguration) [Gabès(2012b)]Notion de Realm, utile pour les entités multisitesSupervision en DMZ : Poller en mode passif (passive)Vérifications assignées à certains Poller (poller_tag)

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 14

/ 38

Page 15: Supervision avec Shinken [height=3cm]robotrougealpha.png

Progression

1 Introduction

2 Architecture et composants

3 Mise en oeuvre

4 Outils complémentaires

5 Conclusion

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 15

/ 38

Page 16: Supervision avec Shinken [height=3cm]robotrougealpha.png

Démarche I

Installation de shinken sur le serveur

Définition du périmètre de supervision (schéma réseau)Ecriture d’une configuration minimale avec :

I Actifs réseauxI Eléments d’infrastructure (Onduleur, KVM IP...)I Serveurs physiques principauxI Machines virtuelles critiquesI Services critiques (DHCP, LDAP, IMAP, SMTP...)I Alertes par Email

Mise en place interface Web complémentaire

Ecriture (réutilisation) de sondes supplémentaires (IPMI,Kerberos, CUPS)

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 16

/ 38

Page 17: Supervision avec Shinken [height=3cm]robotrougealpha.png

Démarche II

Exploitation des données de performances

Intégration de toutes les VM et serveurs

Définition des escalades et des moyens d’alerte supplémentaires

Implantation de tests locaux aux serveurs (CPU, mémoiredisque...)

Intégration des postes de travail à la supervision (CPU, mémoire,mises à jour...)

Intégration des traps SNMP (imprimantes)

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 17

/ 38

Page 18: Supervision avec Shinken [height=3cm]robotrougealpha.png

Eléments de configurations

Configuration modulaire à base de fichiers textesStockée dans /etc/shinken ou /usr/local/shinken/etc

Syntaxe compatible avec Nagios (objets identiques)Fichiers principaux

I nagios.cfg → Services, Machines à superviserI shinken-specific.cfg → Organisation et nombre de daemon,

modules associéesI Paramètrage spécifique à chaque daemon (port d’écoute)

F brokerd.iniF pollerd.iniF reactionnerd.iniF receiverd.iniF schedulerd.ini

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 18

/ 38

Page 19: Supervision avec Shinken [height=3cm]robotrougealpha.png

Objets de la configuration

command → Commande shell d’une sondetimeperiod → Période de tempscontact → Personne à contactercontactgroup → Groupe de personneshost → Machine ou hôtehostgroup → Groupe de machinesservice → Service rendu par une machinehostdependancy → Dépendance entre machinesservicedependancy → Dépendance entre serviceescalation → Escalade de notification

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 19

/ 38

Page 20: Supervision avec Shinken [height=3cm]robotrougealpha.png

Factorisation de configuration - Templatesdefine host{

name generic-hostalias generic-host

max_check_attempts 2check_interval 5active_checks_enabled 1check_period 24x7contact_groups admins

notification_interval 0notification_period 24x7notification_options d,u,r,fnotifications_enabled 1

event_handler_enabled 0flap_detection_enabled 1process_perf_data 1

register 0}

define host{host_name sshgwalias Sas SSHaddress 192.168.10.3parents LmaSwitchuse generic-host

}

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 20

/ 38

Page 21: Supervision avec Shinken [height=3cm]robotrougealpha.png

Exécution de sondes distantesMise en oeuvre de check_by_ssh

Groupement des test en un seul appel SSHDéploiement facilité, pas de daemon distant (NRPE)

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 21

/ 38

Page 22: Supervision avec Shinken [height=3cm]robotrougealpha.png

Exécution de sondes distantes - Configuration I

Commande check_ssh

define command{command_name check_byssh_data1diskcommand_line $PLUGINSDIR$/check_by_ssh -H $HOSTADDRESS$

-n $HOSTNAME$ -p 22 -2 -l shinken -i /home/shinken/.ssh/id_rsa -o "StrictHostKeyChecking no" -s "DiskData" -C "/usr/lib/nagios/plugins/check_disk -w10% -c 5% -p $ARG1$" -O /usr/local/shinken/var/rw/nagios.cmd

}

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 22

/ 38

Page 23: Supervision avec Shinken [height=3cm]robotrougealpha.png

Exécution de sondes distantes - Configuration II

Service déclencheur

define service{service_description SSH-PASV-DISKdisplay_name Data disk usage on /homehost_name sshgwcheck_command check_byssh_data1disk!/homeuse generic-service

}

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 23

/ 38

Page 24: Supervision avec Shinken [height=3cm]robotrougealpha.png

Exécution de sondes distantes - Configuration III

Service passif (collecte du résultat)

define service{service_description DiskDatadisplay_name Data disk usagehost_name sshgwuse generic-servicemax_check_attempts 4active_checks_enabled 0passive_checks_enabled 1check_service_freshness 1freshness_threshold 172800check_command check_nopasv_delay!48

}

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 24

/ 38

Page 25: Supervision avec Shinken [height=3cm]robotrougealpha.png

Les données de performance

Mémoire utilisée, WARNING à 90%, CRITICAL à 95%

shinken@garde1:~$ /usr/local/shinken/libexec/check_mem.pl -u -w90 -c 95

CRITICAL - 95.1% (983876 kB) used!|TOTAL=1034180KB;;;; USED=983876KB;;;; FREE=50304KB;;;; CACHES=617460KB;;;;

Données situées après le | dans la sortie standard des sondesPlusieurs valeurs possibles’label’=value[unité];[warn];[crit];[min];[max]

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 25

/ 38

Page 26: Supervision avec Shinken [height=3cm]robotrougealpha.png

Traitement des données de performances

1 Execution de la sonde2 Export des données de

performances vers fichiertampon

3 Dépot du fichier tampondans /var/spool

4 Vérification périodique dudossier

5 Explotation des données6 Alimentation du RRD7 Ecriture Meta-données XML

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 26

/ 38

Page 27: Supervision avec Shinken [height=3cm]robotrougealpha.png

Progression

1 Introduction

2 Architecture et composants

3 Mise en oeuvre

4 Outils complémentaires

5 Conclusion

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 27

/ 38

Page 28: Supervision avec Shinken [height=3cm]robotrougealpha.png

Thruk

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 28

/ 38

Page 29: Supervision avec Shinken [height=3cm]robotrougealpha.png

Thruk

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 29

/ 38

Page 30: Supervision avec Shinken [height=3cm]robotrougealpha.png

Thruk

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 30

/ 38

Page 31: Supervision avec Shinken [height=3cm]robotrougealpha.png

PNP4Nagios

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 31

/ 38

Page 32: Supervision avec Shinken [height=3cm]robotrougealpha.png

PNP4Nagios

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 32

/ 38

Page 33: Supervision avec Shinken [height=3cm]robotrougealpha.png

PNP4Nagios

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 33

/ 38

Page 34: Supervision avec Shinken [height=3cm]robotrougealpha.png

Cle 3G

Envoi de notification SMS via leréseau GSMUtilisation d’une clé 3G en modemGSMScript Python (merci ANF 2012 !) :

I Communication série avec lemodem

I Envoi de SMSI Vérification état réseau GSM

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 34

/ 38

Page 35: Supervision avec Shinken [height=3cm]robotrougealpha.png

Progression

1 Introduction

2 Architecture et composants

3 Mise en oeuvre

4 Outils complémentaires

5 Conclusion

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 35

/ 38

Page 36: Supervision avec Shinken [height=3cm]robotrougealpha.png

Bilan

Résultats satisfaisants en termes de performancesCouplage réussit de la supervision et de la métrologieSystème extensible notamment par le developpement de sondeset de templates PNP4NagiosDifficulté de concevoir une configuration modulaire couvrant latotalité du parc

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 36

/ 38

Page 37: Supervision avec Shinken [height=3cm]robotrougealpha.png

References I

Jean Gabès.Shinken : quand un python rencontre nagios.Linux Magazine / France - Hors-série, (49) :44–55,Août/Septembre 2010.

Jean Gabès.Architecture de shinken et plus encore...Linux Magazine / France - Hors-série, (62) :13–24,Septembre-Octobre 2012a.

Jean Gabès.L’interface skonf.Linux Magazine / France - Hors-série, (62) :32–35,Septembre-Octobre 2012b.

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 37

/ 38

Page 38: Supervision avec Shinken [height=3cm]robotrougealpha.png

References II

Guillaume Rousse.Développement de sondes nagios.Linux Magazine / France, (129) :36–41, Juillet-Août 2010.

Benoit Métrot [email protected] (UMR 7348 - Laboratoire de Mathématiques et Applications (Poitiers))ShinkenRencontres Mathrice Caen, Mars 2013 38

/ 38