| Scroll Ignore |
|---|
| scroll-viewport | true |
|---|
| scroll-pdf | true |
|---|
| scroll-office | true |
|---|
| scroll-chm | true |
|---|
| scroll-html | false |
|---|
| scroll-docbook | true |
|---|
| scroll-eclipsehelp | true |
|---|
| scroll-epub | true | scroll-html | false |
|---|
|
|
Méthode POST de type READ qui permet de récupérer des données de supervision d'un hôte et les informations de ses checks, comme sur l'Interface de Visualisation.
Le paramètre ID reçu dans l'URL identifie l'élément à rechercher.
Sa nature (nom ou UUID) est définie à l'aide du paramètre is_name (paramètre POST, détaillé ci-dessous).
| Warning |
|---|
Certains caractères sont interdits dans les URL, ils doivent être échappés (URL encodées) pour pouvoir être utilisés | caractère interdit | : | / | ? | # | [ | ] | @ | ! | $ | & | ' | ( | ) | * | + | , | ; | = | % | (espace) | | remplacement | %3A | %2F | %3F | %23 | %5B | %5D | %40 | %21 | %24 | %26 | %27 | %28 | %29 | %2A | %2B | %2C | %3B | %3D | %25 | %20 ou + | Pour plus d'information : https://developer.mozilla.org/fr/docs/Glossary/percent-encoding et rfc3986 Exemple : pour utiliser le nom ch@nged_name il faudra utiliser l'url http://broker-module-livedata:50100/api/v2/host/ch%40nged_name |
Les 2 paramètres suivants sont également disponibles :
| Nom | Type | Défaut | Commentaire |
|---|
| Booléen | true | - true, ID est considéré comme un nom d'hôte pour la récupération de l'hôte
- false, ID est considéré comme un UUID pour la récupération de l'hôte
|
| Codes de retour | Explications |
|---|
| 200 | OK |
| 400 | Paramètre invalide |
| 401 | Accès nécessite une authentification ou un Token valide. |
| 403 | Authentification de l'utilisateur OK , mais droits non suffisants. |
| 404 | L'hôte demandé n'existe pas |
| 405 | L’élément correspondant à l'ID n'est pas un hôte |
| 500 | L'appel est valide, mais un problème d'exécution est survenu. |
| Code Block |
|---|
|
curl -s -S -H 'x-api-token: XYZ' \
http://broker-module-livedata:50100/api/v2/host/bordeaux |
Exemple de sortie attendue :
| Code Block |
|---|
| language | bash |
|---|
| theme | RDark |
|---|
| title | http://localhost:50100/api/v2/host/bordeaux |
|---|
|
{
"request_statistics": {
"nb_elements_total": 9,
"nb_hosts_total": 4,
"nb_checks_total": 4,
"nb_elements_filtered": 3,
"nb_hosts_filtered": 1,
"nb_checks_filtered": 2
},
"elements_found": [
{
"father_uuid": "2c6dcf1aba1611ebaa7d0800277faebe",
"father_name": "Bordeaux",
"type": "host"
},
{
"check_name": "CPU Stats",
"check_uuid": "2c6dcf1aba1611ebaa7d0800277faebe-c296d75e5ad911e58cc5080027f08538",
"father_uuid": "2c6dcf1aba1611ebaa7d0800277faebe",
"father_name": "Bordeaux",
"type": "check_host"
},
{
"check_name": "Disks Stats",
"check_uuid": "2c6dcf1aba1611ebaa7d0800277faebe-c29735965ad911e58cc5080027f08538",
"father_uuid": "2c6dcf1aba1611ebaa7d0800277faebe",
"father_name": "Bordeaux",
"type": "check_host"
}
]
} |
Paramètre GET absent ( ID )
Le paramètre attendu est un nom
| Code Block |
|---|
|
$ curl -s -S -H "x-api-token: XYZ" \
http://broker-module-livedata:50100/api/v2/host
ERROR 400: mandatory parameter [ name ] is missing |
| Panel |
|---|
| borderColor | #dfe1e5 |
|---|
| borderWidth | 1 |
|---|
| borderStyle | solid |
|---|
|
ERROR 400: mandatory parameter [ name ] is missing |
Le paramètre attendu est un UUID
| Code Block |
|---|
|
$ curl -s -S -H "x-api-token: XYZ" \
-d "is_name=false" \
http://broker-module-livedata:50100/api/v2/host
ERROR 400: mandatory parameter [ uuid ] is missing |
| Panel |
|---|
| borderColor | #dfe1e5 |
|---|
| borderWidth | 1 |
|---|
| borderStyle | solid |
|---|
|
ERROR 400: mandatory parameter [ uuid ] is missing |
Paramètres POST incorrects
| Code Block |
|---|
|
$ curl -s -S -H "x-api-token: XYZ" \
-d "parametre_inconnu=is_status_:true" \
http://broker-module-livedata:50100/api/v2/host/ID
ERROR 400: POST parameter [ parametre_inconnu ] is unknown |
| Panel |
|---|
| borderColor | #dfe1e5 |
|---|
| borderWidth | 1 |
|---|
| borderStyle | solid |
|---|
|
ERROR 400: POST parameter [ parametre_inconnu ] is unknown |
Paramètre désactivé sur cette route
| Code Block |
|---|
|
$ curl -s -S -H "x-api-token: XYZ" \
-d "output_format=checks_attached_to_father" \
http://broker-module-livedata:50100/api/v2/host/ID
ERROR 400: POST parameter [ output_format ] is not available for this route |
| Panel |
|---|
| borderColor | #dfe1e5 |
|---|
| borderWidth | 1 |
|---|
| borderStyle | solid |
|---|
|
ERROR 400: POST parameter [ output_format ] is not available for this route |
Messages d'erreurs lors du paramétrage des propriétés présentes dans la sortie ( output_field )
Propriété de sortie inexistante
| Code Block |
|---|
|
$ curl -s -S -H "x-api-token: XYZ" \
-d "output_field=is_status_" \
http://broker-module-livedata:50100/api/v2/host/ID
ERROR 400: output_field: invalid field name [ is_status_ ] |
| Panel |
|---|
| borderColor | #dfe1e5 |
|---|
| borderWidth | 1 |
|---|
| borderStyle | solid |
|---|
|
ERROR 400: output_field: invalid field name [ is_status_ ] |
Messages d'erreurs liés au paramètre is_name
| Code Block |
|---|
|
$ curl -s -S -H "x-api-token: XYZ" \
-d "is_name=cluster" \
http://broker-module-livedata:50100/api/v2/host/ID
ERROR 400: is_name: invalid value [cluster] |
| Panel |
|---|
| borderColor | #dfe1e5 |
|---|
| borderWidth | 1 |
|---|
| borderStyle | solid |
|---|
|
ERROR 400: is_name: invalid value [cluster] |
Erreurs | communes lors de l'envoi de la requête |
|
Messages d'erreurs liés au protocole HTTPS
Le certificat SSL a été refusé
| Code Block |
|---|
|
$ curl -s -S -H "x-api-token: XYZ" \
https://broker-module-livedata:50100/api/v2/host/ID
curl: (60) SSL certificate problem: unable to get local issuer certificate
… |
| Info |
|---|
Cela peut se produire si le certificat du serveur est auto-signé. Pour contourner la validité de l'émetteur du certificat, il faut utiliser l'option --insecure ( option courte : -k ). | Code Block |
|---|
| curl --insecure -s -S -H "x-api-token: XYZ" \
https://broker-module-livedata:50100/api/v2/host/ID |
|
Avec curl v7.29.0 :
| Panel |
|---|
| borderColor | #dfe1e5 |
|---|
| borderWidth | 1 |
|---|
| borderStyle | solid |
|---|
|
curl: (60) Peer's Certificate issuer is not recognized. … |
Avec curl v7.60 et supérieur :
| Panel |
|---|
| borderColor | #dfe1e5 |
|---|
| borderWidth | 1 |
|---|
| borderStyle | solid |
|---|
|
curl: (60) SSL certificate problem: unable to get local issuer certificate … |
Requête HTTP sur un serveur en HTTPS
| Code Block |
|---|
|
$ curl -s -S -H "x-api-token: XYZ" \
http://broker-module-livedata:50100/api/v2/host/ID
The client IP_SERVEUR:PORT_CLIENT sent a plain HTTP request, but this server only speaks HTTPS on this port. |
| Panel |
|---|
| borderColor | #dfe1e5 |
|---|
| borderWidth | 1 |
|---|
| borderStyle | solid |
|---|
|
The client IP_SERVEUR:PORT_CLIENT sent a plain HTTP request, but this server only speaks HTTPS on this port. |
Requête HTTPS sur un serveur en HTTP
| Code Block |
|---|
|
$ curl -s -S -H "x-api-token: XYZ" \
https://broker-module-livedata:50100/api/v2/host/ID
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number |
Avec curl v7.29.0 :
| Panel |
|---|
| borderColor | #dfe1e5 |
|---|
| borderWidth | 1 |
|---|
| borderStyle | solid |
|---|
|
curl: (35) SSL received a record that exceeded the maximum permissible length. |
Avec curl v7.60 et supérieur :
| V2 - Les erreurs communes lors de l'envoi de la requête |
|---|
| nopanel | true |
|---|
|
| Panel |
|---|
| borderColor | #dfe1e5 |
|---|
| borderWidth | 1 |
|---|
| borderStyle | solid |
|---|
|
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number