| Scroll Ignore | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
|
Concept
DescriptionLe module de type event-manager-reader est un module qui permet au module WebUI ( l'interface Interface de visualisation Visualisation ) du broker Broker d'afficher le bac ร รฉvรฉnementsรฉvรฉnement ( voir la page Vue - Les รvรฉnements ).
- Il rรฉcupรจre les รฉvรฉnements en base de donnรฉe des รฉvรฉnements.
- Il doit donc รชtre listรฉ dans la liste des modules du module de type WebUI ( cfย voir la page Module WebUI, propriรฉtรฉ "modules" ).
| Warning |
|---|
Pour que la fonctionnalitรฉ le menu "bac ร รฉvรฉnement" apparaisse dans l'interface, il faut absolument que ce module soit activรฉ. |
| Info |
|---|
Si vous avez plusieurs configurations de web-ui prรฉsente du module WebUI prรฉsentes dans votre architecture, n'oubliez pas d'activer le module "event-manager-reader" dans chaque configuration. Exemple :ย
|
Configuration .cfg
Activation du module
Le module
event-manager-readerย est un module qui peut รชtre activรฉ seulement sur le module WebUI.
- L'activation du module s'effectue en ajoutant le nom de ce module dans le fichier de configuration du module WebUI.
- Pour ce faire, il faut ouvrir le fichier de configuration du module WebUI du Broker ร l'emplacement /etc/shinken/module/ma_webui.cfg, et ajouter le nom du module "
event-manager-reader".
Exemple : par dรฉfaut, est livrรฉ un module dont le nom est "event-manager-reader":
| Code Block | ||||
|---|---|---|---|---|
| ||||
define module {
[...]
modules ย ย ย ย ย ย ย ย ย Module 1, Module 2, Module 3, event-manager-reader
ย [...]
} |
Pour prendre en compte le changement de configuration, redรฉmarrer l'Arbiter:
| Code Block | ||||
|---|---|---|---|---|
| ||||
service shinken-arbiter restart |
Configuration
La configuration du module livrรฉ par dรฉfaut se trouve dans le fichier/etc/shinken/modules/event_manager_reader.cfg
- Un fichier d'exemple est disponible ici : /etc/shinken-user-example/configuration/daemons/brokers/modules/event_manager_reader/event_manager_reader-example.cfg
Exemple de fichier de configuration
| Code Block | ||||
|---|---|---|---|---|
| ||||
# CFG_FORMAT_VERSION 1 ( SHINKEN : DON'T TOUCH THIS LINE )
#================================================================================
# event manager
#================================================================================
# Modules that can load this module:
# - WebUI (to display events data to the users)
# This module read event from database to show you in the WebUI
#================================================================================
define module {
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ #
# โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ MODULE IDENTITY โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ #
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ #
# โโโ Module name [ Must be unique ] [ MANDATORY ] โโโ
# โโโ โโโ
module_name event-manager-reader
# โโโ Module type [ Do not edit ] [ MANDATORY ] โโโ
# โโโ โโโ
module_type event_container
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ #
# โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 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 events data โโโ
# โโโ
# Default : event_container โโโ
# โโโ โโโ
# database event_container
# โโโ username/password to authenticate to MongoDB. โโโ
# โโโ Both parameters must be provided for authentication to function correctly. โโโ
# โโโ โโโ
# broker__module_webui__module_event_manager_reader__database__username
# โโโ โโโ
# broker__module_webui__module_event_manager_reader__database__password
# โโโ SSH tunnel activation to secure your mongodb connection โโโ
# โโโ That will allow all mongodb to be encrypted & authenticated with SSH โโโ
# โโโ
# ... : Enable => 1 ( enable ssh tunnel ) โโโ
# Default : Disable => 0 ( disable ssh tunnel ) โโโ
# โโโ โโโ
# use_ssh_tunnel 0
# โโโ If the SSH connection goes wrong, then retry use_ssh_retry_failure time before_shinken_inactive โโโ
# โโโ
# Default : 1 ( try ) โโโ
# โโโ โโโ
# 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 ( 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. โโโ
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ #
# โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ VISUALISATION UI โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ #
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ #
# โโโ Specify the max retries when the Visualisation UI can't communicate with the event_manager_reader โโโ
# โโโ during the Excel export. โโโ
# โโโ Increase this parameter when users encounter difficulties when generating the Excel export โโโ
# โโโ of events. This will make the export more tolerant to network loss or database slowness, โโโ
# โโโ or restart of the broker. โโโ
# โโโ The value cannot be 0. โโโ
# โโโ
# Default : 2 ( try ) โโโ
# โโโ โโโ
# broker__module_webui__module_event_manager_reader__events_export__max_retry 2
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ #
# โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ INTERNAL OPTIONS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ #
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ #
# โโโ INTERNAL : DO NOT EDIT FOLLOWING PARAMETER WITHOUT YOUR DEDICATED SUPPORT โโโ
# โโโ Broker idle time before considering that Shinken is inactive. โโโ
# โโโ Use this if you have Broker loop time that exceeds 30 seconds โโโ
# โโโ
# Default : 30 ( seconds ) โโโ
# โโโ โโโ
# time_before_shinken_inactive 30
} |
Dรฉtails des sections composant le fichier de configuration
Identification du module
Il est possible de dรฉfinir plusieurs instances de module de type "event-manager-reader" dans l'architecture Shinken.
- Chaque instance devra avoir un nom unique.
| Scroll Title | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||
|
Accรจs ร la base MongoDB
Cette configuration s'effectue dans le fichier de configuration du module.ย
Pour se connecter ร la base MongoDB utilisรฉ pour le stockage des donnรฉes, deux 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'un module SSH pour plus de sรฉcuritรฉ.
Configuration de l'URI de connexion et de l'authentification par mot de passe
| 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 events data โโโ
# โโโ
# Default : event_container โโโ
# โโโ โโโ
# database event_container
# โโโ username/password to authenticate to MongoDB. โโโ
# โโโ Both parameters must be provided for authentication to function correctly. โโโ
# โโโ โโโ
# broker__module_webui__module_event_manager_reader__database__username
# โโโ โโโ
# broker__module_webui__module_event_manager_reader__database__password |
| Scroll Title | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||||
|
Connexion directe 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 ).
Connexion par SSH au serveur MongoDB
| Code Block | ||||
|---|---|---|---|---|
| ||||
ย ย # โโโ SSH tunnel activation to secure your mongodb connection โโโ
# โโโ That will allow all mongodb to be encrypted & authenticated with SSH โโโ
# โโโ
# ... : Enable => 1 ( enable ssh tunnel ) โโโ
# Default : Disable => 0 ( disable ssh tunnel ) โโโ
# โโโ
# use_ssh_tunnel 0
# โโโ If the SSH connection goes wrong, then retry use_ssh_retry_failure time before_shinken_inactive โโโ
# โโโ
# Default : 1 ( try ) โโโ
# โโโ
# 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 ( 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 | ||
|---|---|---|
| ||
( voir la page 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 "event-manager-reader" va se reconnecter automatiquement au cluster MongoDB.
Pour ce faire, il va faire un nombre d'essais รฉgaux 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 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รฉfauts 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. |
Configuration pour l'interface de visualisation
| Code Block | ||||
|---|---|---|---|---|
| ||||
ย # โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ #
# โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ VISUALISATION UI โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ #
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ #
# โโโ Specify the max retries when the Visualisation UI can't communicate with the event_manager_reader โโโ
# โโโ during the Excel export. โโโ
# โโโ Increase this parameter when users encounter difficulties when generating the Excel export โโโ
# โโโ of events. This will make the export more tolerant to network loss or database slowness, โโโ
# โโโ or restart of the broker. โโโ
# โโโ The value cannot be 0. โโโ
# โโโ
# Default : 2 ( try ) โโโ
# โโโ
# broker__module_webui__module_event_manager_reader__events_export__max_retry 2 |
Le paramรจtre "broker__module_webui__module_event_manager_reader__events_export__max_retry" permet de configurer le nombre maximal de tentatives lorsque l'interface de visualisation ne peut pas communiquer avec le module event_manager_reader pendant l'export des donnรฉes vers Excel.
Cela rendra les exports plus tolรฉrants aux pertes de rรฉseau ou aux lenteurs de la base de donnรฉes, ou aux redรฉmarrages du Broker.
| Scroll Title | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|
Options Internes
| Code Block | ||||
|---|---|---|---|---|
| ||||
ย ย # โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ #
# โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ INTERNAL OPTIONS โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ #
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ #
# โโโ INTERNAL : DO NOT EDIT FOLLOWING PARAMETER WITHOUT YOUR DEDICATED SUPPORT โโโ
# โโโ Broker idle time before considering that Shinken is inactive. โโโ
# โโโ Use this if you have Broker loop time that exceeds 30 seconds โโโ
# โโโ
# Default : 30 ( seconds ) โโโ
# | .cfg#=============================================================================== # event manager #=============================================================================== # Modules that can load this module: # - WebUI (to display events data to the users) # This module read event from database to show you in the WebUI #=============================================================================== define module { #======== Module identity ========= # Module name. Must be unique module_name event-manager-reader # Module type (to load module code). Do not edit. module_type event_container #======== Database connection ========= # mongodb uri definition for connecting to the mongodb database. You can find the mongodb uri # syntax at https://docs.mongodb.com/manual/reference/connection-string/ uri mongodb://localhost/?w=1&fsync=false # If you want to securize your mongodb connection you can enable the ssh use_ssh_tunnel that will # allow all mongodb to be encrypted & authentificated with SSH # Should use a SSH tunnel (Default 0=False) # use_ssh_tunnel 0 # If the SSH connection goes wrong, then retry use_ssh_retry_failure time before_shinken_inactive # Default: 1 # use_ssh_retry_failure 1 # SSH user/keyfile in order to connect to the mongodb server. # Default: shinken # ssh_user shinken # Default: ~shinken/.ssh/id_rsa # ssh_keyfile ~shinken/.ssh/id_rsa # Which database is used to store events data database โโโ # time_before_shinken_inactive event_container #======== INTERNAL options ========= #INTERNAL : DO NOT EDIT FOLLOWING PARAMETER WITHOUT YOUR DEDICATED SUPPORT # == time of inactivation of the broker before considering that shinken is inactive (in sec) == #time_before_shinken_inactive 30 } 30 |
| Warning |
|---|
Ces paramรจtres sont dรฉdiรฉs au fonctionnement interne au module, il est fortement recommandรฉ de ne pas les modifier sans votre support dรฉdiรฉ. |
| Scroll Title | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|