icinga2

package
v0.0.0-...-0fce7b6 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: MIT Imports: 10 Imported by: 0

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

Configuration:
# Description
[[inputs.icinga2]]
  ## Required Icinga2 server address (default: "https://localhost:5665")
  # server = "https://localhost:5665"
  
  ## Required Icinga2 object type ("services" or "hosts, default "services")
  # 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
Measurements & Fields:
  • All measurements have the following fields:
    • name (string)
    • state_code (int)
Tags:
  • All measurements have the following tags:
    • check_command
    • display_name
    • state
    • source
    • port
    • scheme
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:
$ ./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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	CheckCommand string `json:"check_command"`
	DisplayName  string `json:"display_name"`
	Name         string `json:"name"`
	State        int    `json:"state"`
}

type Icinga2

type Icinga2 struct {
	Server          string
	ObjectType      string
	Username        string
	Password        string
	ResponseTimeout internal.Duration
	tls.ClientConfig
	// contains filtered or unexported fields
}

func (*Icinga2) Description

func (i *Icinga2) Description() string

func (*Icinga2) Gather

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

func (*Icinga2) GatherStatus

func (i *Icinga2) GatherStatus(acc telegraf.Accumulator, checks []Object)

func (*Icinga2) SampleConfig

func (i *Icinga2) SampleConfig() string

type Object

type Object struct {
	Attrs Attribute  `json:"attrs"`
	Name  string     `json:"name"`
	Joins struct{}   `json:"joins"`
	Meta  struct{}   `json:"meta"`
	Type  ObjectType `json:"type"`
}

type ObjectType

type ObjectType string

type Result

type Result struct {
	Results []Object `json:"results"`
}

Jump to

Keyboard shortcuts

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