Le WebService-reciever est le module qui permet de recevoir des résultats passifs pour des hôtes ou checks via HTTP(s).

Configuring the Web Service Module

If data is POSTed to this page, it will validate the data to determine if it is a service or host check result and submit the data to the Shinken external command queue.

  • Le Web Service écoute sur port TCP 7760 ( par défaut ). 
  • Il supporte les accès authentifiés ou anonymes. 

La configuration se défini dans le fichier de configuration du module (présent par défaut dans /etc/shinken/modules/WebService-reactionner.cfg. 

#===============================================================================
# WebService-Reactionner   (webservice)
#===============================================================================
# Daemons that can load this module:
# - receiver
# This module is a webservice that can be used to send checks to Shinken Enterprise
# as POST HTTP(s)
#===============================================================================


define module {

    #======== Module identity =========
    # Module name. Must be unique
    module_name               webservices-receiver
    # Module type (to load module code). Do not edit.
    module_type               ws_arbiter


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

    # port to listen
    port                      7760

    # HTTPs part, enable if you want to set the listening for HTTPS instead of default HTTP.
    # disabled by default. Set your own certificates.
    use_ssl                   0
    ssl_cert                  /etc/shinken/certs/server.cert
    ssl_key                   /etc/shinken/certs/server.key


    #======== HTTP authentification =========
    # You can use HTTP basic authentification method for this module.
    # If username is set to anonymous and password is commented, then
    # no authentification will be required.
    username                 anonymous
    #password                secret


}


Pour activer le module, ajouter simplement à votre Reciever le webservices-receiver a la liste des modules dans le fichier de configuration du reactionner.cfg

Sur une architecture distribuée importante, si vous avez plusieurs Recievers, vous pourrez activer un module webservices-receiver par Receiver.


Using the Web Service Module

Le webservices-reactionner attends en reception des commandes POSTs.

Utilisé curl ou des appels HTTP dans vos programmes ou script

/push_check_result:  soumettre le résultat de check passif

Paramettre de l'appel

NomDescription
-u user:Passwordpour l'authentification
Donnée du check
time_stamp
host_name
service_description

output
long_ouput
perf_dataau format normal des métriques



Exemple:

curl -u user:password -d “time_stamp=$(date +%s)&host_name=host-checked&service_description=service-checked&return_code=0&output=Everything OK” http://shinken-srv:7760/push_check_result



/XXXXX: Mettre un acknowledged 

curl -u user:password -d “time_stamp=$(date +%s)&host_name=host-checked&service_description=service-checked&return_code=0&output=Everything OK” http://shinken-srv:7760/push_check_result

Example with more readability:

curl

-u user:password-d “time_stamp=$(date +%s)

&host_name=host-checked
&service_description=service-checked
&return_code=0
&output=Everything OK
http://shinken-srv:7760/push_check_result