Erreurs communes à toutes les requêtes HTTP

Authentification requise - Error 401

Si le module a été configuré pour demander un nom d'utilisateur et un mot de passe et que ces derniers n'ont pas été fournis, un code d'erreur 401 est retourné.

Exemple ( "-u user:password" manquant )

Requête
curl -X POST -d $'host_name=host-checked&service_description=service-checked&return_code=0&output=short_update\nlong_output'\
 http://shinken-serveur:7760/push_check_result
Réponse au format html

Réponse au format text
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html>
        <head>
            <title>Error 401: Unauthorized</title>
            <style type="text/css">
              html {background-color: #eee; font-family: sans;}
              body {background-color: #fff; border: 1px solid #ddd;
                    padding: 15px; margin: 15px;}
              pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}
            </style>
        </head>
        <body>
            <h1>Error 401: Unauthorized</h1>
            <p>Sorry, the requested URL <tt>'http://shinken-serveur:7760/push_check_result'</tt>
               caused an error:</p>
            <pre>Authentication required</pre>
        </body>
    </html>

Authentification refusée - Error 403

Si le module a été configuré pour demander un nom d'utilisateur et un mot de passe et que ceux donnés sont invalides ( mauvais nom d'utilisateur ou mauvais mot de passe ), un code d'erreur 403 est retourné.

Exemple 

Requête
curl -u invalid_user:invalid_password -X POST -d\
 $'host_name=host-checked&service_description=service-checked&return_code=0&output=short_update\nlong_output'\
 http://shinken-serveur:7760/push_check_result
Réponse au format html

Réponse au format text
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html>
        <head>
            <title>Error 403: Forbidden</title>
            <style type="text/css">
              html {background-color: #eee; font-family: sans;}
              body {background-color: #fff; border: 1px solid #ddd;
                    padding: 15px; margin: 15px;}
              pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}
            </style>
        </head>
        <body>
            <h1>Error 403: Forbidden</h1>
            <p>Sorry, the requested URL <tt>'http://shinken-serveur:7760/push_check_result'</tt>
               caused an error:</p>
            <pre>Authentication denied</pre>
        </body>
    </html>

Le nom de l'hôte est manquant - Error 400

Les appels HTTP pour une action sur un hôte/un check où le nom de l'hôte concerné n'a pas été fourni retournent un code d'erreur 400.

Exemple 

Requête
curl -u user:password -X POST -d\
 "time_stamp=$(date +%s)&host_name=&service_description=service-checked&comment=Nous sommes entrain de corriger le problème&notify=1"\
 http://shinken-serveur:7760/acknowledge
Réponse au format html

Réponse au format text
   <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html>
        <head>
            <title>Error 400: Bad Request</title>
            <style type="text/css">
              html {background-color: #eee; font-family: sans;}
              body {background-color: #fff; border: 1px solid #ddd;
                    padding: 15px; margin: 15px;}
              pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}
            </style>
        </head>
        <body>
            <h1>Error 400: Bad Request</h1>
            <p>Sorry, the requested URL <tt>'http://shinken-serveur:7760/acknowledge'</tt>
               caused an error:</p>
            <pre>Missing parameter host_name</pre>
        </body>
    </html>

Le format de la requête n'est pas en UTF-8 - Error 400

Une requête avec un message qui n'est pas au format UTF-8 retourne un code d'erreur 400.

Exemple ( le fichier invalid-file.txt contient des caractères invalides )

Requête
curl -u user:password -X POST -d\
 "time_stamp=$(date +%s)&host_name=&service_description=service-checked&comment=$(cat invalid-file.txt)&notify=1"\
 http://shinken-serveur:7760/acknowledge
Réponse au format html

Réponse au format text
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html>
        <head>
            <title>Error 400: Bad Request</title>
            <style type="text/css">
              html {background-color: #eee; font-family: sans;}
              body {background-color: #fff; border: 1px solid #ddd;
                    padding: 15px; margin: 15px;}
              pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}
            </style>
        </head>
        <body>
            <h1>Error 400: Bad Request</h1>
            <p>Sorry, the requested URL <tt>'http://shinken-serveur:7760/acknowledge'</tt>
               caused an error:</p>
            <pre>The body is not UTF-8 encoded</pre>
        </body>
    </html>