Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icinga2 inputs module not reporting correct state change #6331

Closed
buggsdummy opened this issue Aug 29, 2019 · 0 comments · Fixed by #6333
Closed

icinga2 inputs module not reporting correct state change #6331

buggsdummy opened this issue Aug 29, 2019 · 0 comments · Fixed by #6333
Assignees
Labels
bug unexpected problem or unintended behavior
Milestone

Comments

@buggsdummy
Copy link

buggsdummy commented Aug 29, 2019

Relevant telegraf.conf:

[[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 = "root"
  password = "abc123"

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

System info:

telegraf-1.11.4-1.x86_64

CentOS Linux release 7.6.1810 (Core) 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.6.1810 (Core) 
CentOS Linux release 7.6.1810 (Core) 

icinga2-bin-2.10.5-1.el7.icinga.x86_64
icinga2-common-2.10.5-1.el7.icinga.x86_64
icinga2-selinux-2.10.5-1.el7.icinga.x86_64
vim-icinga2-2.10.5-1.el7.icinga.x86_64
icinga2-ido-pgsql-2.10.5-1.el7.icinga.x86_64
icinga2-2.10.5-1.el7.icinga.x86_64

Steps to reproduce:

  1. Check the icinga2 api for a check with a notOK state
    https://localhost:5665/v1/objects/services?filter=service.state!=ServiceOK
  2. Check the metrics on icinga2 server
    http://localhost:9126/metrics

Expected behavior:

telegraf should scrape the correct state status and update the metrics

Actual behavior:

state is always ok even after refreshing the metrics page

Additional info:

Metrics

icinga2_services_state_code{check_command="check_app",display_name="check_app",host="localhost",name="check_app",port="5665",scheme="https",source="localhost",state="ok"} 0

Icinga2 API

{
	"results": [{
		"attrs": {
			"__name": "appserver.net!check_app",
			"acknowledgement": 0.0,
			"acknowledgement_expiry": 0.0,
			"action_url": "",
			"active": true,
			"check_attempt": 1.0,
			"check_command": "check_app",
			"check_interval": 300.0,
			"check_period": "",
			"check_timeout": null,
			"command_endpoint": "",
			"display_name": "check_app",
			"downtime_depth": 0.0,
			"enable_active_checks": true,
			"enable_event_handler": true,
			"enable_flapping": false,
			"enable_notifications": true,
			"enable_passive_checks": true,
			"enable_perfdata": true,
			"event_command": "",
			"flapping": false,
			"flapping_current": 0.0,
			"flapping_last_change": 0.0,
			"flapping_threshold": 0.0,
			"flapping_threshold_high": 30.0,
			"flapping_threshold_low": 25.0,
			"force_next_check": false,
			"force_next_notification": false,
			"groups": [],
			"ha_mode": 0.0,
			"host_name": "appserver",
			"icon_image": "",
			"icon_image_alt": "",
			"last_check": 1567093474.6973659992,
			"last_check_result": {
				"active": true,
				"check_source": "icinga2server",
				"command": ["/usr/local/nagios/libexec/check_nrpe", "-H", "appserver", "-c", "check_app"],
				"execution_end": 1567093474.6972908974,
				"execution_start": 1567093474.6051809788,
				"exit_status": 2.0,
				"output": "CRITICAL names",
				"performance_data": [],
				"schedule_end": 1567093474.6973659992,
				"schedule_start": 1567093474.0,
				"state": 2.0,
				"ttl": 0.0,
				"type": "CheckResult",
				"vars_after": {
					"attempt": 1.0,
					"reachable": true,
					"state": 2.0,
					"state_type": 1.0
				},
				"vars_before": {
					"attempt": 1.0,
					"reachable": true,
					"state": 2.0,
					"state_type": 1.0
				}
			},
			"last_hard_state": 2.0,
			"last_hard_state_change": 1566932503.3587920666,
			"last_reachable": true,
			"last_state": 2.0,
			"last_state_change": 1566932444.5251150131,
			"last_state_critical": 1567093474.6973869801,
			"last_state_ok": 0.0,
			"last_state_type": 1.0,
			"last_state_unknown": 0.0,
			"last_state_unreachable": 0.0,
			"last_state_warning": 0.0,
			"max_check_attempts": 3.0,
			"name": "check_app",
			"next_check": 1567093765.1474039555,
			"notes": "",
			"notes_url": "",
			"original_attributes": null,
			"package": "director",
			"paused": false,
			"retry_interval": 60.0,
			"severity": 136.0,
			"source_location": {
				"first_column": 1.0,
				"first_line": 73.0,
				"last_column": 36.0,
				"last_line": 73.0,
				"path": "/var/lib/icinga2/api/packages/director/dbd32fc1-9080-41eb-909b-514a56d190c8/zones.d/master/services.conf"
			},
			"state": 2.0,
			"state_type": 1.0,
			"templates": ["check_app", "check_app"],
			"type": "Service",
			"vars": null,
			"version": 0.0,
			"volatile": false,
			"zone": "master"
		},
		"joins": {},
		"meta": {},
		"name": "appserver!check_app",
		"type": "Service"
	}]
}
@buggsdummy buggsdummy changed the title icinga2 module not reporting correct state change icinga2 inputs module not reporting correct state change Aug 29, 2019
@danielnelson danielnelson self-assigned this Aug 30, 2019
@danielnelson danielnelson added the bug unexpected problem or unintended behavior label Aug 30, 2019
@danielnelson danielnelson added this to the 1.12.0 milestone Aug 30, 2019
@danielnelson danielnelson modified the milestones: 1.12.0, 1.12.1 Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants