icinga2

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 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]]
  instance_id = "" # unique instance identifier (REQUIRED)

  ## Required Icinga2 server address
  # server = "https://localhost:5665"
  
  ## Required Icinga2 object type ("services" or "hosts")
  # 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/circonus-unified-agent/ca.pem"
  # tls_cert = "/etc/circonus-unified-agent/cert.pem"
  # tls_key = "/etc/circonus-unified-agent/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 - 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
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
$ ./circonus-unified-agent -config circonus-unified-agent.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        float64 `json:"state"`
	HostName     string  `json:"host_name"`
}

type Icinga2

type Icinga2 struct {
	Server          string
	ObjectType      string
	Username        string
	Password        string
	ResponseTimeout internal.Duration
	tls.ClientConfig

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

func (*Icinga2) Description

func (i *Icinga2) Description() string

func (*Icinga2) Gather

func (i *Icinga2) Gather(ctx context.Context, acc cua.Accumulator) error

func (*Icinga2) GatherStatus

func (i *Icinga2) GatherStatus(acc cua.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