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

[dev.icinga.com #10717] Comments and downtimes of deleted checkable objects are not deleted #3707

Closed
icinga-migration opened this issue Nov 24, 2015 · 17 comments
Labels
area/configuration DSL, parser, compiler, error handling blocker Blocks a release or needs immediate attention bug Something isn't working
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/10717

Created by jflach on 2015-11-24 11:34:47 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2016-05-03 09:35:07 +00:00)
Target Version: 2.4.8
Last Update: 2016-05-03 09:35:07 +00:00 (in Redmine)

Icinga Version: 2.4.0
Backport?: Not yet backported
Include in Changelog: 1

[2015-11-24 12:02:32 +0100] warning/ConfigObject: Ignoring config object 'littlefinger-1447925667-1' of type 'Comment' due to errors: Error: Comment 'virt.mtn-server!service_backup!littlefinger-1447925667-1' references a host/service which doesn't exist.
Location: in /var/lib/icinga2/api/packages/_api/littlefinger-1447767461-1/conf.d/comments/virt.mtn-server!service_backup!littlefinger-1447925667-1.conf: 1:0-1:57
/var/lib/icinga2/api/packages/_api/littlefinger-1447767461-1/conf.d/comments/virt.mtn-server!service_backup!littlefinger-1447925667-1.conf(1): object Comment "littlefinger-1447925667-1" ignore_on_error {
                                                                                                                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/lib/icinga2/api/packages/_api/littlefinger-1447767461-1/conf.d/comments/virt.mtn-server!service_backup!littlefinger-1447925667-1.conf(2):  author = "icingaweb2"
/var/lib/icinga2/api/packages/_api/littlefinger-1447767461-1/conf.d/comments/virt.mtn-server!service_backup!littlefinger-1447925667-1.conf(3):  entry_type = 4.000000

(12:29:46 PM) crunsher: That's a stupid situation though, you wouldn't want icinga to cry about config errors because some comments don't apply anymore
(12:31:18 PM) shroud: crunsher: submit a bug report for this :P
(12:31:47 PM) shroud: yeah, that's somewhat annoying, but atm we don't automatically remove those files :(

Changesets

2016-05-03 09:30:02 +00:00 by mfriedrich 2faf121

Remove commentsand downtimes with reference to deleted checkable objects

Silence the warning message and change the log level to notice as well.

fixes #10717

2016-05-12 09:08:20 +00:00 by mfriedrich 7c7a4c3

Remove commentsand downtimes with reference to deleted checkable objects

Silence the warning message and change the log level to notice as well.

fixes #10717

Relations:

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-01-22 15:31:45 +00:00

  • Subject changed from Comments of deleted hosts are not deleted to Comments and downtimes of deleted checkable objects are not deleted
  • Target Version set to Backlog

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-01-22 15:33:09 +00:00

  • Relates set to 10984

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-01-29 09:17:33 +00:00

  • Duplicated set to 11056

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-02-24 21:49:27 +00:00

  • Priority changed from Normal to High

@icinga-migration
Copy link
Author

Updated by tgelf on 2016-02-26 21:07:53 +00:00

I LIKE**

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-03-04 15:56:31 +00:00

  • Target Version changed from Backlog to 2.5.0

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-03-10 16:20:56 +00:00

  • Duplicated set to 11356

@icinga-migration
Copy link
Author

Updated by mnardin on 2016-03-15 16:52:52 +00:00

Hi,
I just experienced the same behavior on our prod environment.

@icinga-migration
Copy link
Author

Updated by tuxifier on 2016-03-17 09:43:30 +00:00

Hello,
I also see this issue (warning in config Validation) for comments:
[2016-03-17 10:32:08 +0100] warning/ConfigObject: Ignoring config object XXX-1457945755-1' of type 'Comment' due to errors: Error: Validation failed for obj ect 'XXX-1457945755-1' of type 'Comment'; Attribute 'host_name': Object 'XXX' of type 'Host' does not exist.
Location: in /var/lib/icinga2/api/packages/_api/XXX-1452869573-1/conf.d/comments/XXX-1457945755-1.conf: 1:0-1:56
/var/lib/icinga2/api/packages/_api/XXX-1452869573-1/conf.d/comments/XXX!yyy-1457945755-1.conf(1): object Comment "XXX-1457945755-1" ignore_on_error {
^

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-03-18 16:03:33 +00:00

  • Status changed from New to Assigned
  • Assigned to set to mfriedrich

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-03-21 08:04:23 +00:00

  • Duplicated set to 11419

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-03-21 19:44:12 +00:00

  • Duplicated deleted 11419

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-03-22 13:13:53 +00:00

TODOs:

  • Store the filename globally
  • Delete all ignore_on_error objects afterwards, if they were created by the _api package
  • Change the log level to notice

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-03-30 15:54:28 +00:00

Tests

Comment/uncomment the Service apply rule to use the default conf.d/downtimes.conf scheduled downtime generating those downtime objects.

for (i in range(10)) {
  object Host "downtime-test-" + i {
    check_command = "dummy"
  }
}
apply Service "downtime-test" {
  import "generic-service"

  check_command = "load"

  vars.backup_downtime = "02:00-23:00"

  assign where match("downtime-test*", host.name)
}

# tree /usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/
/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/
├── downtime-test-0!downtime-test!mbmif.int.netways.de-1459352253-2.conf
├── downtime-test-1!downtime-test!mbmif.int.netways.de-1459352253-0.conf
├── downtime-test-2!downtime-test!mbmif.int.netways.de-1459352253-5.conf
├── downtime-test-3!downtime-test!mbmif.int.netways.de-1459352253-3.conf
├── downtime-test-4!downtime-test!mbmif.int.netways.de-1459352253-4.conf
├── downtime-test-5!downtime-test!mbmif.int.netways.de-1459352253-6.conf
├── downtime-test-6!downtime-test!mbmif.int.netways.de-1459352253-7.conf
├── downtime-test-7!downtime-test!mbmif.int.netways.de-1459352253-9.conf
├── downtime-test-8!downtime-test!mbmif.int.netways.de-1459352253-8.conf
├── downtime-test-9!downtime-test!mbmif.int.netways.de-1459352253-1.conf
├── mbmif.int.netways.de!disk\ %2F!mbmif.int.netways.de-1458726179-1.conf
├── mbmif.int.netways.de!load!mbmif.int.netways.de-1459330771-9.conf
├── myhost!ping4!mbmif.int.netways.de-1458728594-0.conf
├── myhost!ssh!mbmif.int.netways.de-1458736523-0.conf
└── myprinter!ping4!mbmif.int.netways.de-1458222803-0.conf

0 directories, 15 files

Remove the service apply. Restart.

# tree /usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/
/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/
├── mbmif.int.netways.de!disk\ %2F!mbmif.int.netways.de-1458726179-1.conf
├── mbmif.int.netways.de!load!mbmif.int.netways.de-1459330771-9.conf
├── myhost!ping4!mbmif.int.netways.de-1458728594-0.conf
├── myhost!ssh!mbmif.int.netways.de-1458736523-0.conf
└── myprinter!ping4!mbmif.int.netways.de-1458222803-0.conf

0 directories, 5 files

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-05-03 09:27:59 +00:00

  • Target Version changed from 2.5.0 to 2.4.8

    [2016-05-03 11:26:15 +0200] notice/ConfigObject: Ignoring config object 'mbmif.int.netways.de-1462267542-2' of type 'Downtime' due to errors: Error: Downtime 'downtime-test-1!downtime-test!mbmif.int.netways.de-1462267542-2' references a host/service which doesn't exist.
    [2016-05-03 11:26:15 +0200] notice/ConfigObject: Ignoring config object 'mbmif.int.netways.de-1462267542-1' of type 'Downtime' due to errors: Error: Downtime 'downtime-test-2!downtime-test!mbmif.int.netways.de-1462267542-1' references a host/service which doesn't exist.
    [2016-05-03 11:26:15 +0200] notice/ConfigObject: Ignoring config object 'mbmif.int.netways.de-1462267542-0' of type 'Downtime' due to errors: Error: Downtime 'downtime-test-0!downtime-test!mbmif.int.netways.de-1462267542-0' references a host/service which doesn't exist.
    [2016-05-03 11:26:15 +0200] notice/ConfigObject: Ignoring config object 'mbmif.int.netways.de-1462267542-4' of type 'Downtime' due to errors: Error: Downtime 'downtime-test-3!downtime-test!mbmif.int.netways.de-1462267542-4' references a host/service which doesn't exist.
    [2016-05-03 11:26:15 +0200] notice/ConfigObject: Ignoring config object 'mbmif.int.netways.de-1462267542-6' of type 'Downtime' due to errors: Error: Downtime 'downtime-test-4!downtime-test!mbmif.int.netways.de-1462267542-6' references a host/service which doesn't exist.
    [2016-05-03 11:26:15 +0200] notice/ConfigObject: Ignoring config object 'mbmif.int.netways.de-1462267542-5' of type 'Downtime' due to errors: Error: Downtime 'downtime-test-5!downtime-test!mbmif.int.netways.de-1462267542-5' references a host/service which doesn't exist.
    [2016-05-03 11:26:15 +0200] notice/ConfigObject: Ignoring config object 'mbmif.int.netways.de-1462267542-3' of type 'Downtime' due to errors: Error: Downtime 'downtime-test-6!downtime-test!mbmif.int.netways.de-1462267542-3' references a host/service which doesn't exist.
    [2016-05-03 11:26:15 +0200] notice/ConfigObject: Ignoring config object 'mbmif.int.netways.de-1462267542-8' of type 'Downtime' due to errors: Error: Downtime 'downtime-test-7!downtime-test!mbmif.int.netways.de-1462267542-8' references a host/service which doesn't exist.
    [2016-05-03 11:26:15 +0200] notice/ConfigObject: Ignoring config object 'mbmif.int.netways.de-1462267542-7' of type 'Downtime' due to errors: Error: Downtime 'downtime-test-8!downtime-test!mbmif.int.netways.de-1462267542-7' references a host/service which doesn't exist.
    [2016-05-03 11:26:15 +0200] notice/ConfigObject: Ignoring config object 'mbmif.int.netways.de-1462267542-9' of type 'Downtime' due to errors: Error: Downtime 'downtime-test-9!downtime-test!mbmif.int.netways.de-1462267542-9' references a host/service which doesn't exist.

    ...

    [2016-05-03 11:26:15 +0200] notice/ConfigItem: Removing ignored item path '/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/downtime-test-1!downtime-test!mbmif.int.netways.de-1462267542-2.conf'.
    [2016-05-03 11:26:15 +0200] notice/ConfigItem: Removing ignored item path '/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/downtime-test-2!downtime-test!mbmif.int.netways.de-1462267542-1.conf'.
    [2016-05-03 11:26:15 +0200] notice/ConfigItem: Removing ignored item path '/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/downtime-test-0!downtime-test!mbmif.int.netways.de-1462267542-0.conf'.
    [2016-05-03 11:26:15 +0200] notice/ConfigItem: Removing ignored item path '/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/downtime-test-3!downtime-test!mbmif.int.netways.de-1462267542-4.conf'.
    [2016-05-03 11:26:15 +0200] notice/ConfigItem: Removing ignored item path '/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/downtime-test-4!downtime-test!mbmif.int.netways.de-1462267542-6.conf'.
    [2016-05-03 11:26:15 +0200] notice/ConfigItem: Removing ignored item path '/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/downtime-test-5!downtime-test!mbmif.int.netways.de-1462267542-5.conf'.
    [2016-05-03 11:26:15 +0200] notice/ConfigItem: Removing ignored item path '/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/downtime-test-6!downtime-test!mbmif.int.netways.de-1462267542-3.conf'.
    [2016-05-03 11:26:15 +0200] notice/ConfigItem: Removing ignored item path '/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/downtime-test-7!downtime-test!mbmif.int.netways.de-1462267542-8.conf'.
    [2016-05-03 11:26:15 +0200] notice/ConfigItem: Removing ignored item path '/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/downtime-test-8!downtime-test!mbmif.int.netways.de-1462267542-7.conf'.
    [2016-05-03 11:26:15 +0200] notice/ConfigItem: Removing ignored item path '/usr/local/icinga2/var/lib/icinga2/api/packages/_api/mbmif.int.netways.de-1442309540-1/conf.d/downtimes/downtime-test-9!downtime-test!mbmif.int.netways.de-1462267542-9.conf'.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-05-03 09:29:53 +00:00

ConfigObjectUtility::GetConfigDir() ensures that only config object fils from the "_api" package (which is used for comments and downtimes as well) are deleted.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2016-05-03 09:35:07 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset 2faf121.

@icinga-migration icinga-migration added blocker Blocks a release or needs immediate attention bug Something isn't working area/configuration DSL, parser, compiler, error handling labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.4.8 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration DSL, parser, compiler, error handling blocker Blocks a release or needs immediate attention bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant