Odd issue with icingacli

Hi folks,

I have a slight misconnfiguration on my system which I hope to fix with your help :wink: Thing is, my icinga2, icingaweb2 and icinga director do work as intended.
What doesn’t work is the icingacli as ist apparently has problems to use the database configured in the resources.ini:

root@icinga-master-01:/usr/share/icingaweb2# icingacli director health
Icinga Director: there are problems

Director configuration: 0 tests OK, 1x CRITICAL
[CRITICAL] No database resource has been specified
root@icinga-master-01:/usr/share/icingaweb2#

But:


grafik
resources.ini looks as follows:

How can I fix my icingacli-configuration?

Please check our /etc/icingaweb2/config.ini it should have at least:

[global]
...
config_backend = "db"
config_resource = "icingaweb_db"
...

ok, here is my config.ini:

root@icinga-master-01:/usr/share/icingaweb2# cat config.ini
[global]
show_stacktraces = "1"
show_application_state_messages = "1"
config_backend = "db"
config_resource = "icingaweb_db"
module_path = "/usr/share/icingaweb2/modules"

[logging]
log = "file"
level = "DEBUG"
file = "/var/log/icingaweb2/icingaweb2.log"

[themes]
disabled = "1"

[authentication]
root@icinga-master-01:/usr/share/icingaweb2#

I solved it by doing this:

root@icinga-master-01:~# mv /etc/icingaweb2 /etc/icingaweb2.save
root@icinga-master-01:~# ln -s /usr/share/icingaweb2 /etc/icingaweb2
root@icinga-master-01:~# icingacli director health
Icinga Director: everything is fine

Director configuration: 3 tests OK
[OK] Database resource 'director_db' has been specified
[OK] Make sure the DB schema exists
[OK] There are no pending schema migrations

Director Deployments: 3 tests OK
[OK] Deployment endpoint is 'icinga-master-01'
[OK] There are 0 un-deployed changes
[OK] The last Deployment was successful 50m 15s ago

Import Sources: 1 tests OK
[OK] 'Host From CSV' is in sync

Sync Rules: 1 tests OK
[OK] 'Import Host' is in sync

Director Jobs: 1 tests OK
[OK] No Jobs have been defined
root@icinga-master-01:~#

Thats not a solution to your Problem, this will lead to many other things not working.

we’ll see. So far things look quite good to me and everything I need is working fine. I don’t doubt, that this smells heavily like a “quick’n dirty” kind of a fix. Given this solution my assumption is I would have to redeploy my whole system and do a clean install from scratch which simply isn’t an option right now.

You need to read the docs, there are all steps in you need to do. But to help you we need more information like which OS, how did you install (from Icinga Repositories?) and if the icinga user was added to the icingaweb group. Looks like icingacli could not read the needed information.

Here is how my directories look like (CentOS7 installed from Icinga repo)

[root@master-icinga-p1 ~]# ls -la /etc/icingaweb2/
total 48
drwxrws---.  5 root   icingaweb2  4096 Jul 30 13:48 .
drwxr-xr-x. 97 root   root       12288 Aug  8 10:27 ..
-rw-rw----   1 apache icingaweb2   188 May 22 15:44 authentication.ini
-rw-rw----   1 apache icingaweb2   343 Jul 29 10:59 config.ini
drwxrws---   3 apache icingaweb2  4096 Jun 28 12:02 dashboards
drwxrws---.  2 root   icingaweb2  4096 Aug  2 11:29 enabledModules
-rw-rw----   1 apache icingaweb2   206 May 22 15:45 groups.ini
drwxrws---. 11 root   icingaweb2  4096 Aug  2 11:03 modules
-rw-rw----   1 apache icingaweb2  1134 May 22 16:28 resources.ini
-rw-rw----   1 apache icingaweb2   139 Jun 13 14:55 roles.ini
[root@master-icinga-p1 ~]# ls -la /usr/share/icingaweb2/
total 28
drwxr-xr-x.   7 root root 4096 Jul 30 13:48 .
drwxr-xr-x. 114 root root 4096 Jul  9 08:33 ..
drwxr-xr-x.   9 root root 4096 Aug  2 08:05 application
drwxr-xr-x.   4 root root 4096 Aug  2 08:05 doc
drwxr-xr-x.   3 root root 4096 Jul 30 13:48 library
drwxr-xr-x.  22 root root 4096 Aug  2 11:29 modules
drwxr-xr-x.   6 root root 4096 Aug  2 08:05 public
1 Like

That’s exposing a security risk and as @Carsten said, will lead into unknown problems. You’re alone in case of questions.

Better solve the original issue.

Please show the output of which icingacli to start with, followed by the versions of OS, PHP, Icinga Web 2 and Director.

Cheers,
Michael

1 Like

Thanks - conceirneing the security aspect is right but be sure that this machines are very well firewalled inside the internal network, as well as they don’t have a direct connection to the internet, besides several other security-settings…here you go for the information requested:

root@icinga-master-01:~# ls -la $(which icingacli) ; icingacli version ; uname -a ; php -version
-rwxr-xr-x 1 root icingaweb2 218 Jul 30 10:49 /usr/bin/icingacli
Icinga Web 2  2.7.0
Git Commit    861c5601b6e01402a932687d7b59a037c72a6804
PHP Version   7.0.33-0+deb9u3
MODULE           VERSION
businessprocess  2.2.0
cube             1.1.0
director         1.6.2
doc              2.7.0
fileshipper      1.1.0
grafana          1.3.5
ipl              v0.3.0
map              1.1.0
monitoring       2.7.0
Linux icinga-master-01 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u4 (2019-07-19) x86_64 GNU/Linux
PHP 7.0.33-0+deb9u3 (cli) (built: Mar  8 2019 10:01:24) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.33-0+deb9u3, Copyright (c) 1999-2017, by Zend Technologies
root@icinga-master-01:~#