mirror of https://github.com/Icinga/icinga2.git
parent
ce99dce3cb
commit
21b021b8a5
|
@ -17,7 +17,7 @@ make calls to
|
||||||
This chapter will start with a general overview followed by
|
This chapter will start with a general overview followed by
|
||||||
detailed information about specific endpoints.
|
detailed information about specific endpoints.
|
||||||
|
|
||||||
### <a id="icinga2-api-requests></a> Requests
|
### <a id="icinga2-api-requests"></a> Requests
|
||||||
|
|
||||||
Any tool capable of making HTTP requests can communicate with
|
Any tool capable of making HTTP requests can communicate with
|
||||||
the API, for example [curl](http://curl.haxx.se).
|
the API, for example [curl](http://curl.haxx.se).
|
||||||
|
@ -40,7 +40,7 @@ Supported request methods:
|
||||||
PUT | Create a new object. The PUT request must include all attributes required to create a new object.
|
PUT | Create a new object. The PUT request must include all attributes required to create a new object.
|
||||||
DELETE | Remove an object created by the API. The DELETE method is idempotent and does not require any check if the object actually exists.
|
DELETE | Remove an object created by the API. The DELETE method is idempotent and does not require any check if the object actually exists.
|
||||||
|
|
||||||
### <a id="icinga2-api-http-statuses></a> HTTP Statuses
|
### <a id="icinga2-api-http-statuses"></a> HTTP Statuses
|
||||||
|
|
||||||
The API will return standard [HTTP statuses](https://www.ietf.org/rfc/rfc2616.txt)
|
The API will return standard [HTTP statuses](https://www.ietf.org/rfc/rfc2616.txt)
|
||||||
including error codes.
|
including error codes.
|
||||||
|
@ -63,7 +63,7 @@ Ask your Icinga 2 system administrator to check the `icinga2.log` file for furth
|
||||||
troubleshooting.
|
troubleshooting.
|
||||||
|
|
||||||
|
|
||||||
### <a id="icinga2-api-responses></a> Responses
|
### <a id="icinga2-api-responses"></a> Responses
|
||||||
|
|
||||||
Succesful requests will send back a response body containing a `results`
|
Succesful requests will send back a response body containing a `results`
|
||||||
list. Depending on the number of affected objects in your request, the
|
list. Depending on the number of affected objects in your request, the
|
||||||
|
@ -82,7 +82,7 @@ The [output](9-icinga2-api.md#icinga2-api-output) will be sent back as JSON obje
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
### <a id="icinga2-api-authentication></a> Authentication
|
### <a id="icinga2-api-authentication"></a> Authentication
|
||||||
|
|
||||||
There are two different ways for authenticating against the Icinga 2 API:
|
There are two different ways for authenticating against the Icinga 2 API:
|
||||||
|
|
||||||
|
@ -127,11 +127,11 @@ Now pass the basic auth information to curl and send a GET request to the API:
|
||||||
|
|
||||||
In case you will get `Unauthorized` make sure to check the API user credentials.
|
In case you will get `Unauthorized` make sure to check the API user credentials.
|
||||||
|
|
||||||
### <a id="icinga2-api-permissions></a> Permissions
|
### <a id="icinga2-api-permissions"></a> Permissions
|
||||||
|
|
||||||
**TODO** https://dev.icinga.org/issues/9088
|
**TODO** https://dev.icinga.org/issues/9088
|
||||||
|
|
||||||
### <a id="icinga2-api-parameters></a> Parameters
|
### <a id="icinga2-api-parameters"></a> Parameters
|
||||||
|
|
||||||
Depending on the request method there are two ways of
|
Depending on the request method there are two ways of
|
||||||
passing parameters to the request:
|
passing parameters to the request:
|
||||||
|
@ -152,7 +152,7 @@ Example for JSON body:
|
||||||
|
|
||||||
**TODO**
|
**TODO**
|
||||||
|
|
||||||
#### <a id="icinga2-api-filters></a> Filters
|
#### <a id="icinga2-api-filters"></a> Filters
|
||||||
|
|
||||||
Use the same syntax as for apply rule expressions
|
Use the same syntax as for apply rule expressions
|
||||||
for filtering specific objects.
|
for filtering specific objects.
|
||||||
|
@ -169,15 +169,15 @@ Example for matching all hosts by name (**Note**: `"` are url-encoded as `%22`):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### <a id="icinga2-api-output-format></a>Output Format
|
### <a id="icinga2-api-output-format"></a>Output Format
|
||||||
|
|
||||||
The request and reponse body contain a JSON encoded string.
|
The request and reponse body contain a JSON encoded string.
|
||||||
|
|
||||||
### <a id="icinga2-api-version></a>Version
|
### <a id="icinga2-api-version"></a>Version
|
||||||
|
|
||||||
Each url contains the version string as prefix (currently "/v1").
|
Each url contains the version string as prefix (currently "/v1").
|
||||||
|
|
||||||
### <a id="icinga2-api-url-overview></a>Url Overview
|
### <a id="icinga2-api-url-overview"></a>Url Overview
|
||||||
|
|
||||||
|
|
||||||
The Icinga 2 API provides multiple url endpoints
|
The Icinga 2 API provides multiple url endpoints
|
||||||
|
@ -212,7 +212,7 @@ Additionally there are endpoints for each [config object type](6-object-types.md
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## <a id="icinga2-api-actions></a> Actions
|
## <a id="icinga2-api-actions"></a> Actions
|
||||||
|
|
||||||
There are several actions available for Icinga 2 provided by the `actions` url endpoint.
|
There are several actions available for Icinga 2 provided by the `actions` url endpoint.
|
||||||
|
|
||||||
|
@ -290,17 +290,17 @@ Reschedule a service check for all services in NOT-OK state:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## <a id="icinga2-api-config-management></a> Configuration Management
|
## <a id="icinga2-api-config-management"></a> Configuration Management
|
||||||
|
|
||||||
`/v1/config`
|
`/v1/config`
|
||||||
|
|
||||||
**TODO** Depends on https://dev.icinga.org/issues/9953
|
**TODO** Depends on https://dev.icinga.org/issues/9953
|
||||||
|
|
||||||
## <a id="icinga2-api-events></a> Events
|
## <a id="icinga2-api-events"></a> Events
|
||||||
|
|
||||||
**TODO**
|
**TODO**
|
||||||
|
|
||||||
## <a id="icinga2-api-hosts></a> Hosts
|
## <a id="icinga2-api-hosts"></a> Hosts
|
||||||
|
|
||||||
All object attributes are prefixed with their respective object type.
|
All object attributes are prefixed with their respective object type.
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ Example:
|
||||||
|
|
||||||
Output listing and url parameters use the same syntax.
|
Output listing and url parameters use the same syntax.
|
||||||
|
|
||||||
### <a id="icinga2-api-hosts-list></a> List All Hosts
|
### <a id="icinga2-api-hosts-list"></a> List All Hosts
|
||||||
|
|
||||||
Send a `GET` request to `/v1/hosts` to list all host objects and
|
Send a `GET` request to `/v1/hosts` to list all host objects and
|
||||||
their attributes.
|
their attributes.
|
||||||
|
@ -318,7 +318,7 @@ their attributes.
|
||||||
$ curl -u root:icinga -k -s 'https://localhost:5665/v1/hosts' -X GET
|
$ curl -u root:icinga -k -s 'https://localhost:5665/v1/hosts' -X GET
|
||||||
|
|
||||||
|
|
||||||
### <a id="icinga2-api-hosts-create></a> Create New Host Object
|
### <a id="icinga2-api-hosts-create"></a> Create New Host Object
|
||||||
|
|
||||||
New objects must be created by sending a PUT request. The following
|
New objects must be created by sending a PUT request. The following
|
||||||
parameters need to be passed inside the JSON body:
|
parameters need to be passed inside the JSON body:
|
||||||
|
@ -371,7 +371,7 @@ contains a detailed error message. The following example omits the required `che
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
### <a id="icinga2-api-hosts-show></a> Show Host
|
### <a id="icinga2-api-hosts-show"></a> Show Host
|
||||||
|
|
||||||
Send a `GET` request including the host name inside the url:
|
Send a `GET` request including the host name inside the url:
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ attributes must be added one by one, e.g. `?attrs=host.address&attrs=host.name`.
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
### <a id="icinga2-api-hosts-modify></a> Modify Host
|
### <a id="icinga2-api-hosts-modify"></a> Modify Host
|
||||||
|
|
||||||
Existing objects must be modifed by sending a `POST` request. The following
|
Existing objects must be modifed by sending a `POST` request. The following
|
||||||
parameters need to be passed inside the JSON body:
|
parameters need to be passed inside the JSON body:
|
||||||
|
@ -426,7 +426,7 @@ Example for existing object `google.com`:
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
### <a id="icinga2-api-hosts-delete></a> Delete Host
|
### <a id="icinga2-api-hosts-delete"></a> Delete Host
|
||||||
|
|
||||||
You can delete objects created using the API by sending a `DELETE`
|
You can delete objects created using the API by sending a `DELETE`
|
||||||
request. Specify the object name inside the url.
|
request. Specify the object name inside the url.
|
||||||
|
|
29
mkdocs.yml
29
mkdocs.yml
|
@ -10,20 +10,21 @@ pages:
|
||||||
- [6-object-types.md, Object Types]
|
- [6-object-types.md, Object Types]
|
||||||
- [7-icinga-template-library.md, Icinga Template Library]
|
- [7-icinga-template-library.md, Icinga Template Library]
|
||||||
- [8-cli-commands.md, CLI Commands]
|
- [8-cli-commands.md, CLI Commands]
|
||||||
- [9-monitoring-remote-systems.md, Monitoring Remote Systems]
|
- [9-icinga2-api.md, Icinga 2 API]
|
||||||
- [10-icinga2-client.md, Icinga 2 Client]
|
- [10-monitoring-remote-systems.md, Monitoring Remote Systems]
|
||||||
- [11-agent-based-checks.md, Additional Agent-based Checks]
|
- [11-icinga2-client.md, Icinga 2 Client]
|
||||||
- [12-distributed-monitoring-ha.md, Distributed Monitoring and High Availability]
|
- [12-agent-based-checks.md, Additional Agent-based Checks]
|
||||||
- [13-addons-plugins.md, Addons and Plugins]
|
- [13-distributed-monitoring-ha.md, Distributed Monitoring and High Availability]
|
||||||
- [14-alternative-frontends.md, Alternative Frontends]
|
- [14-addons-plugins.md, Addons and Plugins]
|
||||||
- [15-livestatus.md, Livestatus]
|
- [15-alternative-frontends.md, Alternative Frontends]
|
||||||
- [16-troubleshooting.md, Troubleshooting]
|
- [16-livestatus.md, Livestatus]
|
||||||
- [17-upgrading-icinga-2.md, Upgrading Icinga 2]
|
- [17-troubleshooting.md, Troubleshooting]
|
||||||
- [18-migrating-from-icinga-1x.md, Migrating from Icinga 1.x]
|
- [18-upgrading-icinga-2.md, Upgrading Icinga 2]
|
||||||
- [19-language-reference.md, Language Reference]
|
- [19-migrating-from-icinga-1x.md, Migrating from Icinga 1.x]
|
||||||
- [20-library-reference.md, Library Reference]
|
- [20-language-reference.md, Language Reference]
|
||||||
- [21-debug.md, Debug]
|
- [21-library-reference.md, Library Reference]
|
||||||
- [22-appendix.md, Appendix]
|
- [22-debug.md, Debug]
|
||||||
|
- [23-appendix.md, Appendix]
|
||||||
theme: readthedocs
|
theme: readthedocs
|
||||||
markdown_extensions: [smarty]
|
markdown_extensions: [smarty]
|
||||||
extra_javascript: [scroll.js]
|
extra_javascript: [scroll.js]
|
||||||
|
|
Loading…
Reference in New Issue