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
|
2022-06-08 05:37:08 +08:00
|
|
|
[here][1].
|
|
|
|
|
|
|
|
|
|
[1]: https://docs.icinga.com/icinga2/latest/doc/module/icinga2/chapter/icinga2-api
|
2018-08-23 10:10:40 +08:00
|
|
|
|
2022-10-27 03:58:36 +08:00
|
|
|
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
|
|
|
|
|
|
|
|
|
|
In addition to the plugin-specific configuration settings, plugins support
|
|
|
|
|
additional global and plugin configuration settings. These settings are used to
|
|
|
|
|
modify metrics, tags, and field or create aliases and configure ordering, etc.
|
|
|
|
|
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
|
|
|
|
|
|
2023-01-12 23:55:21 +08:00
|
|
|
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
|
2022-10-27 03:58:36 +08:00
|
|
|
|
2021-11-25 03:18:53 +08:00
|
|
|
## Configuration
|
2018-08-23 10:10:40 +08:00
|
|
|
|
2022-05-24 21:49:47 +08:00
|
|
|
```toml @sample.conf
|
2022-04-08 06:01:21 +08:00
|
|
|
# Gather Icinga2 status
|
2018-08-23 10:10:40 +08:00
|
|
|
[[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"
|
2023-01-26 18:16:35 +08:00
|
|
|
|
|
|
|
|
## Collected Icinga2 objects ("services", "hosts")
|
|
|
|
|
## Specify at least one object to collect from /v1/objects endpoint.
|
|
|
|
|
# objects = ["services"]
|
|
|
|
|
|
|
|
|
|
## Collect metrics from /v1/status endpoint
|
|
|
|
|
## Choose from:
|
|
|
|
|
## "ApiListener", "CIB", "IdoMysqlConnection", "IdoPgsqlConnection"
|
|
|
|
|
# status = []
|
2018-08-23 10:10:40 +08:00
|
|
|
|
|
|
|
|
## 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
|
|
|
|
|
```
|
|
|
|
|
|
2023-01-26 18:16:35 +08:00
|
|
|
## Metrics
|
|
|
|
|
|
|
|
|
|
- `icinga2_hosts`
|
|
|
|
|
- tags
|
|
|
|
|
- `check_command` - The short name of the check command
|
|
|
|
|
- `display_name` - The name of the host
|
|
|
|
|
- `state` - The state: UP/DOWN
|
|
|
|
|
- `source` - The icinga2 host
|
|
|
|
|
- `port` - The icinga2 port
|
|
|
|
|
- `scheme` - The icinga2 protocol (http/https)
|
|
|
|
|
- `server` - The server the check_command is running for
|
|
|
|
|
- fields
|
|
|
|
|
- `name` (string)
|
|
|
|
|
- `state_code` (int)
|
|
|
|
|
- `icinga2_services`
|
|
|
|
|
- tags
|
|
|
|
|
- `check_command` - The short name of the check command
|
|
|
|
|
- `display_name` - The name of the service
|
|
|
|
|
- `state` - The state: 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
|
|
|
|
|
- fields
|
|
|
|
|
- `name` (string)
|
|
|
|
|
- `state_code` (int)
|
|
|
|
|
- `icinga2_status`
|
|
|
|
|
- component:
|
|
|
|
|
- `ApiListener`
|
|
|
|
|
- tags
|
|
|
|
|
- `component` name
|
|
|
|
|
- fields
|
|
|
|
|
- `api_num_conn_endpoints`
|
|
|
|
|
- `api_num_endpoint`
|
|
|
|
|
- `api_num_http_clients`
|
|
|
|
|
- `api_num_json_rpc_anonymous_clients`
|
|
|
|
|
- `api_num_json_rpc_relay_queue_item_rate`
|
|
|
|
|
- `api_num_json_rpc_relay_queue_items`
|
|
|
|
|
- `api_num_json_rpc_sync_queue_item_rate`
|
|
|
|
|
- `api_num_json_rpc_sync_queue_items`
|
|
|
|
|
- `api_num_json_rpc_work_queue_item_rate`
|
|
|
|
|
- `api_num_not_conn_endpoints`
|
|
|
|
|
- `CIB`
|
|
|
|
|
- tags
|
|
|
|
|
- `component` name
|
|
|
|
|
- fields
|
|
|
|
|
- `active_host_checks`
|
|
|
|
|
- `active_host_checks_15min`
|
|
|
|
|
- `active_host_checks_1min`
|
|
|
|
|
- `active_host_checks_5min`
|
|
|
|
|
- `active_service_checks`
|
|
|
|
|
- `active_service_checks_15min`
|
|
|
|
|
- `active_service_checks_1min`
|
|
|
|
|
- `active_service_checks_5min`
|
|
|
|
|
- `avg_execution_time`
|
|
|
|
|
- `avg_latency`
|
|
|
|
|
- `current_concurrent_checks`
|
|
|
|
|
- `current_pending_callbacks`
|
|
|
|
|
- `max_execution_time`
|
|
|
|
|
- `max_latency`
|
|
|
|
|
- `min_execution_time`
|
|
|
|
|
- `min_latency`
|
|
|
|
|
- `num_hosts_acknowledged`
|
|
|
|
|
- `num_hosts_down`
|
|
|
|
|
- `num_hosts_flapping`
|
|
|
|
|
- `num_hosts_handled`
|
|
|
|
|
- `num_hosts_in_downtime`
|
|
|
|
|
- `num_hosts_pending`
|
|
|
|
|
- `num_hosts_problem`
|
|
|
|
|
- `num_hosts_unreachable`
|
|
|
|
|
- `num_hosts_up`
|
|
|
|
|
- `num_services_acknowledged`
|
|
|
|
|
- `num_services_critical`
|
|
|
|
|
- `num_services_flapping`
|
|
|
|
|
- `num_services_handled`
|
|
|
|
|
- `num_services_in_downtime`
|
|
|
|
|
- `num_services_ok`
|
|
|
|
|
- `num_services_pending`
|
|
|
|
|
- `num_services_problem`
|
|
|
|
|
- `num_services_unknown`
|
|
|
|
|
- `num_services_unreachable`
|
|
|
|
|
- `num_services_warning`
|
|
|
|
|
- `passive_host_checks`
|
|
|
|
|
- `passive_host_checks_15min`
|
|
|
|
|
- `passive_host_checks_1min`
|
|
|
|
|
- `passive_host_checks_5min`
|
|
|
|
|
- `passive_service_checks`
|
|
|
|
|
- `passive_service_checks_15min`
|
|
|
|
|
- `passive_service_checks_1min`
|
|
|
|
|
- `passive_service_checks_5min`
|
|
|
|
|
- `remote_check_queue`
|
|
|
|
|
- `uptime`
|
|
|
|
|
- `IdoMysqlConnection`
|
|
|
|
|
- tags
|
|
|
|
|
- `component` name
|
|
|
|
|
- fields
|
|
|
|
|
- `mysql_queries_1min`
|
|
|
|
|
- `mysql_queries_5mins`
|
|
|
|
|
- `mysql_queries_15mins`
|
|
|
|
|
- `mysql_queries_rate`
|
|
|
|
|
- `mysql_query_queue_item_rate`
|
|
|
|
|
- `mysql_query_queue_items`
|
|
|
|
|
- `IdoPgsqlConnection`
|
|
|
|
|
- tags
|
|
|
|
|
- `component` name
|
|
|
|
|
- fields
|
|
|
|
|
- `pgsql_queries_1min`
|
|
|
|
|
- `pgsql_queries_5mins`
|
|
|
|
|
- `pgsql_queries_15mins`
|
|
|
|
|
- `pgsql_queries_rate`
|
|
|
|
|
- `pgsql_query_queue_item_rate`
|
|
|
|
|
- `pgsql_query_queue_items`
|
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
|
|
|
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
|
|
|
|
|
```
|