mirror of https://github.com/Icinga/icinga2.git
Add global API parameters to the docs; Add API troubleshooting section
This commit is contained in:
parent
b53685db59
commit
c58caf3550
|
@ -103,7 +103,7 @@ The output will be sent back as a JSON object:
|
|||
|
||||
> **Tip**
|
||||
>
|
||||
> You can use the `pretty` parameter to beautify the JSON response with Icinga v2.9+.
|
||||
> You can use the [pretty](12-icinga2-api.md#icinga2-api-parameters-global) parameter to beautify the JSON response with Icinga v2.9+.
|
||||
|
||||
You can also use [jq](https://stedolan.github.io/jq/) or `python -m json.tool`
|
||||
in combination with curl on the CLI.
|
||||
|
@ -272,6 +272,27 @@ Here are the exact same query parameters as a JSON object:
|
|||
The [match function](18-library-reference.md#global-functions-match) is available as global function
|
||||
in Icinga 2.
|
||||
|
||||
### Global Parameters <a id="icinga2-api-parameters-global"></a>
|
||||
|
||||
Name | Description
|
||||
----------------|--------------------
|
||||
pretty | Pretty-print the JSON response.
|
||||
verbose | Add verbose debug information inside the `diagnostic_information` key into the response if available. This helps with troubleshooting failing requests.
|
||||
|
||||
Example as URL parameter:
|
||||
|
||||
```
|
||||
/v1/objects/hosts?pretty=1
|
||||
```
|
||||
|
||||
Example as JSON object:
|
||||
|
||||
```
|
||||
{ "pretty": true }
|
||||
```
|
||||
|
||||
Both parameters have been added in Icinga 2 v2.9.
|
||||
|
||||
### Request Method Override <a id="icinga2-api-requests-method-override"></a>
|
||||
|
||||
`GET` requests do not allow you to send a request body. In case you cannot pass everything as URL
|
||||
|
|
|
@ -702,6 +702,33 @@ Look into the log and check whether the feature logs anything specific for this
|
|||
grep GraphiteWriter /var/log/icinga2/icinga2.log
|
||||
```
|
||||
|
||||
## REST API Troubleshooting <a id="troubleshooting-api"></a>
|
||||
|
||||
In order to analyse errors on API requests, you can explicitly enable the [verbose parameter](12-icinga2-api.md#icinga2-api-parameters-global).
|
||||
|
||||
```
|
||||
$ curl -k -s -u root:icinga -H 'Accept: application/json' -X DELETE 'https://localhost:5665/v1/objects/hosts/example-cmdb?pretty=1&verbose=1'
|
||||
{
|
||||
"diagnostic_information": "Error: Object does not exist.\n\n ....",
|
||||
"error": 404.0,
|
||||
"status": "No objects found."
|
||||
}
|
||||
```
|
||||
|
||||
## REST API Troubleshooting: No Objects Found <a id="troubleshooting-api-no-objects-found"></a>
|
||||
|
||||
Please note that the `404` status with no objects being found can also originate
|
||||
from missing or too strict object permissions for the authenticated user.
|
||||
|
||||
This is a security feature to disable object name guessing. If this would not be the
|
||||
case, restricted users would be able to get a list of names of your objects just by
|
||||
trying every character combination.
|
||||
|
||||
In order to analyse and fix the problem, please check the following:
|
||||
|
||||
- use an administrative account with full permissions to check whether the objects are actually there.
|
||||
- verify the permissions on the affected ApiUser object and fix them.
|
||||
|
||||
|
||||
## Certificate Troubleshooting <a id="troubleshooting-certificate"></a>
|
||||
|
||||
|
|
Loading…
Reference in New Issue