Icinga / icinga2

The core of our monitoring platform with a powerful configuration language and REST API.
https://icinga.com/docs/icinga2/latest
GNU General Public License v2.0
1.99k stars 573 forks source link

Problems with custom vars not being updated if hosts have been created and updated via API #8699

Open eeertel opened 3 years ago

eeertel commented 3 years ago

Changes of custom vars are not handled correctly

This issue is probably related to https://github.com/Icinga/icinga2/issues/6012, https://github.com/Icinga/icinga2/issues/6569 and https://github.com/Icinga/icinga2/issues/6576.

We create and update hosts via API. The updates of custom vars are not processed correctly (e.g. hostgroups and dependencies defined on above mentioned custom vars) even after a restart/reload of the icinga2 service

We have tried out all workarounds (e.g. UPDATE icinga_hosts SET config_hash = NULL; ...) without any luck.

To make a long story short, there is a difference between the host object retrieved via the API :

curl -k -s -u '' -H 'Accept: application/json' \ -H 'X-HTTP-Method-Override: GET' -X POST \ 'https://localhost:5665/v1/objects/hosts' \ -d '{ "filter": "host.name==\"600601_IN_Salem_MithraScans(P)Ltd_12504_desktop-vice7td_rlp0\"", "pretty": true }'

and via the icinga2 object list command below:

icinga2 object list --type=host --name="600601_IN_Salem_MithraScans(P)Ltd_12504_desktop-vice7td_rlp0"

even after a restart or reload of icinga2

To Reproduce

  1. Create a host via API
  2. Update the host custom vars via API
  3. Perform a reload/restart of icinga2

Expected behavior

The updated custom vars should be reflected in the icinga2 object list output

Screenshots

n.a.

Your Environment

Include as many relevant details about the environment you experienced the problem in

Copyright (c) 2012-2021 Icinga GmbH (https://icinga.com/) License GPLv2+: GNU GPL version 2 or later http://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: Ubuntu Platform version: 18.04.5 LTS (Bionic Beaver) Kernel: Linux Kernel version: 5.4.0-1043-azure Architecture: x86_64

Build information: Compiler: GNU 8.4.0 Build host: runner-hh8q3bz2-project-298-concurrent-0 OpenSSL version: OpenSSL 1.1.1 11 Sep 2018

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

* Enabled features (`icinga2 feature list`):

Disabled features: command compatlog debuglog elasticsearch gelf graphite icingadb influxdb livestatus opentsdb perfdata statusdata Enabled features: api checker ido-pgsql mainlog notification syslog

* Config validation (`icinga2 daemon -C`):

[2021-03-24 11:01:48 +0000] information/cli: Icinga application loader (version: r2.12.3-1) [2021-03-24 11:01:48 +0000] information/cli: Loading configuration file(s). [2021-03-24 11:01:49 +0000] information/ConfigItem: Committing config item(s). [2021-03-24 11:01:49 +0000] information/ApiListener: My API identity: icingaconfigmaster-staging.teamplay.monitoring.net [2021-03-24 11:01:59 +0000] information/WorkQueue: #4 (DaemonUtility::LoadConfigFiles) items: 0, rate: 23.7333/s (1424/min 1424/5min 1424/15min); [2021-03-24 11:01:59 +0000] information/WorkQueue: #5 (ApiListener, RelayQueue) items: 0, rate: 0/s (0/min 0/5min 0/15min); [2021-03-24 11:01:59 +0000] information/WorkQueue: #6 (ApiListener, SyncQueue) items: 0, rate: 0/s (0/min 0/5min 0/15min); [2021-03-24 11:02:08 +0000] warning/ApplyRule: Apply rule 'teams4host-icingaadmin' (in /etc/icinga2/zones.d/global-templates/notifications.conf: 31:1-31:51) for type 'Notification' does not match anywhere! [2021-03-24 11:02:08 +0000] warning/ApplyRule: Apply rule 'teams4service-icingaadmin' (in /etc/icinga2/zones.d/global-templates/notifications.conf: 40:1-40:57) for type 'Notification' does not match anywhere! [2021-03-24 11:02:08 +0000] warning/ApplyRule: Apply rule 'ping4' (in /etc/icinga2/zones.d/global-templates/custom_services/services.conf: 2:1-2:21) for type 'Service' does not match anywhere! [2021-03-24 11:02:08 +0000] warning/ApplyRule: Apply rule '' (in /etc/icinga2/zones.d/global-templates/custom_services/services.conf: 31:1-31:65) for type 'Service' does not match anywhere! [2021-03-24 11:02:08 +0000] warning/ApplyRule: Apply rule '' (in /etc/icinga2/zones.d/global-templates/custom_services/services.conf: 39:1-39:53) for type 'Service' does not match anywhere! [2021-03-24 11:02:08 +0000] warning/ApplyRule: Apply rule 'swap' (in /etc/icinga2/zones.d/global-templates/custom_services/services.conf: 85:1-85:20) for type 'Service' does not match anywhere! [2021-03-24 11:02:08 +0000] warning/ApplyRule: Apply rule 'MalwareScanServiceIsOperableCheck' (in /etc/icinga2/zones.d/global-templates/teamplay_resources/services/malwarescanservice.conf: 1:0-1:48) for type 'Service' does not match anywhere! [2021-03-24 11:02:08 +0000] warning/ApplyRule: Apply rule 'MalwareScanServiceCertificateCheck' (in /etc/icinga2/zones.d/global-templates/teamplay_resources/services/malwarescanservice.conf: 12:1-12:50) for type 'Service' does not match anywhere! [2021-03-24 11:02:08 +0000] warning/ApplyRule: Apply rule 'child-health' (in /etc/icinga2/zones.d/teamplay.monitoring.masterzone/clusters/cluster.conf: 9:1-9:28) for type 'Service' does not match anywhere! [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 1 NotificationComponent. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 1 SyslogLogger. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 4289 Hosts. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 436 Downtimes. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 4 NotificationCommands. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 1 FileLogger. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 3827 Comments. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 60767 Notifications. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 1 IcingaApplication. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 85 HostGroups. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 57050 Dependencies. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 1 CheckerComponent. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 5 Zones. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 8 Endpoints. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 2 ApiUsers. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 1 ApiListener. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 301 CheckCommands. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 1 IdoPgsqlConnection. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 3 TimePeriods. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 13 UserGroups. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 16 Users. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 56519 Services. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 3 ServiceGroups. [2021-03-24 11:02:08 +0000] information/ConfigItem: Instantiated 9 ScheduledDowntimes.

* If you run multiple Icinga 2 instances, the `zones.conf` file (or `icinga2 object list --type Endpoint` and `icinga2 object list --type Zone`) from all affected nodes.

Object 'icingaussat1-staging.teamplay.monitoring.net' of type 'Endpoint': % declared in '/etc/icinga2/zones.conf', lines 30:1-30:62

Object 'icingasecondarymaster-staging.teamplay.monitoring.net' of type 'Endpoint': % declared in '/etc/icinga2/zones.conf', lines 9:1-9:71

Object 'icingaconfigmaster-staging.teamplay.monitoring.net' of type 'Endpoint': % declared in '/etc/icinga2/zones.conf', lines 5:1-5:68

Object 'icingaeusat1-staging.teamplay.monitoring.net' of type 'Endpoint': % declared in '/etc/icinga2/zones.conf', lines 14:1-14:62

Object 'icingaussat2-staging.teamplay.monitoring.net' of type 'Endpoint': % declared in '/etc/icinga2/zones.conf', lines 34:1-34:62

Object 'icingaeusat2-staging.teamplay.monitoring.net' of type 'Endpoint': % declared in '/etc/icinga2/zones.conf', lines 18:1-18:62

Object 'icingajpsat2-staging.teamplay.monitoring.net' of type 'Endpoint': % declared in '/etc/icinga2/zones.conf', lines 26:1-26:62

Object 'icingajpsat1-staging.teamplay.monitoring.net' of type 'Endpoint': % declared in '/etc/icinga2/zones.conf', lines 22:1-22:62

object Endpoint "icingasecondarymaster-staging.teamplay.monitoring.net" { host = "10.3.0.6" }

object Endpoint "icingaeusat1-staging.teamplay.monitoring.net" { host = "10.3.0.7" }

object Endpoint "icingaeusat2-staging.teamplay.monitoring.net" { host = "10.3.0.8" }

object Endpoint "icingajpsat1-staging.teamplay.monitoring.net" { host = "10.4.0.4" }

object Endpoint "icingajpsat2-staging.teamplay.monitoring.net" { host = "10.4.0.5" }

object Endpoint "icingaussat1-staging.teamplay.monitoring.net" { host = "10.5.0.4" }

object Endpoint "icingaussat2-staging.teamplay.monitoring.net" { host = "10.5.0.5" }

object Zone "teamplay.monitoring.masterzone" { endpoints = [ "icingaconfigmaster-staging.teamplay.monitoring.net" , "icingasecondarymaster-staging.teamplay.monitoring.net" ] }

object Zone "teamplay.monitoring.euclientzone" { endpoints = [ "icingaeusat1-staging.teamplay.monitoring.net", "icingaeusat2-staging.teamplay.monitoring.net" ]

parent = "teamplay.monitoring.masterzone"

}

object Zone "teamplay.monitoring.jpclientzone" { endpoints = [ "icingajpsat1-staging.teamplay.monitoring.net", "icingajpsat2-staging.teamplay.monitoring.net" ]

parent = "teamplay.monitoring.masterzone"

}

object Zone "teamplay.monitoring.usclientzone" { endpoints = [ "icingaussat1-staging.teamplay.monitoring.net", "icingaussat2-staging.teamplay.monitoring.net" ]

parent = "teamplay.monitoring.masterzone"

}

/ sync global commands / object Zone "global-templates" { global = true }


## Additional context
Al2Klimov commented 3 years ago

At the first sight it sounds like #8155.

eeertel commented 3 years ago

I am not sure if this is the case. The reason why I doubt this, is because I do not even need to verify if the hostgroup evaluation is correct (based on the host custom variables). A simple object list output shows that icinga2 has not updated the content of the icinga2.debug file.

The problem can be reproduced by this simple sequence:

  1. modify the custom variables of a host via REST API
  2. restart/reload icinga2
  3. the icinga2 object list command does not reflect the custom variable changes performed via REST API in step 1 (which they should according to the documentation https://icinga.com/docs/icinga-2/latest/doc/11-cli-commands/)

Do you need any additional logs or information to narrow it down ?

Jacko161 commented 3 years ago

We believe we have run into this as well on

icinga2 - The Icinga 2 network monitoring daemon (version: r2.12.3-1)

Copyright (c) 2012-2021 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later <http://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: Debian GNU/Linux
  Platform version: 9 (stretch)
  Kernel: Linux
  Kernel version: 4.9.0-11-amd64
  Architecture: x86_64

Build information:
  Compiler: GNU 6.3.0
  Build host: runner-hh8q3bz2-project-298-concurrent-0
  OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

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

We were able to get around it on a test server by deleting the contents of /var/lib/icinga2/api/packages and restarting icinga2, however, this doesn't really sit well as the right way to fix things in an environment where you care about the state of Icinga.

Al2Klimov commented 2 years ago

I am not sure if this is the case.

Sure or not sure – would you test that fix if I build packages for you?

eeertel commented 2 years ago

yes - no problem with that (sorry for the late reply)

Al2Klimov commented 2 years ago

On which Icinga 2 version + OS shall the packages be based?

eeertel commented 2 years ago

uname -a Linux icingamaster 5.4.0-1058-azure #60~18.04.1-Ubuntu SMP Tue Aug 31 20:34:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

icinga2 --version icinga2 - The Icinga 2 network monitoring daemon (version: r2.13.1-1)

Copyright (c) 2012-2021 Icinga GmbH (https://icinga.com/) License GPLv2+: GNU GPL version 2 or later 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: Ubuntu Platform version: 18.04.6 LTS (Bionic Beaver) Kernel: Linux Kernel version: 5.4.0-1058-azure Architecture: x86_64

Build information: Compiler: GNU 8.4.0 Build host: runner-hh8q3bz2-project-508-concurrent-0 OpenSSL version: OpenSSL 1.1.1 11 Sep 2018

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

Al2Klimov commented 2 years ago

https://git.icinga.com/packaging/deb-icinga2/-/jobs/127541/artifacts/download

Backup your /var/lib/icinga2/modified-attributes.conf first!

eeertel commented 2 years ago

thanks - will install it today or tomorrow and will let you know.

eeertel commented 2 years ago

The fix is working !

See below a snip of the installed version and the output of the commands. Command sequence:

  1. check value of the host variable (name of the host variable is: dynamic_var) via the object list command
  2. verified that the value is correct via api call (curl)
  3. modified the host variable value via the API call (not visible in the output) via host update call
  4. restarted icinga2
  5. checked that the new variable value is reflected via the object list command

    root@icingamaster-dev:/etc/icinga2# icinga2 object list --type=host --name "azrg_acs_mixed" Object 'azrg_acs_mixed' of type 'Host': % declared in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 1:0-1:27

    • __name = "azrg_acs_mixed"
    • action_url = ""
    • address = "azrg_acs_mixed" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 4:2-4:27
    • address6 = ""
    • check_command = "dummy" % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 6:3-6:25
    • check_interval = 300 % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 3:3-3:21
    • check_period = ""
    • check_timeout = null
    • command_endpoint = ""
    • display_name = "azrg_acs_mixed" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 5:2-5:32
    • enable_active_checks = true
    • enable_event_handler = true
    • enable_flapping = false
    • enable_notifications = true
    • enable_passive_checks = true
    • enable_perfdata = true
    • event_command = ""
    • flapping_ignore_states = null
    • flapping_threshold = 0
    • flapping_threshold_high = 30
    • flapping_threshold_low = 25
    • groups = [ ]
    • icon_image = ""
    • icon_image_alt = ""
    • max_check_attempts = 2 % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 2:3-2:24
    • name = "azrg_acs_mixed"
    • notes = "{ azure_deployment = "dev" azure_location = "West Europe" azure_region = "EMEA" icinga_zone = "teamplay.monitoring.euclientzone" subscription_id = "44650d0a-f134-44e3-94f1-550c71b27d99" teamplay_deployment = "dev" teamplay_location = "eu-west" tenant_id = "cfd26b50-fb8f-44cf-87b2-d5df3d15d884" }" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 6:2-15:2
    • notes_url = ""
    • package = "_api"
    • retry_interval = 300 % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 4:3-4:21
    • source_location
    • first_column = 0
    • first_line = 1
    • last_column = 27
    • last_line = 1
    • path = "/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf"
    • templates = [ "azrg_acs_mixed", "az-resource-group-host" ] % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 1:0-1:27 % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 1:0-1:37
    • type = "Host"
    • vars
    • azure_portal = "portal.azure.com" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 16:2-16:42
    • deployment = "Common Dev" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 17:2-17:34
    • downtimecontroller = "Common Dev-eu-downtimecontroller" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 18:2-18:64
    • dummy_state = 0 % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 7:3-7:22
    • dummy_text = "Azure resource group status is always 30 green ;-)" % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 8:3-8:72
    • dynamic_var = "modified_variable_value"
    • location = "eu-west" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 19:2-19:29
    • notification
      • mail % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 12:3-14:3
      • groups = [ "cloudadmins" ]
    • os = "AzResourceGroup" % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 9:3-9:29
    • resource_group = "acs-mixed" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 20:2-20:37
    • subscription_id = "44650d0a-f134-44e3-94f1-550c71b27d99" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 21:2-21:65
    • tenant = "cfd26b50-fb8f-44cf-87b2-d5df3d15d884" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 22:2-22:56
    • volatile = false
    • zone = "teamplay.monitoring.euclientzone" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 24:2-24:42 root@icingamaster-dev:/etc/icinga2# curl -k -s -u root:'XXX' -H 'Accept: application/json' -H 'X-HTTP-Method-Override: GET' -X POST 'https://localhost:5665/v1/objects/hosts' -d '{ "filter": "host.name==\"azrg_acs_mixed\"", "pretty": true }' { "results": [ { "attrs": { "__name": "azrg_acs_mixed", "acknowledgement": 0, "acknowledgement_expiry": 0, "acknowledgement_last_change": 0, "action_url": "", "active": true, "address": "azrg_acs_mixed", "address6": "", "check_attempt": 1, "check_command": "dummy", "check_interval": 300, "check_period": "", "check_timeout": null, "command_endpoint": "", "display_name": "azrg_acs_mixed", "downtime_depth": 0, "enable_active_checks": true, "enable_event_handler": true, "enable_flapping": false, "enable_notifications": true, "enable_passive_checks": true, "enable_perfdata": true, "event_command": "", "executions": null, "flapping": false, "flapping_current": 5.9, "flapping_ignore_states": null, "flapping_last_change": 0, "flapping_threshold": 0, "flapping_threshold_high": 30, "flapping_threshold_low": 25, "force_next_check": false, "force_next_notification": false, "groups": [], "ha_mode": 0, "handled": false, "icon_image": "", "icon_image_alt": "", "last_check": 1634748735.878757, "last_check_result": { "active": true, "check_source": "icingaeusat1-dev.teamplay.monitoring.net", "command": "dummy", "execution_end": 1634748735.87875, "execution_start": 1634748735.87875, "exit_status": 0, "output": "Azure resource group status is always 30 green ;-)", "performance_data": [], "schedule_end": 1634748735.878757, "schedule_start": 1634748735.8784103, "scheduling_source": "icingaeusat1-dev.teamplay.monitoring.net", "state": 0, "ttl": 0, "type": "CheckResult", "vars_after": { "attempt": 1, "reachable": true, "state": 0, "state_type": 1 }, "vars_before": null }, "last_hard_state": 0, "last_hard_state_change": 1634748735.87875, "last_reachable": true, "last_state": 1, "last_state_change": 1634748735.87875, "last_state_down": 0, "last_state_type": 0, "last_state_unreachable": 0, "last_state_up": 1634748735.87875, "max_check_attempts": 2, "name": "azrg_acs_mixed", "next_check": 1634749021.2599711, "next_update": 1634749321.2606506, "notes": "{\n\tazure_deployment = \"dev\"\n\tazure_location = \"West Europe\"\n\tazure_region = \"EMEA\"\n\ticinga_zone = \"teamplay.monitoring.euclientzone\"\n\tsubscription_id = \"44650d0a-f134-44e3-94f1-550c71b27d99\"\n\tteamplay_deployment = \"dev\"\n\tteamplay_location = \"eu-west\"\n\ttenant_id = \"cfd26b50-fb8f-44cf-87b2-d5df3d15d884\"\n}", "notes_url": "", "original_attributes": null, "package": "_api", "paused": false, "previous_state_change": 1634748467.274557, "problem": false, "retry_interval": 300, "severity": 0, "source_location": { "first_column": 0, "first_line": 1, "last_column": 27, "last_line": 1, "path": "/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf" }, "state": 0, "state_type": 1, "templates": [ "azrg_acs_mixed", "az-resource-group-host" ], "type": "Host", "vars": { "azure_portal": "portal.azure.com", "deployment": "Common Dev", "downtimecontroller": "Common Dev-eu-downtimecontroller", "dummy_state": 0, "dummy_text": "Azure resource group status is always 30 green ;-)", "dynamic_var": "original_variable_value", "location": "eu-west", "notification": { "mail": { "groups": [ "cloudadmins" ] } }, "os": "AzResourceGroup", "resource_group": "acs-mixed", "subscription_id": "44650d0a-f134-44e3-94f1-550c71b27d99", "tenant": "cfd26b50-fb8f-44cf-87b2-d5df3d15d884" }, "version": 1634748675.834054, "volatile": false, "zone": "teamplay.monitoring.euclientzone" }, "joins": {}, "meta": {}, "name": "azrg_acs_mixed", "type": "Host" } ] } root@icingamaster-dev:/etc/icinga2# ### will now modify per api call the value of the dynamic_var host variable ### root@icingamaster-dev:/etc/icinga2# ### the variable value is now modified - printing out via api and then restart icinga2 ### root@icingamaster-dev:/etc/icinga2# curl -k -s -u root:'XXX' -H 'Accept: application/json' -H 'X-HTTP-Method-Override: GET' -X POST 'https://localhost:5665/v1/objects/hosts' -d '{ "filter": "host.name==\"azrg_acs_mixed\"", "pretty": true }' { "results": [ { "attrs": { "__name": "azrg_acs_mixed", "acknowledgement": 0, "acknowledgement_expiry": 0, "acknowledgement_last_change": 0, "action_url": "", "active": true, "address": "azrg_acs_mixed", "address6": "", "check_attempt": 1, "check_command": "dummy", "check_interval": 300, "check_period": "", "check_timeout": null, "command_endpoint": "", "display_name": "azrg_acs_mixed", "downtime_depth": 0, "enable_active_checks": true, "enable_event_handler": true, "enable_flapping": false, "enable_notifications": true, "enable_passive_checks": true, "enable_perfdata": true, "event_command": "", "executions": null, "flapping": false, "flapping_current": 5.9, "flapping_ignore_states": null, "flapping_last_change": 0, "flapping_threshold": 0, "flapping_threshold_high": 30, "flapping_threshold_low": 25, "force_next_check": false, "force_next_notification": false, "groups": [], "ha_mode": 0, "handled": false, "icon_image": "", "icon_image_alt": "", "last_check": 1634748735.878757, "last_check_result": { "active": true, "check_source": "icingaeusat1-dev.teamplay.monitoring.net", "command": "dummy", "execution_end": 1634748735.87875, "execution_start": 1634748735.87875, "exit_status": 0, "output": "Azure resource group status is always 30 green ;-)", "performance_data": [], "schedule_end": 1634748735.878757, "schedule_start": 1634748735.8784103, "scheduling_source": "icingaeusat1-dev.teamplay.monitoring.net", "state": 0, "ttl": 0, "type": "CheckResult", "vars_after": { "attempt": 1, "reachable": true, "state": 0, "state_type": 1 }, "vars_before": null }, "last_hard_state": 0, "last_hard_state_change": 1634748735.87875, "last_reachable": true, "last_state": 1, "last_state_change": 1634748735.87875, "last_state_down": 0, "last_state_type": 0, "last_state_unreachable": 0, "last_state_up": 1634748735.87875, "max_check_attempts": 2, "name": "azrg_acs_mixed", "next_check": 1634749021.2599711, "next_update": 1634749321.2606506, "notes": "{\n\tazure_deployment = \"dev\"\n\tazure_location = \"West Europe\"\n\tazure_region = \"EMEA\"\n\ticinga_zone = \"teamplay.monitoring.euclientzone\"\n\tsubscription_id = \"44650d0a-f134-44e3-94f1-550c71b27d99\"\n\tteamplay_deployment = \"dev\"\n\tteamplay_location = \"eu-west\"\n\ttenant_id = \"cfd26b50-fb8f-44cf-87b2-d5df3d15d884\"\n}", "notes_url": "", "original_attributes": { "address": "azrg_acs_mixed", "display_name": "azrg_acs_mixed", "notes": "{\n\tazure_deployment = \"dev\"\n\tazure_location = \"West Europe\"\n\tazure_region = \"EMEA\"\n\ticinga_zone = \"teamplay.monitoring.euclientzone\"\n\tsubscription_id = \"44650d0a-f134-44e3-94f1-550c71b27d99\"\n\tteamplay_deployment = \"dev\"\n\tteamplay_location = \"eu-west\"\n\ttenant_id = \"cfd26b50-fb8f-44cf-87b2-d5df3d15d884\"\n}", "vars.azure_portal": "portal.azure.com", "vars.deployment": "Common Dev", "vars.downtimecontroller": "Common Dev-eu-downtimecontroller", "vars.dynamic_var": "original_variable_value", "vars.location": "eu-west", "vars.resource_group": "acs-mixed", "vars.subscription_id": "44650d0a-f134-44e3-94f1-550c71b27d99", "vars.tenant": "cfd26b50-fb8f-44cf-87b2-d5df3d15d884" }, "package": "_api", "paused": false, "previous_state_change": 1634748467.274557, "problem": false, "retry_interval": 300, "severity": 0, "source_location": { "first_column": 0, "first_line": 1, "last_column": 27, "last_line": 1, "path": "/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf" }, "state": 0, "state_type": 1, "templates": [ "azrg_acs_mixed", "az-resource-group-host" ], "type": "Host", "vars": { "azure_portal": "portal.azure.com", "deployment": "Common Dev", "downtimecontroller": "Common Dev-eu-downtimecontroller", "dummy_state": 0, "dummy_text": "Azure resource group status is always 30 green ;-)", "dynamic_var": "modified_variable_value", "location": "eu-west", "notification": { "mail": { "groups": [ "cloudadmins" ] } }, "os": "AzResourceGroup", "resource_group": "acs-mixed", "subscription_id": "44650d0a-f134-44e3-94f1-550c71b27d99", "tenant": "cfd26b50-fb8f-44cf-87b2-d5df3d15d884" }, "version": 1634748856.816978, "volatile": false, "zone": "teamplay.monitoring.euclientzone" }, "joins": {}, "meta": {}, "name": "azrg_acs_mixed", "type": "Host" } ] } root@icingamaster-dev:/etc/icinga2# service icinga2 restart root@icingamaster-dev:/etc/icinga2# icinga2 object list --type=host --name "azrg_acs_mixed" Object 'azrg_acs_mixed' of type 'Host': % declared in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 1:0-1:27
    • __name = "azrg_acs_mixed"
    • action_url = ""
    • address = "azrg_acs_mixed" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 4:2-4:27
    • address6 = ""
    • check_command = "dummy" % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 6:3-6:25
    • check_interval = 300 % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 3:3-3:21
    • check_period = ""
    • check_timeout = null
    • command_endpoint = ""
    • display_name = "azrg_acs_mixed" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 5:2-5:32
    • enable_active_checks = true
    • enable_event_handler = true
    • enable_flapping = false
    • enable_notifications = true
    • enable_passive_checks = true
    • enable_perfdata = true
    • event_command = ""
    • flapping_ignore_states = null
    • flapping_threshold = 0
    • flapping_threshold_high = 30
    • flapping_threshold_low = 25
    • groups = [ ]
    • icon_image = ""
    • icon_image_alt = ""
    • max_check_attempts = 2 % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 2:3-2:24
    • name = "azrg_acs_mixed"
    • notes = "{ azure_deployment = "dev" azure_location = "West Europe" azure_region = "EMEA" icinga_zone = "teamplay.monitoring.euclientzone" subscription_id = "44650d0a-f134-44e3-94f1-550c71b27d99" teamplay_deployment = "dev" teamplay_location = "eu-west" tenant_id = "cfd26b50-fb8f-44cf-87b2-d5df3d15d884" }" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 6:2-15:2
    • notes_url = ""
    • package = "_api"
    • retry_interval = 300 % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 4:3-4:21
    • source_location
    • first_column = 0
    • first_line = 1
    • last_column = 27
    • last_line = 1
    • path = "/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf"
    • templates = [ "azrg_acs_mixed", "az-resource-group-host" ] % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 1:0-1:27 % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 1:0-1:37
    • type = "Host"
    • vars
    • azure_portal = "portal.azure.com" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 16:2-16:42
    • deployment = "Common Dev" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 17:2-17:34
    • downtimecontroller = "Common Dev-eu-downtimecontroller" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 18:2-18:64
    • dummy_state = 0 % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 7:3-7:22
    • dummy_text = "Azure resource group status is always 30 green ;-)" % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 8:3-8:72
    • dynamic_var = "modified_variable_value" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 19:2-19:48
    • location = "eu-west" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 20:2-20:29
    • notification
      • mail % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 12:3-14:3
      • groups = [ "cloudadmins" ]
    • os = "AzResourceGroup" % = modified in '/etc/icinga2/zones.d/global-templates/teamplay_resources/templates/azrg.conf', lines 9:3-9:29
    • resource_group = "acs-mixed" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 21:2-21:37
    • subscription_id = "44650d0a-f134-44e3-94f1-550c71b27d99" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 22:2-22:65
    • tenant = "cfd26b50-fb8f-44cf-87b2-d5df3d15d884" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 23:2-23:56
    • volatile = false
    • zone = "teamplay.monitoring.euclientzone" % = modified in '/var/lib/icinga2/api/packages/_api/d2bb9ae4-dfd4-4ebe-a4b3-154b30460bf2/conf.d/hosts/azrg_acs_mixed.conf', lines 25:2-25:42 root@icingamaster-dev:/etc/icinga2#

root@icingamaster-dev:/etc/icinga2# icinga2 --version icinga2 - The Icinga 2 network monitoring daemon (version: v2.13.1-4-g7b7158833)

Copyright (c) 2012-2021 Icinga GmbH (https://icinga.com/) License GPLv2+: GNU GPL version 2 or later 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: Ubuntu Platform version: 18.04.6 LTS (Bionic Beaver) Kernel: Linux Kernel version: 5.4.0-1056-azure Architecture: x86_64

Build information: Compiler: GNU 8.4.0 Build host: runner-hh8q3bz2-project-298-concurrent-0 OpenSSL version: OpenSSL 1.1.1 11 Sep 2018

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 root@icingamaster-dev:/etc/icinga2#

eeertel commented 1 year ago

@Al2Klimov Do you have an estimated release date when this bug will be fixed ?

Al2Klimov commented 1 year ago

Unfortunately no.