...
Enfin, il sauvegarde les résultats des checks dans une base mongodb (si possible, cette base doit être installée sur le même serveur que le broker).
Données de métrologie
Les données de métrologie sont sauvegardées sur le serveur du broker dans l'application graphite.
...
| Source | Destination | Port | Protocole | Note | |
|---|---|---|---|---|---|
| Broker | Scheduler | 7768 | HTTP/HTTPS | ||
| Broker | Poller | 7771 | HTTP/HTTPS | ||
| Broker | Reactionner | 7769 | HTTP/HTTPS | ||
| Broker | Receiver | 7773 | HTTP/HTTPS | ||
| Broker | Broker (local) | 2003 | TCP | interface localhost uniquement |
Description des variables
...
| Propriété | Défaut | Description |
|---|---|---|
| broker_name | N/A | Cette variable est utilisée pour identifier le *nom réduit* du Broker auquel les données sont associées. |
| address | N/A | Cette directive est utilisée pour définir l'adresse permettant de joindre ce Broker. Par défaut "localhost", changez le par un nom DNS ou une adresse IP. |
| port | 7772 | Cette directive est utilisée pour définir le port TCP utilisé par le démon. |
| use_ssl | 0 | Cette variable est utilisée pour définir si le Broker doit être contacté en HTTPS (*1*) ou HTTP (*0*). La valeur par défaut est *0* (HTTP). |
| spare | 0 | Cette variable est utilisée pour définir si le broker peut être géré comme un spare (prendra uniquement la configuration si le maître échoue). La valeur par défaut est *0* (maître). |
| timeout | 3 | Cette variable est utilisée pour définir le temps en secondes avant que l'Arbiter ne considére ce démon comme à l'arrêt. Si ce démon est joignable en HTTPS (use_ssl à 1) avec une latence élevée, nous vous conseillons alors d'augmenter cette valeur de timout (l'Arbiter aura besoin de plus d'allers/retours pour le contacter). |
| data_timeout | 120 | Cette variable est utilisée pour définir le temps en secondes avant de considérer un transfert de configuration ou de données comme échoué. |
| max_check_attempts | 3 | Si le ping permettant de détecter la disponibilité réseau du nœud est en échec N fois ou plus, alors le nœud est considéré comme mort. (par défaut, 3 tentatives) |
| check_interval | 60 | Intervalle de Ping toutes les N secondes. |
| modules | N/A | Cette variable est utilisée pour définir les modules chargés par le broker. |
| realm | N/A | Cette variable est utilisée pour définir le royaume où le broker doit être. Si aucun n'est sélectionné, celui par défaut lui sera assigné. |
| manage_sub_realms | 1 | Cette variable est utilisée pour définir si le broker prendra des tâches des Schedulers des sous-royaumes . |
| manage_arbiters | 1 | Prend les données de l'arbiter. Il ne devrait y avoir qu'un seul broker pour l'arbiter. |
| satellitemap | N/A | Cette variable est utilisée pour définir, pour des environnements NATés, les différents satellites comme vus depuis ce broker. |
| enabled | N/A | Cette variable est utilisée pour définir si le broker est activé ou non. |
Définition - exemple
Dans le répertoire /etc/shinken/brokers/, voici un exemple de définition qui permet la définition du Broker (à placer dans un fichier CFG) :
broker__manage_brok__enable_sub_processes_memory_usage_protection | 1 | Si activé, le broker va vérifier qu'il y a assez de RAM disponible sur le système avant de lancer ses processus workers qui poussent les broks vers les modules externes (comme WebUI) |
broker__manage_brok__sub_process_memory_usage_system_reserved_memory | 0 | Dans le cas de la protection de mémoire, on peux réserver un pourcentage de RAM pour le système qui ne sera pas considérée comme disponible par le daemon |
broker__manage_brok__sub_processes_memory_usage_protection_max_retry_time | 5 | Dans le cas de la protection mémoire, pendant combien de temps le broker va attendre (en secondes) avant de considérer qu'il n'a pas assez de mémoire, ce qui aura comme conséquence de tuer le module externe concerné. |
broker__manage_brok__sub_process_broks_pusher_min_execution_timeout | 5 | Temps (en seconde) que le broker va laisser aux workers qui poussent les broks vers les modules externes pour s'éxécuter. |
broker__manage_brok__sub_process_broks_pusher_security_ratio | 5 | Le broker va estimer le temps d'éxécution des workers qui poussent les broks en se basant sur leur moyenne passée, et va appliquer ce ratio multiplicateur comme timeout d'execution. |
broker__manage_brok__sub_process_broks_pusher_max_execution_timeout | 240 | Temps (en secondes) que le broker va laisser aux workers qui poussent les broks vers les modules externes pour s'éxécuter. |
broker__manage_brok__sub_process_broks_pusher_max_retry | 3 | Nombre de tentatives où le broker va relancer les workers qui poussent les broks avant d’arrêter et tuer le module lié. |
| enabled | N/A | Cette variable est utilisée pour définir si le broker est activé ou non. |
Définition - exemple
Dans le répertoire /etc/shinken/brokers/, voici un exemple de définition qui permet la définition du Broker (à placer dans un fichier CFG) :
| Code Block |
|---|
#===============================================================================
# BROKER
#===============================================================================
# Description: The broker is responsible for:
# - Exporting centralized logs of all Shinken daemon processes
# - Exporting status data
# - Exporting performance data
# - Exposing Shinken APIs:
# - Status data
# - Performance data
# - Command interface
#===============================================================================
define broker {
#======== Daemon name and address =========
# Daemon name. Must be unique
broker_name broker-1
# IP/fqdn of this daemon (note: you MUST change it by the real ip/fqdn of this server)
address node1.mydomain
# Port (HTTP/HTTPS) exposed by this daemon
port 7772
# 0 = use HTTP, 1 = use HTTPS
use_ssl 0
#======== Master or spare selection =========
# 1 = is a spare, 0 = is not a spare
spare 0
#======== Daemon connection timeout and down state limit =========
# timeout: how many seconds to consider a node don't answer
timeout 3
# data_timeout: how many second to consider a configuration transfert to be failed
# because the network brandwith is too small.
data_timeout 120
# max_check_attempts: how many fail check to consider this daemon as DEAD
max_check_attempts 3
# Check this daemon every X seconds
check_interval 60
#======== Modules to enable for this daemon =========
# Available:
# - Simple-log : save all logs into a common file
# - WebUI : visualisation interface
# - Graphite-Perfdata : save all metrics into a graphite database
# - sla : save sla into a database
# - Livestatus : TCP API to query element state, used by nagios external tools like NagVis or Thruk
modules Simple-log, WebUI, Graphite-Perfdata, sla
|
| Code Block |
#=============================================================================== # BROKER #=============================================================================== # Description: The broker is responsible for: # - Exporting centralized logs of all Shinken daemon processes # - Exporting status data # - Exporting performance data # - Exposing Shinken APIs: # - Status data # - Performance data # - Command interface #=============================================================================== define broker { #======== DaemonRealm nameand andarchitecture addresssettings ========= # Daemon name. Must be unique # Realm to set this daemon into realm broker_name broker-1All # IP/fqdn1 of= thistake daemondata (note:from youthe MUSTdaemon changerealm itand byits the real ip/fqdn of this server) address sub realms # 0 = take data only from the daemon realm manage_sub_realms node1.mydomain1 # Port (HTTP/HTTPS) exposed by this daemon portIs enabled, then this broker will receive data (logs and) from the arbiter manage_arbiters 1 # In NATted environments, 7772 you declare each satellite # 0 = use HTTP, 1 = use HTTPS use_ssl ip[:port] as seen by # *this* broker (if port not set, the port declared by satellite itself # is used) #satellitemap 0scheduler-1=1.2.3.4:7768, poller-1=1.2.3.5:7771 #======== MasterMemory or spare selection protection ========== # 1 = is a spare, 0 = is not a spare spare 0 #======== Daemon connection timeout and down state limit ========= # Are the daemon module process and worker process are waiting for enough # memory to be available before being launch. Default: 1 (enabled) broker__manage_brok__enable_sub_processes_memory_usage_protection 1 # The sub process memory usage protection can have a system reserved memory # timeout: how many seconds to consider a node don't answerthat won't be used by theses sub process when launched timeout# By default: 0 (no reserved memory) # Example: 10 (means 10% of the total 3 memory # data_timeout: how many second to consider a configuration transfert to be failedis reserved for the system) broker__manage_brok__sub_process_memory_usage_system_reserved_memory 0 # because the network brandwith is too small. data_timeout If a sub process cannot be started because of the protection, how many seconds # it will be retry and wait that the system 120 memory is freed until # max_check_attempts: how many fail check to consider this daemon as DEADit fail to start # By default: 5 (seconds) broker__manage_brok__sub_processes_memory_usage_protection_max_check_attemptsretry_time 5 #======== Brok pusher 3 worker ========= # CheckThe thisbroker daemonspawn everybroks Xpusher seconds sub process to push check_intervalto external modules 60 (like WebUI) #======== Modules to enable for this daemon ========= # Available: the broker will look at this worker execution time, and will kill if it timeout # -The Simple-logbroker will compute the average execution time of previous workers to : save all logs into a common file # - WebUI # decide about how many time this worker will take based on: # number of broks to send / past average :send visualisation interfacespeed (broks/s) # -If Graphite-Perfdatathis time is reach, it :means savethat allthe metrics intopusher aprocess graphiteis databasekilled # -For slasmall amount of broks to send, it should lead to ridicusly small allowed execution time # :and savethe slafac intoto aspawn database the sub process can #be -higher Livestatusthan : TCP API to query element state, used by nagios external tools like NagVis or Thruk modulesthis value, so we are using a minimal # execution timeout # Default: 5 (second) broker__manage_brok__sub_process_broks_pusher_min_execution_timeout 5 # In order to manage the Simple-log, WebUI, Graphite-Perfdata, sla #======== Realm and architecture settings =========fact that the server can slow down during this send, you can setup a # Realmratio tothat setwill thisbe daemonused into to increase the allowed realmtimeout by multiply it # Default: 5 broker__manage_brok__sub_process_broks_pusher_security_ratio All # 1 = take data from the5 daemon realm and its# subAt realms the broker start without #stats, 0this =valud takewill databe onlyused fromfor the daemon realmtimeout manage_sub_realms 1 # Default: 240 (seconds) broker__manage_brok__sub_process_broks_pusher_max_execution_timeout # Is enabled, then this broker will receive240 data (logs and) from# theIf arbiter a sub process reach manage_arbitersa timeout, it will be killed and relaunched. After max 1retry, # Inthe attached NATtedmodule environments,will yoube declarerestarted each satellite ip[:port] as# seenDefault: by3 # *this* broker (if port not set, the port declared by satellite itself broker__manage_brok__sub_process_broks_pusher_max_retry # is used) #satellitemap scheduler-1=1.2.3.4:7768, poller-1=1.2.3.5:7771 #======== Enable or not this daemon ========= # 1 = is enabled, o = is disabled enabled 1 } |
...
