| Scroll Ignore | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||
|
Concept
Ce module permet de définir les paramètres d'accès aux données SLA pour la génération des rapports.
| Warning |
|---|
Les paramètres définissant le calcul du taux de disponibilité des SLA pour ce module doivent être les mêmes que ceux du module SLA attaché au Broker qui écrit les SLA pour le royaume. |
Activation du module
Le module report-builder--module-sla-reader est un module qui doit être activé sur le module broker--module-report-builder.
| Warning |
|---|
Ce module est obligatoire pour pouvoir disposer des rapports. |
- L'activation du module s'effectue en ajoutant le nom de ce module dans le fichier de configuration du module
broker--module-report-buildercorrespondant. - Pour cela, ouvrir le fichier de configuration du module
broker--module-report-builderà l'emplacement /etc/shinken/modules/nom_du_module_broker--module-report-builder.cfg , et ajouter le nom du module "report-builder--module-sla-reader" .
Exemple : avec un module dont le nom est " report-builder--module-sla-reader " :
| Code Block | ||||
|---|---|---|---|---|
| ||||
define module {
[...]
modules Module 1, Module 2, Module 3, report-builder--module-sla-reader
[...]
} |
Pour prendre en compte le changement de configuration, redémarrer l'Arbiter:
| No Format |
|---|
service shinken-arbiter restart |
Configuration
La configuration du module se trouve par défaut dans le fichier /etc/shinken/modules/report-builder--module-sla-reader.cfg
- Un exemple de configuration est également disponible dans /etc/shinken-user-example/configuration/daemons/brokers/modules/broker__module_report_builder/modules/report_builder__module_sla_reader/report-builder--module-sla-reader-example.cfg
Exemple de fichier de configuration
| Code Block | ||||
|---|---|---|---|---|
| ||||
# CFG_FORMAT_VERSION 1 ( SHINKEN : DON'T TOUCH THIS LINE )
#================================================================================
# report-builder--module-sla-reader
#================================================================================
# Modules that can load this module:
# - broker--module-report-builder
# This module reads SLA data from a mongodb database
#================================================================================
define module {
# ┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
# │ ────────────────────────────────────── MODULE IDENTITY ────────────────────────────────────── │ #
# └─────────────────────────────────────────────────────────────────────────────────────────────────────┘ #
# ─── Module name [ Must be unique ] [ MANDATORY ] ───
# ─── ───
module_name report-builder--module-sla-reader
# ─── Module type [ Do not edit ] [ MANDATORY ] ───
# ─── ───
module_type report_builder__module_sla_reader
# ┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
# │ ──────────────────────────────────── DATABASE CONNECTION ──────────────────────────────────── │ #
# └─────────────────────────────────────────────────────────────────────────────────────────────────────┘ #
# ───────────────── MongoDB parameters ──────────────────────────────────────────────────────────────── #
# ─── MongoDB uri definition . You can find the mongodb uri syntax at ───
# ─── https://docs.mongodb.com/manual/reference/connection-string/ ───
# ───
# Default : mongodb://localhost/?w=1&fsync=false ───
# ─── ───
# uri mongodb://localhost/?w=1&fsync=false
# ─── Which database contains sla data ───
# ───
# Default : shinken ───
# ─── ───
# database shinken
# ─── username/password to authenticate to MongoDB. ───
# ─── Both parameters must be provided for authentication to function correctly. ───
# ─── ───
# database__username
# ─── ───
# database__password
# ─── SSH tunnel activation to secure your mongodb connection ───
# ─── That will allow all mongodb to be encrypted & authenticated with SSH ───
# ───
# Default : 0 => Disable ( disable ssh tunnel ) ───
# ... : 1 => Enable ( enable ssh tunnel ) ───
# ─── ───
# use_ssh_tunnel 0
# ─── If the SSH connection goes wrong, then retry use_ssh_retry_failure time before_shinken_inactive ───
# ───
# Default : 1 ( number of retry ) ───
# ─── ───
# use_ssh_retry_failure 1
# ─── SSH user to connect to the mongodb server. ───
# ───
# Default : shinken ───
# ─── ───
# ssh_user shinken
# ─── SSH keyfile to connect to the mongodb server. ───
# ───
# Default : ~shinken/.ssh/id_rsa ───
# ─── ───
# ssh_keyfile ~shinken/.ssh/id_rsa
# ─── SSH Timeout used to test if the SSH tunnel is viable or not, in seconds. ───
# ───
# Default : 10 ( seconds ) ───
# ─── ───
# ssh_tunnel_timeout 10
# ────────────── AutoReconnect Management ───────────────────────────────────────────────────────────── #
# ─── When MongoDB require you to reconnect ( For example, It can occur when a new PRIMARY is elected ───
# ─── in a MongoDB cluster ), it will raised the MongoDB AutoReconnect exception. ───
# ─── How many try to reconnect before module go in error ───
# ───
# Default : 4 ( number of try ) ───
# ─── ───
# auto_reconnect_max_try 4
# ─── Time between each try ───
# ───
# Default : 3 ( seconds ) ───
# ─── ───
# auto_reconnect_sleep_between_try 3
# ─── NOTE: Change these values only if you have a MongoDB cluster and you change the ───
# ─── heartbeatTimeoutSecs of your MongoDB replica set ───
# ─── The value of auto_reconnect_max_try * auto_reconnect_sleep_between_try must be higher than ───
# ─── heartbeatTimeoutSecs in the rs.conf(); of your MongoDB replica set. ───
# ┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
# │ ────────────────────────────────────── SLA CALCULATION ────────────────────────────────────── │ #
# └─────────────────────────────────────────────────────────────────────────────────────────────────────┘ #
# ─── Some status can impact ───
# ─── -> positively (counted as OK/UP) ───
# ─── -> negatively (counted as CRITICAL/DOWN) ───
# ─── -> not impact the SLA ───
# ─── (is not counted, meaning the period of study is reduced by the period that is not counted). ───
# ─── This configuration aims at giving Shinken administrators a way to configure ───
# ─── how the SLA are calculated. ───
# ─── SLA are computed on a daily basis. ───
# ─── SLA of the current day are always recomputed after a configuration change. ───
# ─── SLA from days before are by default not recomputed. ───
# ───
# Default : 0 => Disable ( old SLA will not be recalculated ) ───
# ... : 1 => Enable ( old SLA will be recomputed with current settings ) ───
# ─── ───
# recompute_old_sla 0
# ─── Warning periods ───
# ───
# Default : 0 => Warning counts as DOWN ───
# ... : 1 => Warning counts as UP ───
# ─── ───
# warning_counts_as_ok 0
# ─── Unknown periods ───
# ───
# Default : include => "Unknown" status is counted negatively in the SLA. ───
# ... : exclude => "Unknown" are not counted from SLA considered period. ───
# ... : ok => "Unknown" are considered as UP periods ───
# ─── ───
# unknown_period include
# ─── No_data periods ( "Missing data" and "Shinken inactive" status ) ───
# ───
# Default : include => Only status is considered. "Missing data" and "Shinken inactive" ───
# status are counted negatively in the SLA. ───
# ... : exclude => No_data are not counted from SLA considered period. ───
# ... : ok => No_data are considered as UP periods. ───
# ─── ───
# no_data_period include
# ─── Downtime periods ───
# ───
# Default : include => Only status is considered. ───
# ... : exclude => Downtimes are not counted from SLA considered period. ───
# ... : ok => Downtimes are considered as UP periods. ───
# ... : critical => Downtimes are considered as DOWN periods. ───
# ─── ───
# downtime_period include
} |
Détails des sections composant le fichier de configuration
Identification du module
| Code Block | ||||
|---|---|---|---|---|
| ||||
# ┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
# │ ────────────────────────────────────── MODULE IDENTITY ────────────────────────────────────── │ #
# └─────────────────────────────────────────────────────────────────────────────────────────────────────┘ #
# ─── Module name [ Must be unique ] [ MANDATORY ] ───
# ─── ───
module_name report-builder--module-sla-reader
# ─── Module type [ Do not edit ] [ MANDATORY ] ───
# ─── ───
module_type report_builder__module_sla_reader |
Il est possible de définir plusieurs instances de module de type "broker__module_report_builder__module_sla_reader" dans une architecture Shinken.
- Chaque instance devra avoir un nom unique.
| Scroll Title | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||
|
Option de lecture du taux de SLA
| Code Block | ||||
|---|---|---|---|---|
| ||||
# ┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
# │ ────────────────────────────────────── SLA CALCULATION ────────────────────────────────────── │ #
# └─────────────────────────────────────────────────────────────────────────────────────────────────────┘ #
# ─── Some status can impact ───
# ─── -> positively (counted as OK/UP) ───
# ─── -> negatively (counted as CRITICAL/DOWN) ───
# ─── -> not impact the SLA ───
# ─── (is not counted, meaning the period of study is reduced by the period that is not counted). ───
# ─── This configuration aims at giving Shinken administrators a way to configure ───
# ─── how the SLA are calculated. ───
# ─── SLA are computed on a daily basis. ───
# ─── SLA of the current day are always recomputed after a configuration change. ───
# ─── SLA from days before are by default not recomputed. ───
# ───
# Default : 0 => Disable ( old SLA will not be recalculated ) ───
# ... : 1 => Enable ( old SLA will be recomputed with current settings ) ───
# ─── ───
# recompute_old_sla 0
# ─── Warning periods ───
# ───
# Default : 0 => Warning counts as DOWN ───
# ... : 1 => Warning counts as UP ───
# ─── ───
# warning_counts_as_ok 0
# ─── Unknown periods ───
# ───
# Default : include => "Unknown" status is counted negatively in the SLA. ───
# ... : exclude => "Unknown" are not counted from SLA considered period. ───
# ... : ok => "Unknown" are considered as UP periods ───
# ─── ───
# unknown_period include
# ─── No_data periods ( "Missing data" and "Shinken inactive" status ) ───
# ───
# Default : include => Only status is considered. "Missing data" and "Shinken inactive" ───
# status are counted negatively in the SLA. ───
# ... : exclude => No_data are not counted from SLA considered period. ───
# ... : ok => No_data are considered as UP periods. ───
# ─── ───
# no_data_period include
# ─── Downtime periods ───
# ───
# Default : include => Only status is considered. ───
# ... : exclude => Downtimes are not counted from SLA considered period. ───
# ... : ok => Downtimes are considered as UP periods. ───
# ... : critical => Downtimes are considered as DOWN periods. ───
# ─── ───
# downtime_period include |
| Scroll Title | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||
|
| Info |
|---|
Plus de détails sur ces paramètres et sur le fonctionnement des SLA sont disponibles sur cette page : Calcul du taux de SLA |
Accès à la base MongoDB
Cette configuration s'effectue dans le fichier de configuration du module.
Pour se connecter à la base MongoDB utilisée pour le stockage des données, 2 méthodes sont disponibles :
- Connexion directe : Par défaut, mais non sécurisée.
- Tunnel SSH : Shinken se connecte à la base MongoDB au travers d'une connexion SSH pour plus de sécurité.
Configuration des paramètres communs aux deux méthodes
| Code Block | ||||
|---|---|---|---|---|
| ||||
# ┌─────────────────────────────────────────────────────────────────────────────────────────────────────┐ #
# │ ──────────────────────────────────── DATABASE CONNECTION ──────────────────────────────────── │ #
# └─────────────────────────────────────────────────────────────────────────────────────────────────────┘ #
# ───────────────── MongoDB parameters ──────────────────────────────────────────────────────────────── #
# ─── MongoDB uri definition . You can find the mongodb uri syntax at ───
# ─── https://docs.mongodb.com/manual/reference/connection-string/ ───
# ───
# Default : mongodb://localhost/?w=1&fsync=false ───
# ─── ───
# uri mongodb://localhost/?w=1&fsync=false
# ─── Which database contains sla data ───
# ───
# Default : shinken ───
# ─── ───
# database shinken
# ─── username/password to authenticate to MongoDB. ───
# ─── Both parameters must be provided for authentication to function correctly. ───
# ─── ───
# database__username
# ─── ───
# database__password |
| Scroll Title | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||
|
Connexion directe au serveur MongoDB
Par défaut, le module se connecte de manière directe à la base MongoDB, avec les paramètres communs listés ci-dessus, et le paramètre "use_ssh_tunnel" défini à 0.
Connexion par SSH au serveur MongoDB
Par défaut, le module se connecte de manière directe à la base MongoDB pour y lire et écrire les données.
Dans la configuration du module, ceci correspond au paramètre "use_ssh_tunnel" à 0.
C'est la méthode de connexion par défaut lorsque la base est sur la même machine que le démon ( quand l'URL de la base est localhost ).
Si la base est sur une autre machine, il faudra alors se connecter à la base via un tunnel SSH. Cela permet à la base distance de rester en écoute réseau sur l'interface réseau local, ce qui la sécurise des accès extérieurs ( voir la pageSécurisation des connexions aux bases MongoDB ).
| Code Block | ||||
|---|---|---|---|---|
| ||||
# ─── SSH tunnel activation to secure your mongodb connection ───
# ─── That will allow all mongodb to be encrypted & authenticated with SSH ───
# ───
# Default : 0 => Disable ( disable ssh tunnel ) ───
# ... : 1 => Enable ( enable ssh tunnel ) ───
# ─── ───
# use_ssh_tunnel 0
# ─── If the SSH connection goes wrong, then retry use_ssh_retry_failure time before_shinken_inactive ───
# ───
# Default : 1 ( number of retry ) ───
# ─── ───
# use_ssh_retry_failure 1
# ─── SSH user to connect to the mongodb server. ───
# ───
# Default : shinken ───
# ─── ───
# ssh_user shinken
# ─── SSH keyfile to connect to the mongodb server. ───
# ───
# Default : ~shinken/.ssh/id_rsa ───
# ─── ───
# ssh_keyfile ~shinken/.ssh/id_rsa
# ─── SSH Timeout used to test if the SSH tunnel is viable or not, in seconds. ───
# ───
# Default : 10 ( seconds ) ───
# ─── ───
# ssh_tunnel_timeout 10 |
| Scroll Title | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||||||||||||||||||||||||||
|
Gestion de l'auto reconnexion avec un cluster MongoDB
| Code Block | ||||
|---|---|---|---|---|
| ||||
# ────────────── AutoReconnect Management ───────────────────────────────────────────────────────────── #
# ─── When MongoDB require you to reconnect ( For example, It can occur when a new PRIMARY is elected ───
# ─── in a MongoDB cluster ), it will raised the MongoDB AutoReconnect exception. ───
# ─── How many try to reconnect before module go in error ───
# ───
# Default : 4 ( number of try ) ───
# ─── ───
# auto_reconnect_max_try 4
# ─── Time between each try ───
# ───
# Default : 3 ( seconds ) ───
# ─── ───
# auto_reconnect_sleep_between_try 3
# ─── NOTE: Change these values only if you have a MongoDB cluster and you change the ───
# ─── heartbeatTimeoutSecs of your MongoDB replica set ───
# ─── The value of auto_reconnect_max_try * auto_reconnect_sleep_between_try must be higher than ───
# ─── heartbeatTimeoutSecs in the rs.conf(); of your MongoDB replica set. ─── |
| Info | ||
|---|---|---|
| ||
Primaire : terme de MongoDB pour désigner un serveur maître, le serveur sur lequel il est possible de faire des requêtes d'écriture dans la base. Élection : processus de MongoDB pour choisir un nouveau membre Primaire si le membre Primaire actuel devient inaccessible. Voir : Haute disponibilité de la base MongoDB (mise en place d'un cluster) |
Dans le cas de l'utilisation d'un cluster MongoDB, lorsque le membre Primaire devient inaccessible, une nouvelle élection est déclenchée, ce qui provoque une coupure temporaire de l'accès à la base.
Dans le but de ne pas interrompre le service, le module SLA va se reconnecter automatiquement au cluster MongoDB.
Il va faire un nombre d'essais égal au paramètre " auto_reconnect_max_try " avec une pause de X secondes entre chaque essai ( correspondant au paramètre "auto_reconnect_sleep_between_try" ).
Par défaut, pour MongoDB, le temps maximum avant qu'un membre Primaire ne soit considéré comme indisponible et qu'une nouvelle élection ait lieu, est de 10 secondes.
Voir : " heartbeatTimeoutSecs" donné par la commande rs . conf(); dans un shell de MongoDB.
| Scroll Title | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||
|
Les valeurs par défaut du fichier laissent 12 secondes, ce qui est amplement suffisant avec la configuration par défaut de MongoDB.
| Warning |
|---|
Il est conseillé de ne pas modifier ces valeurs. |