Icinga / chef-icinga2

Icinga 2 Chef Cookbook
https://supermarket.chef.io/cookbooks/icinga2
Apache License 2.0
41 stars 55 forks source link

[dev.icinga.com #11463] LWRP idomysqlconnection object conflicts with existing /etc/icinga2/features-enabled/ido-mysql.conf #198

Closed icinga-migration closed 7 years ago

icinga-migration commented 8 years ago

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

Created by peter_m on 2016-03-28 19:26:40 +00:00

Assignee: vkhatri Status: Assigned Target Version: (none) Last Update: 2016-04-17 07:45:22 +00:00 (in Redmine)


Ubuntu 14.04 using the latest commit of the chef-icinga2 cookbook.

I am using the LWRP icinga2_idomysqlconnection to create /etc/icinga2/objects.d/ido-mysql.conf. The icinga2 service fails to start and I get the following error:

critical/config: Error: Object 'ido-mysql' of type 'IdoMysqlConnection' re-defined: in /etc/icinga2/objects.d/ido-mysql.conf: 12:1-12:37; previous definition: in /etc/icinga2/features-enabled/ido-mysql.conf: 12:1-12:37

/var/log/icinga2/startup.log

information/Utility: Loading library 'libdb_ido_mysql.so'
critical/config: Error: Object 'ido-mysql' of type 'IdoMysqlConnection' re-defined: in /etc/icinga2/objects.d/ido-mysql.conf: 12:1-12:37; previous definition: in /etc/icinga2/features-enabled/ido-mysql.conf: 12:1-12:37
Location: in /etc/icinga2/objects.d/ido-mysql.conf: 12:1-12:37
/etc/icinga2/objects.d/ido-mysql.conf(10): library "db_ido_mysql"
/etc/icinga2/objects.d/ido-mysql.conf(11):
/etc/icinga2/objects.d/ido-mysql.conf(12): object IdoMysqlConnection "ido-mysql" {
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/etc/icinga2/objects.d/ido-mysql.conf(13):   host = "localhost"
/etc/icinga2/objects.d/ido-mysql.conf(14):   port = 3306

Am I supposed to manually delete the symbolic link in /etc/icinga2/features-enabled/ido-mysql.conf?

MY WRAPPER COOKBOOK:

Berksfile

cookbook 'icinga2', git: 'https://github.com/Icinga/chef-icinga2.git', ref: 'e5c8e6e7bf1e15166446ec2d98f99f75afa6b360'

metadata.rb

depends 'icinga2', '~> 2.7.0'

attributes/default.rb

default['icinga2']['version'] = '2.4.4-1'
default['icinga2']['web2']['enable'] = true
default['icinga2']['web2']['version'] = 'v2.2.0'
default['icinga2']['ido']['type'] = 'mysql'
default['icinga2']['ido']['load_schema'] = true
default['icinga2']['ido']['db_host'] = 'localhost'
default['icinga2']['ido']['db_name'] = 'icinga'
default['icinga2']['ido']['db_user'] = 'icinga'
default['icinga2']['ido']['db_password'] = 'Ch4ng3me2'

recipes/install.rb

include_recipe 'icinga2::server'

icinga2_idomysqlconnection 'ido-mysql' do
  library 'db_ido_mysql'
  host "localhost"
  port 3306
  user "#{node.icinga2.ido.db_user}"
  password "#{node.icinga2.ido.db_password}"
  database "#{node.icinga2.ido.db_name}"
  instance_name "#{node.tticinga2.sql.instance_name}"
end

The load_schema works so if I manually delete the symbolic link in /etc/icinga2/features-enabled/ido-mysql.conf, the service starts successfully.

/var/log/icinga2/startup.log

...
information/ConfigCompiler: Compiling config file: /etc/icinga2/conf.d/users.conf
information/ConfigCompiler: Compiling config file: /etc/icinga2/objects.d/ido-mysql.conf
information/Utility: Loading library 'libdb_ido_mysql.so'
information/ConfigCompiler: Compiling config file: /var/lib/icinga2/api/packages/_api/include.conf
information/ConfigCompiler: Compiling config file: /var/lib/icinga2/api/packages/_api/3tw-icinga2-berkshelf-1459185828-1/include.conf
information/ConfigCompiler: Compiling config file: /var/lib/icinga2/api/packages/_api/3tw-icinga2-berkshelf-1459185828-1/../active.conf
information/ConfigCompiler: Compiling config file: /var/lib/icinga2/api/packages/_api/3tw-icinga2-berkshelf-1459185828-1/conf.d/downtimes/3tw-icinga2-berkshelf!load!3tw-icinga2-berkshelf-1459185828-0.conf
information/ConfigItem: Committing config items
....

/var/log/icinga2/icinga2.log

[2016-03-28 19:08:55 +0000] information/ConfigItem: Activated all objects.
[2016-03-28 19:08:55 +0000] information/ConfigCompiler: Compiling config file: /var/lib/icinga2/modified-attributes.conf
[2016-03-28 19:08:55 +0000] information/IdoMysqlConnection: MySQL IDO instance id: 2 (schema version: '1.14.0')
[2016-03-28 19:08:55 +0000] information/IdoMysqlConnection: Finished reconnecting to MySQL IDO database in 0.11636 second(s).
[2016-03-28 19:09:10 +0000] information/IdoMysqlConnection: Query queue items: 0, query rate: 20.1/s (1206/min 1206/5min 1206/15min);
[2016-03-28 19:09:25 +0000] information/IdoMysqlConnection: Query queue items: 0, query rate: 20.8167/s (1249/min 1249/5min 1249/15min);
[2016-03-28 19:09:40 +0000] information/IdoMysqlConnection: Query queue items: 0, query rate: 21.55/s (1293/min 1293/5min 1293/15min);
[2016-03-28 19:09:55 +0000] information/IdoMysqlConnection: Query queue items: 1, query rate: 2.8/s (168/min 1336/5min 1336/15min);
[2016-03-28 19:10:10 +0000] information/IdoMysqlConnection: Query queue items: 0, query rate: 2.91667/s (175/min 1381/5min 1381/15min);
[2016-03-28 19:10:25 +0000] information/IdoMysqlConnection: Query queue items: 1, query rate: 2.88333/s (173/min 1422/5min 1422/15min);
[2016-03-28 19:10:40 +0000] information/IdoMysqlConnection: Query queue items: 0, query rate: 2.91667/s (175/min 1468/5min 1468/15min);

Thanks!

Peter

icinga-migration commented 8 years ago

Updated by peter_m on 2016-03-28 19:47:15 +00:00

I just realized that by removing the symbolic link in /etc/icinga2/features-enabled/ido-mysql.conf isn't an option because then icinga2 thinks the feature isn't enabled.

root@host# icinga2 feature list
Disabled features: api gelf graphite icingastatus ido-mysql livestatus opentsdb perfdata syslog
Enabled features: checker command compatlog debuglog mainlog notification statusdata

Should I just manually modify /etc/icinga2/features-available/ido-mysql.conf?

icinga-migration commented 8 years ago

Updated by vkhatri on 2016-04-17 07:45:22 +00:00

vkhatri commented 7 years ago

Feature ido-mysql disabled in recipe server_ido_schema. Closing.

ghost commented 5 years ago

This is still a problem for us. I simply added a line to empty the contents of the ido-mysql.conf file in /etc/icinga2/features-enabled/ido-mysql.conf