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

Host doesn't visible in UI after creating using API #6927

Closed
VtG242 opened this issue Jan 31, 2019 · 1 comment
Closed

Host doesn't visible in UI after creating using API #6927

VtG242 opened this issue Jan 31, 2019 · 1 comment
Labels
area/api REST API area/db-ido Database output

Comments

@VtG242
Copy link

VtG242 commented Jan 31, 2019

Issue description

Situation from subject happens time to time only.
I'm not able to exactly reproduce it but usual scenario is following:

  1. host is removed from icinga using API
  2. host added back with updated configuration using API

Both actions finish successfully but host isn't displayed in UI.
A configuration file for affected host is created in /var/lib/icinga2/api/packages/_api/xxx/conf.d/hosts.

Just for example this is configuration for host which is actually missing in UI:

cat /var/lib/icinga2/api/packages/_api/cde49d01-1589-4aee-9e35-260d4cbad897/conf.d/hosts/splunk-ds1-dev.int.na.intgdc.com.conf
object Host "splunk-ds1-dev.int.na.intgdc.com" {
	import "develop-host"

	address = "172.26.77.102"
	enable_notifications = 1.000000
	vars["gdc_groups"] = [ "all", "Cluster 7008", "monitoring" ]
	vars["gdc_services"] = [ "collectd-process", "collectd-tcp", "cpu-stats" ]
	vars["gdc_type"] = "splunk-deployment-server"
	version = 1548944217.119378
	zone = "na"
}

and also I'm able to see information about the host using API:

{
  "attrs": {
    "__name": "splunk-ds1-dev.int.na.intgdc.com",
    "acknowledgement": 0.0,
    "acknowledgement_expiry": 0.0,
    "action_url": "",
    "active": true,
    "address": "172.26.77.102",
    "address6": "",
    "check_attempt": 1.0,
    "check_command": "hostalive",
    "check_interval": 1800.0,
    "check_period": "",
    "check_timeout": null,
    "command_endpoint": "",
    "display_name": "splunk-ds1-dev.int.na.intgdc.com",
    "downtime_depth": 0.0,
    "enable_active_checks": true,
    "enable_event_handler": true,
    "enable_flapping": true,
    "enable_notifications": true,
    "enable_passive_checks": true,
    "enable_perfdata": true,
    "event_command": "",
    "flapping": false,
    "flapping_current": 5.9,
    "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": [
      "Cluster 7008",
      "all",
      "monitoring",
      "monitoring-host-eod"
    ],
    "ha_mode": 0.0,
    "icon_image": "",
    "icon_image_alt": "",
    "last_check": 1548944231.781971,
    "last_check_result": {
      "active": true,
      "check_source": "icinga2-satellite-dev01.int.na.intgdc.com",
      "command": [
        "/usr/lib64/nagios/plugins/check_ping",
        "-H",
        "172.26.77.102",
        "-c",
        "5000,100%",
        "-w",
        "3000,80%"
      ],
      "execution_end": 1548944231.781909,
      "execution_start": 1548944227.776511,
      "exit_status": 0.0,
      "output": "PING OK - Packet loss = 0%, RTA = 0.42 ms",
      "performance_data": [
        "rta=0.421000ms;3000.000000;5000.000000;0.000000",
        "pl=0%;80;100;0"
      ],
      "schedule_end": 1548944231.781971,
      "schedule_start": 1548944227.776144,
      "state": 0.0,
      "ttl": 0.0,
      "type": "CheckResult",
      "vars_after": {
        "attempt": 1.0,
        "reachable": true,
        "state": 0.0,
        "state_type": 1.0
      },
      "vars_before": null
    },
    "last_hard_state": 0.0,
    "last_hard_state_change": 1548944231.782875,
    "last_reachable": true,
    "last_state": 1.0,
    "last_state_change": 1548944231.782875,
    "last_state_down": 0.0,
    "last_state_type": 0.0,
    "last_state_unreachable": 0.0,
    "last_state_up": 1548944231.782883,
    "max_check_attempts": 240.0,
    "name": "splunk-ds1-dev.int.na.intgdc.com",
    "next_check": 1548945984.1728952,
    "notes": "",
    "notes_url": "https://confluence.intgdc.com/display/plat/Host+Status+-+check+description",
    "original_attributes": null,
    "package": "_api",
    "paused": false,
    "retry_interval": 55.0,
    "severity": 8.0,
    "source_location": {
      "first_column": 0.0,
      "first_line": 1.0,
      "last_column": 45.0,
      "last_line": 1.0,
      "path": "/var/lib/icinga2/api/packages/_api/cde49d01-1589-4aee-9e35-260d4cbad897/conf.d/hosts/splunk-ds1-dev.int.na.intgdc.com.conf"
    },
    "state": 0.0,
    "state_type": 1.0,
    "templates": [
      "splunk-ds1-dev.int.na.intgdc.com",
      "develop-host",
      "generic-host"
    ],
    "type": "Host",
    "vars": {
      "check_interval": 60.0,
      "enable_pagerduty": true,
      "gdc_groups": [
        "all",
        "Cluster 7008",
        "monitoring"
      ],
      "gdc_services": [
        "collectd-process",
        "collectd-tcp",
        "cpu-stats"
      ],
      "gdc_type": "splunk-deployment-server",
      "nrpe_service": true,
      "retry_interval": 55.0,
      "type": "develop-host"
    },
    "version": 1548944217.119378,
    "volatile": false,
    "zone": "na"
  },
  "joins": {},
  "meta": {},
  "name": "splunk-ds1-dev.int.na.intgdc.com",
  "type": "Host"
}

Once the icinga is reloaded host is visible in UI.

Expected Behavior

See the host in UI without reload.

Context

We have started using API for adding hosts to icinga because the old solution (using classic configuration files) required reload of icinga which in our setup caused issues.

Your Environment

  • Version used (icinga2 --version):
icinga2 - The Icinga 2 network monitoring daemon (version: r2.10.2-1)

Copyright (c) 2012-2018 Icinga Development Team (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later <http:https://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

System information:
  Platform: CentOS Linux
  Platform version: 7 (Core)
  Kernel: Linux
  Kernel version: 3.10.0-862.9.1.el7.x86_64
  Architecture: x86_64

Build information:
  Compiler: GNU 4.8.5
  Build host: unknown

Application information:

General paths:
  Config directory: /etc/icinga2
  Data directory: /var/lib/icinga2
  Log directory: /var/log/icinga2
  Cache directory: /var/cache/icinga2
  Spool directory: /var/spool/icinga2
  Run directory: /run/icinga2

Old paths (deprecated):
  Installation root: /usr
  Sysconf directory: /etc
  Run directory (base): /run
  Local state directory: /var

Internal paths:
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/icinga2.pid
  • Operating System and version:
    CentOS Linux release 7.5.1804 (Core) - more details above in System information:

  • Enabled features (icinga2 feature list):

Disabled features: compatlog debuglog elasticsearch gelf graphite influxdb livestatus opentsdb perfdata statusdata syslog
Enabled features: api checker command ido-mysql mainlog notification
  • Icinga Web 2 version and modules (System - About):
Icinga Web 2 Version
2.6.1
Git commit
b3e0b5d587c3587a09d82b3634dbe3a5dd315353
Git commit date
2018-08-02

Loaded modules:
monitoring  2.6.1
  • Config validation (icinga2 daemon -C):
[2019-01-31 17:03:54 +0100] information/cli: Icinga application loader (version: r2.10.2-1)
[2019-01-31 17:03:54 +0100] information/cli: Loading configuration file(s).
[2019-01-31 17:03:54 +0100] information/ConfigItem: Committing config item(s).
[2019-01-31 17:03:54 +0100] information/ApiListener: My API identity: icinga2-master-dev01.int.na.intgdc.com
[2019-01-31 17:03:54 +0100] warning/ApplyRule: Apply rule 'disable-vertica-checks' (in /etc/icinga2/zones.d/global/dependencies.conf: 1:0-1:51) for type 'Dependency' does not match anywhere!
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 188 Services.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 1 IcingaApplication.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 9 Hosts.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 1 FileLogger.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 170 Dependencies.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 4 NotificationCommands.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 202 Notifications.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 1 NotificationComponent.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 11 HostGroups.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 1 ApiListener.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 1 CheckerComponent.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 3 Zones.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 1 ExternalCommandListener.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 3 Endpoints.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 2 ApiUsers.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 33 Users.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 1 IdoMysqlConnection.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 80 CheckCommands.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 17 UserGroups.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 4 ServiceGroups.
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 2 TimePeriods.
[2019-01-31 17:03:54 +0100] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars'
[2019-01-31 17:03:54 +0100] information/cli: Finished validating the configuration file(s).

For better readability I have removed 445 lines containing warning/ApplyRule.
The important thing is that it says:
[2019-01-31 17:03:54 +0100] information/ConfigItem: Instantiated 9 Hosts.
While in UI is only 8 hosts visible.

  • icinga2 object list --type Endpoint
Object 'icinga2-master-dev01.int.na.intgdc.com' of type 'Endpoint':
  % declared in '/etc/icinga2/zones.conf', lines 9:1-9:56
  * __name = "icinga2-master-dev01.int.na.intgdc.com"
  * host = "icinga2-master-dev01.int.na.intgdc.com"
    % = modified in '/etc/icinga2/zones.conf', lines 10:3-10:49
  * log_duration = 86400
  * name = "icinga2-master-dev01.int.na.intgdc.com"
  * package = "_etc"
  * port = "5665"
  * source_location
    * first_column = 1
    * first_line = 9
    * last_column = 56
    * last_line = 9
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "icinga2-master-dev01.int.na.intgdc.com" ]
    % = modified in '/etc/icinga2/zones.conf', lines 9:1-9:56
  * type = "Endpoint"
  * zone = ""

Object 'icinga2-satellite-dev01.int.na.intgdc.com' of type 'Endpoint':
  % declared in '/etc/icinga2/zones.conf', lines 19:1-19:59
  * __name = "icinga2-satellite-dev01.int.na.intgdc.com"
  * host = "icinga2-satellite-dev01.int.na.intgdc.com"
    % = modified in '/etc/icinga2/zones.conf', lines 20:3-20:52
  * log_duration = 86400
  * name = "icinga2-satellite-dev01.int.na.intgdc.com"
  * package = "_etc"
  * port = "5665"
  * source_location
    * first_column = 1
    * first_line = 19
    * last_column = 59
    * last_line = 19
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "icinga2-satellite-dev01.int.na.intgdc.com" ]
    % = modified in '/etc/icinga2/zones.conf', lines 19:1-19:59
  * type = "Endpoint"
  * zone = ""

Object 'icinga2-satellite-dev02.int.na.intgdc.com' of type 'Endpoint':
  % declared in '/etc/icinga2/zones.conf', lines 23:1-23:59
  * __name = "icinga2-satellite-dev02.int.na.intgdc.com"
  * host = "icinga2-satellite-dev02.int.na.intgdc.com"
    % = modified in '/etc/icinga2/zones.conf', lines 24:3-24:52
  * log_duration = 86400
  * name = "icinga2-satellite-dev02.int.na.intgdc.com"
  * package = "_etc"
  * port = "5665"
  * source_location
    * first_column = 1
    * first_line = 23
    * last_column = 59
    * last_line = 23
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "icinga2-satellite-dev02.int.na.intgdc.com" ]
    % = modified in '/etc/icinga2/zones.conf', lines 23:1-23:59
  * type = "Endpoint"
  * zone = ""
  • icinga2 object list --type Zone
Object 'na' of type 'Zone':
  % declared in '/etc/icinga2/zones.conf', lines 27:1-27:16
  * __name = "na"
  * endpoints = [ "icinga2-satellite-dev01.int.na.intgdc.com", "icinga2-satellite-dev02.int.na.intgdc.com" ]
    % = modified in '/etc/icinga2/zones.conf', lines 28:3-28:104
  * global = false
  * name = "na"
  * package = "_etc"
  * parent = "master"
    % = modified in '/etc/icinga2/zones.conf', lines 29:3-29:19
  * source_location
    * first_column = 1
    * first_line = 27
    * last_column = 16
    * last_line = 27
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "na" ]
    % = modified in '/etc/icinga2/zones.conf', lines 27:1-27:16
  * type = "Zone"
  * zone = ""

Object 'master' of type 'Zone':
  % declared in '/etc/icinga2/zones.conf', lines 14:1-14:20
  * __name = "master"
  * endpoints = [ "icinga2-master-dev01.int.na.intgdc.com" ]
    % = modified in '/etc/icinga2/zones.conf', lines 15:3-15:56
  * global = false
  * name = "master"
  * package = "_etc"
  * parent = ""
  * source_location
    * first_column = 1
    * first_line = 14
    * last_column = 20
    * last_line = 14
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "master" ]
    % = modified in '/etc/icinga2/zones.conf', lines 14:1-14:20
  * type = "Zone"
  * zone = ""

Object 'global' of type 'Zone':
  % declared in '/etc/icinga2/zones.conf', lines 4:1-4:20
  * __name = "global"
  * endpoints = null
  * global = true
    % = modified in '/etc/icinga2/zones.conf', lines 5:3-5:15
  * name = "global"
  * package = "_etc"
  * parent = ""
  * source_location
    * first_column = 1
    * first_line = 4
    * last_column = 20
    * last_line = 4
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "global" ]
    % = modified in '/etc/icinga2/zones.conf', lines 4:1-4:20
  * type = "Zone"
  * zone = ""
@dnsmichi
Copy link
Contributor

dnsmichi commented Feb 1, 2019

Thanks for the report. We have a combined tracking issue #6012 for this, since this isn't the first issue about this problem. Closing therefore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api REST API area/db-ido Database output
Projects
None yet
Development

No branches or pull requests

2 participants