icingaweb2-module-director icon indicating copy to clipboard operation
icingaweb2-module-director copied to clipboard

icingadirector service fails with "DB configuration is not valid"

Open jwilliams-shadowsoft opened this issue 6 years ago • 8 comments

Expected Behavior

icinga-director daemon should run with no errors.

Current Behavior

  • icinga-director runs but produces a status line of "running, db: no configuration"
  • icingacli director daemon run --db-resource director-db produces same error.
  • Adding --debug and --trace gives no additional information.

Possible Solution

It seems that the daemon process cannot find the connection information.

Steps to Reproduce (for bugs)

  • Install Director and kickstart per installation instructions.
  • systemctl start icinga-director
  • Error "DB configuration is not valid" always results.
  • Daemon continues to run but performs no actions.
  • Icinga Web 2 console show daemon as down.

Your Environment

  • Director version (System - About): 1.7.2
  • Icinga Web 2 version and modules (System - About): 2.7.3
    MODULE         VERSION   STATE     DESCRIPTION
    director       1.7.2     enabled   Director - Config tool for Icinga 2
    doc            2.7.3     enabled   Documentation module
    fileshipper    1.1.0     enabled   Fileshipper for Icinga Director
    grafana        1.3.6     enabled   Grafana - A perfdata visualisation module
    incubator      0.5.0     enabled   Incubator provides bleeding-edge libraries
    ipl            v0.4.0    enabled   The Icinga PHP library
    monitoring     2.7.3     enabled   Icinga monitoring module
    puppetdb       1.0.0     enabled   PuppetDB module for Icinga Web 2
    reactbundle    0.7.0     enabled   ReactPHP-based 3rd party libraries
    
  • Icinga 2 version (icinga2 --version): 2.10.5
  • Operating System and version: RHEL 7
  • Webserver, PHP versions: httpd-2.4.6-90.el7.x86_64, rh-php71-php-common-7.1.30-2.el7.x86_64
  • Database: Postgres 12.2

/etc/icingaweb2/resources.ini (partial, redacted)

[director-db]
type      = "db"
db        = "pgsql"
host      = "SEPARATE DB SERVER"
dbname    = "director"
username  = "director"
password  = "REDACTED"
charset   = "utf8"

/etc/icingaweb2/modules/director/config.ini

[db]
resource = "director-db"

jwilliams-shadowsoft avatar Mar 24 '20 22:03 jwilliams-shadowsoft

@jwilliams-shadowsoft: please check whether the user icingadirector is able to read those files

Thomas-Gelf avatar Mar 24 '20 22:03 Thomas-Gelf

Thanks @Thomas-Gelf -- first thing I checked. Also turned off SELinux and behavior was the same.

jwilliams-shadowsoft avatar Mar 27 '20 14:03 jwilliams-shadowsoft

What else can I check @Thomas-Gelf ?

jwilliams-shadowsoft avatar Mar 30 '20 16:03 jwilliams-shadowsoft

not sure if postgres does not need it or applicable, but for mysql there is another flag in the resources.ini

use_ssl = "0" or use_ssl = "1"

the other thought is to force the port value for postgres. port = "5432"

powelleb avatar Mar 30 '20 23:03 powelleb

I bet you had the same issue as me: a special character in the resources.ini file that prevented it from being parsed

drallgood avatar Feb 27 '21 01:02 drallgood

Had the same problem as described. The culprit were indeed "special" chars in resources.ini file.

I have a LDAP resource in my resources.ini, where root_dn, bind_dn contain commas (,) and bind_pw contains an exclamation mark (!). When I put those values in quotes, director service started fine. When any of them were unquoted, director failed with DB configuration is not valid.

Now, I use ansible module ini_file to write my resources.ini and ansible didn't put in quotes. I don't know enough about ini file format to say whether Ansible or icingadirector handles writing/parsing ini files wrong. But all other Icinga web2 components seem to work fine with those values without quotes, so I'd expect Director should as well.

Edit: (forgot to include version info):

  • icinga2 | 2.12.5-1
  • icingaweb2 | 2.9.0

Installed on CentOS 7, from RPM packages.

Loaded Libraries:

  • icinga/icinga-php-library | 0.6.0
  • icinga/icinga-php-thirdparty | 0.10.0

Loaded Modules:

  • cube | 1.1.0
  • director | 1.8.1
  • incubator | 0.6.0
  • monitoring | 2.9.0

matejv avatar Jul 28 '21 09:07 matejv

I just had a recurrence of this on director v1.9.1 and the tip about quoting funny strings in my resources.ini works. So thanks @drallgood !

jwilliams-shadowsoft avatar Jun 21 '22 21:06 jwilliams-shadowsoft

@matejv So do I, I think I can stick some extra quotes in my .j2 template to compensate for this.

Now, I use ansible module [ini_file]

jwilliams-shadowsoft avatar Jun 21 '22 21:06 jwilliams-shadowsoft

I ran into the same problem because my database password contained a "(". After enclosing the password with quotes, the daemon started to run. Afterwards i tried to change the ressource config using the icingaweb UI and suddenly all the config strings were enclosed with quotes.

alamp1360 avatar Dec 13 '22 16:12 alamp1360

I also ran into this problem, we use icinga in docker configured via env vars, those also do not render the quotes into the resources.ini file. In our case LDAP settings where also the cause.

Running icingacli director daemon run outputted the DB configuration is not valid without any indication about what is wrong. The web itself and all our modules (director, icingadb, reporting) all worked without any issue. Also running kickstart and migrations in the same container (from the cli) also worked like expected. Seems like a bug in the daemon.

Adding escaped quotes to the env var helped us. Thanks @matejv, @drallgood!

lukasCoppens avatar Mar 02 '23 16:03 lukasCoppens