Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Scroll Ignore
scroll-pdftrue
scroll-officetrue
scroll-chmtrue
scroll-docbooktrue
scroll-eclipsehelptrue
scroll-epubtrue
scroll-htmltrue


Panel
titleSommaire

Table of Contents
stylenone



Rôle

Le démon broker Broker exporte et gère les données du Scheduler ( les objets Broks ).

  • Sa gestion ne peut se faire qu'à travers des modules.
  • Plusieurs modules de gestion peuvent être activés en même temps. 

Exemples de modules du Broker : 

  • Module pour centraliser les logs Shinken : Simple-log (flat file)Module pour exporter les données de métrologie: Graphite-Perfdata
  • Module pour l'API Livestatus Livedata
  • Module pour l'affichage de l'interface de visualisation : WebUI

Données: les Broks

Le Broker reçoit toutes les données des Schedulers . Il garde également en mémoire les données des hôtes et des checks.

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).

Image Removed

Données de métrologie

sous forme de Broks.

Info
titleLes Broks

Les Broks sont des conteneur de données échangées entre les Schedulers et les Brokers. Il y a plusieurs type de Broks :

  • Des évènements ( comme un Scheduler qui vient de démarrer ).
  • La configuration des éléments supervisés ( hôtes, checks, période de temps, utilisateurs ).
  • L'état des hôtes, clusters et checks après chaque vérification.


Le rôle du démon Broker est de donner ces données ( Broks ) à tous ses modules.


Image Added

Données de métrologie

Les données de métrologie sont sauvegardées sur le serveur du broker Broker dans l'application graphite.

Cette application écoute le port 2003, et cette connexion se fait sans authentification.

Cette application doit donc écouter exclusivement sur l'interface réseau locale ( loopback ) du serveur du brokerBroker

Logique interne du Broker 

Résumé des connexions du Broker  


SourceDestinationPortProtocoleNote
BrokerScheduler7768HTTP/HTTPS


Description des paramètres du Broker

Poller7771HTTP/HTTPSBrokerReactionner7769HTTP/HTTPSBrokerReceiver7773HTTP/HTTPSBrokerBroker (local)2003TCPinterface localhost uniquement

Description des variables

( centralisé sur le serveur de l'Arbiter, dans un fichier .cfg )


PropriétéDéfautDescription

broker_name

PropriétéDéfautDescription

broker_name

N/ACette variable est utilisée pour identifier le
*
nom réduit
*
du Broker auquel les données sont associées.

address

N/ACette 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

7772Cette directive est utilisée pour définir le port TCP utilisé par le démon.

use_ssl

0Cette 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

0Cette variable est utilisée pour définir si le
broker
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).
 spare_daemonN/ANom du démon spare qui sera utilisé pour reprendre le travail de ce démon s'il vient à ne plus être disponible

broker__manage_spare__spare_must_have_the_same_list_of_module_type

1Si cette option est désactivée ( 0 ), alors la configuration des modules du spare défini par spare_daemon ne sera pas vérifiée pour voir si elle corresponds bien à celle du master

timeout

3Cette 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 timeout ( l'Arbiter aura besoin de plus d'allers/retours pour le contacter ).

data_timeout

120Cette 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

3Si 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

60Intervalle de Ping toutes les N secondes.

modules

N/ACette variable est utilisée pour définir les modules chargés par le
broker
Broker.

realm

N/ACette variable est utilisée pour définir le royaume où le
broker
Broker doit être. Si aucun n'est sélectionné, celui par défaut lui sera assigné.

manage_sub_realms

1Cette variable est utilisée pour définir si le
broker
Broker prendra des tâches des Schedulers des sous-royaumes .

manage_arbiters

1Prends les données de l'Arbiter. Il ne devrait y avoir qu'un seul
broker
Broker pour l'Arbiter.

satellitemap

N/ACette variable est utilisée pour définir, pour des environnements NATés, les différents satellites comme vus depuis ce
broker
Broker.

broks_packet_size

204800Si présent, les demandes vers les
schedulers
Schedulers vont avoir comme limite haute de taille de paquet cette valeur ( en Ko ). Par défaut les envois sont illimités.

broker__manage_brok__enable_sub_processes_memory_usage_protection

1Si activé, le
broker
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

0Dans le cas de la protection de mémoire, on peut réserver un pourcentage de RAM pour le système qui ne sera pas considérée comme disponible par le démon

broker__manage_brok__sub_processes_memory_usage_protection_max_retry_time

5Dans le cas de la protection mémoire, pendant combien de temps le
broker
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

5Temps ( en
seconde
secondes ) que le
broker
Broker va laisser aux workers qui poussent les broks vers les modules externes pour s'exécuter.

broker__manage_brok__sub_process_broks_pusher_security_ratio

5Le
broker
Broker va estimer le temps d'exécution des workers qui poussent les broks en se basant sur leur moyenne passée, et va appliquer ce ratio multiplicateur comme timeout d'exécution.

broker__manage_brok__sub_process_broks_pusher_max_execution_timeout

240Temps ( en secondes ) que le
broker
Broker va laisser aux workers qui poussent les broks vers les modules externes pour s'exécuter.

broker__manage_brok__sub_process_broks_pusher_max_retry

3Nombre de tentatives où le
broker
Broker va relancer les workers qui poussent les broks avant d’arrêter et tuer le module lié.

enabled

N/ACette variable est utilisée pour définir si le broker est activé ou non.
broker__manage_brok__sub_process_broks_pusher_queue_batch_size100000

Taille maximum en nombres de Broks que peuvent faire les workers qui poussent les broks aux modules externes ( comme WebUI ).

Attention, trop augmenter cette limite peux poser des problèmes d'envoi trop importants pour la socket de communication.

enabled

N/ACette 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 )  :

(warning) Il est conseillé d'éditer les fichiers .cfg

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)  :

(warning) Il est conseillé d'éditer les fichiers .cfg avec l'encodage utf-8

Code Block
languagebash
#===============================================================================
# BROKER
#===============================================================================
# Description: The brokerBroker 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 {=======

define broker {

    #======== Daemon name and address =========
    # Daemon name. Must be unique
    broker_name               broker-master

    # IP/fqdn of this daemon (note: you MUST change it by the real ip/fqdn of this server)
    address                   localhost

    # Port (HTTP/HTTPS) exposed by this daemon
    port                      7772

    #======== Daemon name and address ========= 0 = use HTTP, 1 = use HTTPS
    #use_ssl	 Daemon name. Must be unique
    broker_name         0


    #======== Master broker-master

or spare selection  # IP/fqdn of this daemon (note: you MUST change it by the real ip/fqdn of this server)
    address=========
    # 1 = is a spare, 0 = is not a spare
    spare                     localhost0

    # Port (HTTP/HTTPS) exposed by this daemon
    port     spare_daemon: name of the daemon that will take this daemon job if it dies
    # IMPORTANT:
    #        7772

    # 0 = use HTTP, 1 = use HTTPS* a spare_daemon can only be the spare of 1 (and only one) master daemon
    use_ssl	#   * a spare_daemon cannot have a spare_daemon
    #   * the spare 0


must have modules  #======== Master or spare selection =========with the same module_type as the master
    # 1  = is a- spare,depending 0of =the isvalue notof athe spare
    spare broker__manage_spare__spare_must_have_the_same_list_of_module_type parameter
    # Example: spare_daemon              0broker-spare

    # spare_daemon: name of the daemon that will take this daemon job if it dies

    # IMPORTANT:
1 = (default) the #spare defined with * a spare_daemon canmust only behave the spare of 1 (and only one) master daemonsame module_type as this master
    # 0 = *the aspare sparemodule_daemontype cannotare have a spare_daemonnot checked
    # broker__manage_spare__spare_must_have_the_same_list_of_module_type  * the spare must have modules with the same module_type as the master
    #  1


    #======== Daemon connection timeout and down state limit =========
    -# dependingtimeout: ofhow themany valueseconds ofto the broker__manage_spare__spare_must_have_the_list_of_module_type parmeterconsider a node don't answer
    #timeout Example: spare_daemon              broker-spare
    spare_daemon3

    # 1 = (default) the spare defined with spare_daemon must have the same module_type as this master
    # 0 = the spare module_type are not checked
    # broker__manage_spare__spare_must_have_the_list_of_module_type     1


    #======== Daemon connection timeout and down state limit =========
    # timeout: how many seconds to consider a node don't answer
    timeout       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            360



    # data_timeout: how many second to consider a configuration transfert to be failed======== Modules to enable for this daemon =========
    # Available:
    # because the network brandwith is too small.
 - Simple-log           data_timeout : save all logs into a common file
    # - 120

WebUI    # max_check_attempts: how many fail check to consider this daemon as DEAD
  :  max_check_attemptsvisualisation interface
    # - Graphite-Perfdata  3

   : #save Checkall thismetrics daemoninto everya Xgraphite secondsdatabase
    check_interval# -    sla       60



     #======== Modules to enable for this daemon =========
    # Available: : save sla into a database
    # - Simple-logLivestatus            : save all logs into a common file
    # - WebUI TCP API to query element state, used by nagios external tools like NagVis or Thruk
    modules                   Simple-log,  : visualisation interfaceWebUI, Graphite-Perfdata, sla, event-manager-writer
    #

 - Graphite-Perfdata  #======== Realm and :architecture save all metrics into a graphite database
    # - slasettings =========
    # Realm to set this daemon into
    realm               : save sla into a databaseAll

    # -1 Livestatus= take data from the daemon realm and its sub realms
  : TCP API# to0 query= elementtake state,data usedonly byfrom nagiosthe externaldaemon toolsrealm
 like NagVis or Thruk
 manage_sub_realms    modules    1


    # In NATted environments, you declare each satellite ip[:port] as  Simple-log, WebUI, Graphite-Perfdata, sla, event-manager-writer
    

    #======== Realm and architecture settings =========seen by
    # *this* Broker (if port not set, the port declared by satellite itself
    # Realmis toused)
 set this daemon into
#satellitemap    realm scheduler-1=1.2.3.4:7768, poller-1=1.2.3.5:7771

    # Exchange between brokers <- schedulers can be   limited by packet size (in All
kB)
    # 1 = take data from the daemon realm and its sub realmsNote: as compression is automatic, this is a higher limit, and in real case the
    # 0 = take data only from thepackets daemonwill realm
be lower than  manage_sub_realmsthis value
    #    1broks_packet_size 1024


    # In NATted environments, you declare each satellite ip[:port] as seen by
    # *this* broker (if port not set, the port declared by satellite itself
    # is used)
    #satellitemap    scheduler-1=1.2.3.4:7768, poller-1=1.2.3.5:7771======== Memory protection =========
    # 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

    # ExchangeThe sub betweenprocess brokersmemory <-usage schedulersprotection can have a system reserved memory
    # that won't be limitedused by theses packetsub sizeprocess (inwhen kB)launched
    # NoteBy default: as compression is automatic, this is a higher limit, and in real case the
    #       packets will be lower than this value
    # broks_packet_size 1024


    #======== Memory protection =========0 (no reserved memory)
    # Example: 10  (means 10% of the total memory is reserved for the system)
    broker__manage_brok__sub_process_memory_usage_system_reserved_memory    0

    # If a sub process cannot be started because of the protection, how many seconds
    # Areit thewill daemonbe module processretry and workerwait processthat arethe waitingsystem formemory enough
is  freed until #it memoryfail to bestart
  available before being# launch.By Defaultdefault: 15 (enabledseconds)
    broker__manage_brok__enable_sub_processes_memory_usage_protection_max_retry_time   15


    # The sub process memory usage protection can have a system reserved memory======== Brok pusher worker =========
    # thatThe won'tBroker bespawn usedbroks by thesespusher sub process whento launched
push to external  # By default: 0 (no reserved memorymodules (like WebUI)
    # Example: 10  (means 10% of the totalBroker memorywill islook reservedat for the system)
    broker__manage_brok__sub_process_memory_usage_system_reserved_memory    0
this worker execution time, and will kill if it timeout
    # IfThe aBroker subwill processcompute cannotthe beaverage startedexecution becausetime of previous theworkers protection,to
 how many seconds
 # decide about #how itmany willtime bethis retryworker andwill waittake thatbased theon:
 system memory is freed# untilnumber itof failbroks to start
send / past average #send Byspeed default: 5 (seconds(broks/s)
    #  broker__manage_brok__sub_processes_memory_usage_protection_max_retry_time   5


    #======== Brok pusher worker =========
    # The broker spawn broks pusher sub process to push to external modules (like WebUI)
    # the broker will look at this worker execution time, and will kill if itIf this time is reach, it means that the pusher process is killed

    # For small amount of broks to send, it should lead to ridicusly small allowed execution time
    # and the fac to spawn the sub process can be higher than this value, so we are using a minimal
    # execution timeout
    # TheDefault: broker will compute the average execution time of previous workers to
5 (second)
    broker__manage_brok__sub_process_broks_pusher_min_execution_timeout         # decide about5

 how many time this# workerIn willorder taketo basedmanage on:
the fact that the #server numbercan ofslow broksdown toduring send / past average send speed (broks/s)this send, you can setup a
    # Ifratio thisthat timewill isbe reach,used itto meansincrease thatthe theallowed pushertimeout processby ismultiply killed
it
    # For small amount of broks to send, it should lead to ridicusly small allowed execution time
    # and the fac to spawn the sub process can be higher than this value, so we are using a minimal
    # execution Default: 5
    broker__manage_brok__sub_process_broks_pusher_security_ratio                  5

    # At the broker start without stats, this valud will be used for the timeout
    # Default: 5240 (secondseconds)
    broker__manage_brok__sub_process_broks_pusher_minmax_execution_timeout           5240

    # InIf a ordersub toprocess managereach thea facttimeout, thatit thewill serverbe cankilled slowand downrelaunched. duringAfter thismax send, you can setup aretry,
    # the ratioattached thatmodule will be used to increase the allowed timeout by multiply itrestarted
    # Default: 53
    broker__manage_brok__sub_process_broks_pusher_security_ratiomax_retry                       53

    # At the broker start without stats, this valud will be used for the timeout
    # Default: 240 (seconds)
    broker__manage_brok__sub_process_broks_pusher_max_execution_timeout           240
broker__manage_brok__sub_process_broks_pusher_queue_batch_size:
    #   * defines the maximum number of broks the "queue brok pusher"
    #     process will handle per send to external module ( like WebUI ) .
    # If a sub process reach a timeout, it will be killed and relaunched. After max retry,
    # the attached module will be restarted  * Remaining broks will be handled in next send.
    #   * IMPORTANT: increase this value can lead to error on the socket
    # Default: 3 100000 (broks/batch)
    # broker__manage_brok__sub_process_broks_pusher_maxqueue_batch_retrysize                       3100000


     # #======== Enable or not this daemon =========
    # 1 = is enabled, 0 = is disabled
    enabled                  1

}