Icingaweb2 - external database (rds)

HI All.

I am a long time user of icinga2 and this new setup I am making is causing me some trouble.

We are trying to setup a master node with icinga, icingaweb2 and grafana.

Icinga and Grafana are able to connect to my database.
But when I fill in all the same details in the GUI of icinga web2 I get my first hint of trouble:

Unable to check the server's version. This is usually not a critical error as there is probably only access to the database permitted which does not exist yet. If you are absolutely sure you are running PostgreSQL in a version equal to or newer than 9.1, you can skip the validation and safely proceed to the next step. The error was: SQLSTATE[08006] [7] could not connect to server: Permission denied Is the server running on host "URL" (10.250.10.60) and accepting TCP/IP connections on port 5432?

So I followed all of the setup instructions on the webpages. even configured all the settings in the config files but no succes.

IcingaWeb2 does not want to communicate with the RDS database while icinga is using it with IDO and grafana are happily running on the same machine and using the database. I googled a lot ofcourse but only found items from around 2014,

Perhaps I am missing some setting for icingaweb2 to make it work with a external database?
I have 2 databases icinga and icingaweb2 both with a user name and password and dbadmin role.

icingaweb=> select * from icingaweb_user;
name | active | password_hash |
icingaadmin | 1 | a4d46534e7332366c4b5449304a513171 | |
(1 row)

icingaweb=> \q
root@ # ps -ef | grep apache

apache 24553 25798 0 03:58 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
root 28183 18771 0 04:44 pts/1 00:00:00 grep --color=auto apache
root@# id apache
uid=48(apache) gid=48(apache) groups=48(apache),495(icingacmd),494(icingaweb2)

I am running out of ideas here to try

Hi & welcome to the icinga community,

I’d like to know why are you connecting Grafana to PostgreSQL? This does not make sense in my opinion.

Can your share /etc/icingaweb2/authentication.ini and /etc/icingaweb2/resources.ini? Does icingaweb2 and PostgreSQL run on the same machine?

Hi,

Thanks for the reply,

Well Grafana is a easy way to double check I am not going crazy this way I have 2 connections going from the same machine to the same databases icinga and icingaweb once all is working correctly its time to setup grafana in a propper manner :slight_smile:

our server runs:

  • Icinga
  • Icingaweb2
  • Grafana

Postgress is hosted in RDS in the same zone in AWS

/etc/icingaweb2/authentication.ini

[icingaweb]
backend = “db”
resource = “icingaweb”

/etc/icingaweb2/resources.ini

[icingaweb]
type = “db”
db = “pgsql”
host = “****rds.amazonaws.com
port = “5432”
dbname = “icingaweb”
username = “icinga”
password = “super secret”
charset = “”
use_ssl = “0”

[icinga]
type = “db”
db = “pgsql”
host = “****rds.amazonaws.com
port = “5432”
dbname = “icinga”
username = “icinga”
password = “super secret”
charset = “”
use_ssl = “0”

All these connections work for grafana and icinga, So its hard to see why icingaweb has such a hard time.

Looks goog but you get a Permission denied. The only idea I have is your username or password is wrong (maybe icingaweb instead of icinga).

Yes, that was my first thought.

But after switching the database usernames and passwords multiple times, I did setup grafana psql connector to verify my username and paswords and that just works.

So my user names:

  • icinga
  • icingaweb

With their passwords are correct, and the server has no problem connecting too:

root@ # psql -h ****rds.amazonaws.com -p 5432 -U icinga -d icingaweb -c “\dt”
List of relations
Schema | Name | Type | Owner
--------±---------------------------±------±-------
icinga | icingaweb_group | table | icinga
icinga | icingaweb_group_membership | table | icinga
icinga | icingaweb_user | table | icinga
icinga | icingaweb_user_preference | table | icinga
(4 rows)

Question is how icingaweb2 is trying to connect to the external database trough apache, Is there a database setting that we missed?

I even ran trough the manual way:
https://icinga.com/docs/icingaweb2/latest/doc/20-Advanced-Topics/#automating-the-installation-of-icinga-web-2
But that results in the same… but then in the icingaweb.log file:

2020-05-08T10:29:23+02:00 - ERROR - Connection failed SQLSTATE[08006] [7] could not connect to server: Permission denied
Is the server running on host “****rds.amazonaws.com” (10.250.10.60) and accepting
TCP/IP connections on port 5432?

So,

The problem is resolved, Not the way I want to or how it should be, but it is resolved.

Good old reboot of all things…
The configuration has been successfully validated.

Took only 2 days :frowning:

Any way thanks for the second pair of eyes highly appreciated

1 Like