icinga2

package
v1.30.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 13 Imported by: 4

README

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.

Global configuration options

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 for more details.

Configuration

# Gather Icinga2 status
[[inputs.icinga2]]
  ## Required Icinga2 server address
  # server = "https://localhost:5665"

  ## 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 = []

  ## 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

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

Sample Queries

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

Example Output

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Icinga2

type Icinga2 struct {
	Server          string
	Objects         []string
	Status          []string
	ObjectType      string `toml:"object_type" deprecated:"1.26.0;2.0.0;use 'objects' instead"`
	Username        string
	Password        string
	ResponseTimeout config.Duration
	tls.ClientConfig

	Log telegraf.Logger
	// contains filtered or unexported fields
}

func (*Icinga2) Gather

func (i *Icinga2) Gather(acc telegraf.Accumulator) error

func (*Icinga2) Init added in v1.26.0

func (i *Icinga2) Init() error

func (*Icinga2) SampleConfig

func (*Icinga2) SampleConfig() string

type ResultCIB added in v1.26.0

type ResultCIB struct {
	Results []struct {
		Status map[string]interface{} `json:"status"`
	} `json:"results"`
}

type ResultObject added in v1.26.0

type ResultObject struct {
	Results []struct {
		Attrs struct {
			CheckCommand string  `json:"check_command"`
			DisplayName  string  `json:"display_name"`
			Name         string  `json:"name"`
			State        float64 `json:"state"`
			HostName     string  `json:"host_name"`
		} `json:"attrs"`
		Name  string   `json:"name"`
		Joins struct{} `json:"joins"`
		Meta  struct{} `json:"meta"`
		Type  string   `json:"type"`
	} `json:"results"`
}

type ResultPerfdata added in v1.26.0

type ResultPerfdata struct {
	Results []struct {
		Perfdata []struct {
			Label string  `json:"label"`
			Value float64 `json:"value"`
		} `json:"perfdata"`
	} `json:"results"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL