Explication

Le module broker-module-livedata permet d'envoyer des requêtes API afin de recevoir des informations sur un hôte, un cluster, un check attaché à un hôte ou un check attaché à un cluster. Il est possible de modifier certains paramètres dans la configuration.

Configuration

Voici le fichier CFG de configuration présent dans : /etc/shinken/modules/broker-module-livedata.cfg

#===============================================================================
# broker module livedata
#===============================================================================
# Daemons that can load this module:
# - broker
# This module is an api getting information from the broker
#===============================================================================

define module {

    #======== Module identity =========
    # Module name. Must be unique
    module_name               broker-module-livedata

    # Module type (to load module code). Do not edit.
    module_type               broker_module_livedata

    #======== Listening address =========
    # host: IP address to listen to.
    #       note: 0.0.0.0 = all interfaces.
    host                      0.0.0.0
    # port to listen
    port                      8000

    # HTTPs part, enable if you want to set the visualisation interface listen in HTTPs mode
    # disabled by default. Set your own certificates. Set your own token, it is usefull to get access to the API
    use_ssl                   0
    ssl_cert                  /etc/shinken/certs/server.cert
    ssl_key                   /etc/shinken/certs/server.key
    token                     ak5zv6t5s25r6g4

    #======== Security =========
    # auth_secret: secret key used to crypt cookie.
    # note: must be the same as the configuration UI
    auth_secret                 THIS SHOULD BE CHANGED BEFORE PRODUCTION
}


Fonctionnement

L'accès à cette API est restreinte aux détenteurs d'un token généré dans la configuration (modifiable par l'utilisateur) du module. Le fonctionnement de l'api est tel que : 

URL/V1/cluster/UUID?token=TOKEN

  • Retourne
    • cluster_uuid : text
    • cluster_name : text
    • cluster_display_name : text
    • status : text
      • OK
      • WARNING
      • CRITICAL
      • UNKNOWN
      • MISSING-DATA
      • SHINKEN-INACTIVE
    • status_since : epoch (en secondes)
    • context : text
      • NOTHING
      • ACKNOWLEDGED
      • PARTIAL-ACKNOWLEDGED
      • INHERITED-ACKNOWLEDGED
      • DOWNTIME
      • PARTIAL-DOWNTIME
      • INHERITED-DOWNTIME
      • FLAPPING
      • PARTIAL-FLAPPING
      • DISABLED
    • business_impact : 0, 1, 2, 3, 4, 5
    • output : text
    • long_output : text

 

  • URL/V1/check-on-cluster/UUID?token=TOKEN
    • Retourne
      • check_uuid : text
      • check_name : text
      • check_display_name : text
      • status : text
        • OK
        • WARNING
        • CRITICAL
        • UNKNOWN
        • MISSING-DATA
        • SHINKEN-INACTIVE
    • status_since : epoch (en secondes)
    • context : text
      • NOTHING
      • ACKNOWLEDGED
      • PARTIAL-ACKNOWLEDGED
      • INHERITED-ACKNOWLEDGED
      • DOWNTIME
      • PARTIAL-DOWNTIME
      • INHERITED-DOWNTIME
      • FLAPPING
      • PARTIAL-FLAPPING
      • DISABLED
    • output : text
    • business_impact : 0, 1, 2, 3, 4, 5
    • long_output : text
    • host_uuid : text
    • host_name : text
    • host_display_name : text
    • business_impact : 0, 1, 2, 3, 4, 5
    • status_since : epoch (en secondes)


  • URL/V1/host/UUID?token=TOKEN
    • Retourne
      • host_uuid : text
      • host_name : text
      • host_display_name : text
      • status : text
        • OK
        • WARNING
        • CRITICAL
        • UNKNOWN
        • MISSING-DATA
        • SHINKEN-INACTIVE
    • status_since : epoch (en secondes)
    • context : text
      • NOTHING
      • ACKNOWLEDGED
      • PARTIAL-ACKNOWLEDGED
      • INHERITED-ACKNOWLEDGED
      • DOWNTIME
      • PARTIAL-DOWNTIME
      • INHERITED-DOWNTIME
      • FLAPPING
      • PARTIAL-FLAPPING
      • DISABLED
    • business_impact : 0, 1, 2, 3, 4, 5
    • output : text
    • long_output : text


  • URL/V1/check-on-host/UUID?token=TOKEN
    • Retourne
      • check_uuid : text
      • check_name : text
      • check_display_name : text
      • status : text
        • OK
        • WARNING
        • CRITICAL
        • UNKNOWN
        • MISSING-DATA
        • SHINKEN-INACTIVE
    • status_since : epoch (en secondes)
    • context : text
      • NOTHING
      • ACKNOWLEDGED
      • PARTIAL-ACKNOWLEDGED
      • INHERITED-ACKNOWLEDGED
      • DOWNTIME
      • PARTIAL-DOWNTIME
      • INHERITED-DOWNTIME
      • FLAPPING
      • PARTIAL-FLAPPING
      • DISABLED
    • output : text
    • business_impact : 0, 1, 2, 3, 4, 5
    • long_output : text
    • cluster_uuid : text
    • cluster_name : text
    • cluster_display_name : text
    • business_impact : 0, 1, 2, 3, 4, 5
    • status_since : epoch (en secondes)

URL étant l'adresse shinken sur le port 8000 par défaut (modifiable).