2018-08-23 10:10:40 +08:00
|
|
|
# Icinga2 Input Plugin
|
|
|
|
|
|
|
|
|
|
This plugin gather services & hosts status using Icinga2 Remote API.
|
|
|
|
|
|
|
|
|
|
The icinga2 plugin uses the icinga2 remote API to gather status on running
|
|
|
|
|
services and hosts. You can read Icinga2's documentation for their remote API
|
|
|
|
|
[here](https://docs.icinga.com/icinga2/latest/doc/module/icinga2/chapter/icinga2-api)
|
|
|
|
|
|
2021-11-25 03:18:53 +08:00
|
|
|
## Configuration
|
2018-08-23 10:10:40 +08:00
|
|
|
|
|
|
|
|
```toml
|
|
|
|
|
# Description
|
|
|
|
|
[[inputs.icinga2]]
|
2019-09-24 06:39:50 +08:00
|
|
|
## Required Icinga2 server address
|
2018-08-23 10:10:40 +08:00
|
|
|
# server = "https://localhost:5665"
|
|
|
|
|
|
2019-09-24 06:39:50 +08:00
|
|
|
## Required Icinga2 object type ("services" or "hosts")
|
2018-08-23 10:10:40 +08:00
|
|
|
# object_type = "services"
|
|
|
|
|
|
|
|
|
|
## Credentials for basic HTTP authentication
|
|
|
|
|
# username = "admin"
|
|
|
|
|
# password = "admin"
|
|
|
|
|
|
|
|
|
|
## Maximum time to receive response.
|
|
|
|
|
# response_timeout = "5s"
|
|
|
|
|
|
|
|
|
|
## Optional TLS Config
|
|
|
|
|
# tls_ca = "/etc/telegraf/ca.pem"
|
|
|
|
|
# tls_cert = "/etc/telegraf/cert.pem"
|
|
|
|
|
# tls_key = "/etc/telegraf/key.pem"
|
|
|
|
|
## Use TLS but skip chain & host verification
|
|
|
|
|
# insecure_skip_verify = true
|
|
|
|
|
```
|
|
|
|
|
|
2021-11-25 03:18:53 +08:00
|
|
|
## Measurements & Fields
|
2018-08-23 10:10:40 +08:00
|
|
|
|
|
|
|
|
- All measurements have the following fields:
|
2021-11-25 03:18:53 +08:00
|
|
|
- name (string)
|
|
|
|
|
- state_code (int)
|
2018-08-23 10:10:40 +08:00
|
|
|
|
2021-11-25 03:18:53 +08:00
|
|
|
## Tags
|
2018-08-23 10:10:40 +08:00
|
|
|
|
|
|
|
|
- All measurements have the following tags:
|
2021-11-25 03:18:53 +08:00
|
|
|
- check_command - The short name of the check command
|
|
|
|
|
- display_name - The name of the service or host
|
|
|
|
|
- state - The state: UP/DOWN for hosts, OK/WARNING/CRITICAL/UNKNOWN for services
|
|
|
|
|
- source - The icinga2 host
|
|
|
|
|
- port - The icinga2 port
|
|
|
|
|
- scheme - The icinga2 protocol (http/https)
|
|
|
|
|
- server - The server the check_command is running for
|
2018-08-23 10:10:40 +08:00
|
|
|
|
2021-11-25 03:18:53 +08:00
|
|
|
## Sample Queries
|
2018-08-23 10:10:40 +08:00
|
|
|
|
2020-08-11 03:50:48 +08:00
|
|
|
```sql
|
2018-08-23 10:10:40 +08:00
|
|
|
SELECT * FROM "icinga2_services" WHERE state_code = 0 AND time > now() - 24h // Service with OK status
|
|
|
|
|
SELECT * FROM "icinga2_services" WHERE state_code = 1 AND time > now() - 24h // Service with WARNING status
|
|
|
|
|
SELECT * FROM "icinga2_services" WHERE state_code = 2 AND time > now() - 24h // Service with CRITICAL status
|
|
|
|
|
SELECT * FROM "icinga2_services" WHERE state_code = 3 AND time > now() - 24h // Service with UNKNOWN status
|
|
|
|
|
```
|
|
|
|
|
|
2021-11-25 03:18:53 +08:00
|
|
|
## Example Output
|
2018-08-23 10:10:40 +08:00
|
|
|
|
2021-11-25 03:18:53 +08:00
|
|
|
```text
|
2018-08-23 10:10:40 +08:00
|
|
|
$ ./telegraf -config telegraf.conf -input-filter icinga2 -test
|
|
|
|
|
icinga2_hosts,display_name=router-fr.eqx.fr,check_command=hostalive-custom,host=test-vm,source=localhost,port=5665,scheme=https,state=ok name="router-fr.eqx.fr",state=0 1492021603000000000
|
|
|
|
|
```
|