icingadb role: icingadb service errors out
Closed this issue · 8 comments
I am testing the roles on openSUSE/Suse using the code from the various pull requests I opened for the different roles.
I have two errors left, one of them is Icingadb not starting. Not sure if this is an error in my installation, caused by something missing or misconfigured during my adaption. Or if there is something else going on?
Thanks in advance!
Johannes
These are the variables for the icingadb role:
icingadb_redis_password: 'redacted'
# database
icingadb_database_type: 'pgsql'
icingadb_database_host: '127.0.0.1'
icingadb_database_name: 'icingadb'
icingadb_database_user: 'icinga2'
icingadb_database_password: 'redacted'
icingadb_database_import_schema: true
The actual error is:
Dec 08 06:42:23 icinga2-server systemd[1]: Starting Icinga DB...
Dec 08 06:42:23 icinga2-server icingadb[24727]: Starting Icinga DB
Dec 08 06:42:23 icinga2-server icingadb[24727]: Connecting to database at '127.0.0.1:0'
Dec 08 06:42:23 icinga2-server systemd[1]: Started Icinga DB.
Dec 08 06:42:23 icinga2-server icingadb[24727]: Connecting to Redis at '127.0.0.1:6380'
Dec 08 06:42:23 icinga2-server icingadb[24727]: Starting history sync
Dec 08 06:42:23 icinga2-server icingadb[24727]: pq: relation "history" does not exist
can't perform "INSERT INTO \"history\" (\"host_id\", \"event_time\", \"environment_id\", \"object_type\", \"service_id\", \"event_type\", \">
github.com/icinga/icingadb/internal.CantPerformQuery
github.com/icinga/icingadb/internal/internal.go:30
github.com/icinga/icingadb/pkg/icingadb.(*DB).NamedBulkExec.func1.1.1.1
github.com/icinga/icingadb/pkg/icingadb/db.go:391
github.com/icinga/icingadb/pkg/retry.WithBackoff
github.com/icinga/icingadb/pkg/retry/retry.go:49
github.com/icinga/icingadb/pkg/icingadb.(*DB).NamedBulkExec.func1.1.1
github.com/icinga/icingadb/pkg/icingadb/db.go:386
golang.org/x/sync/errgroup.(*Group).Go.func1
golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75
runtime.goexit
runtime/asm_amd64.s:1598
can't retry
github.com/icinga/icingadb/pkg/retry.WithBackoff
github.com/icinga/icingadb/pkg/retry/retry.go:68
github.com/icinga/icingadb/pkg/icingadb.(*DB).NamedBulkExec.func1.1.1
github.com/icinga/icingadb/pkg/icingadb/db.go:386
golang.org/x/sync/errgroup.(*Group).Go.func1
golang.org/x/sync@v0.3.0/errgroup/errgroup.go:75
runtime.goexit
runtime/asm_amd64.s:1598
Dec 08 06:42:23 icinga2-server systemd[1]: icingadb.service: Main process exited, code=exited, status=1/FAILURE
Dec 08 06:42:23 icinga2-server systemd[1]: icingadb.service: Failed with result 'exit-code'.
Can you check if the schema import was successfully made, it seems that the schema doesn't exist.
Can you check if the schema import was successfully made, it seems that the schema doesn't exist.
Sorry for the late reply. How can I check that? How can I import the schema, in case it does not exist?
To check if the schema was correctly imported, you can connect to the icingadb
database and there should already exist some tables. To import the schema manually, you can use this command psql -U icingadb icingadb < /usr/share/icingadb/schema/pgsql/schema.sql
Hmmm. I see lots of tables:
icingadb=> \dt
public | checkcommand_customvar | table | icinga2
public | checkcommand_envvar | table | icinga2
public | environment | table | icinga2
public | eventcommand_customvar | table | icinga2
public | eventcommand_envvar | table | icinga2
public | flapping_history | table | icinga2
public | host_customvar | table | icinga2
public | host_state | table | icinga2
public | hostgroup_customvar | table | icinga2
public | hostgroup_member | table | icinga2
public | icingadb_instance | table | icinga2
public | icingadb_schema | table | icinga2
public | notification_customvar | table | icinga2
public | notification_history | table | icinga2
public | notification_recipient | table | icinga2
public | notification_user | table | icinga2
public | notification_usergroup | table | icinga2
public | notificationcommand_customvar | table | icinga2
public | notificationcommand_envvar | table | icinga2
public | service_customvar | table | icinga2
public | service_state | table | icinga2
public | servicegroup_customvar | table | icinga2
public | servicegroup_member | table | icinga2
public | sla_history_downtime | table | icinga2
public | sla_history_state | table | icinga2
public | state_history | table | icinga2
public | timeperiod_customvar | table | icinga2
public | timeperiod_override_exclude | table | icinga2
public | timeperiod_override_include | table | icinga2
public | user_customvar | table | icinga2
public | user_notification_history | table | icinga2
public | usergroup_customvar | table | icinga2
public | usergroup_member | table | icinga2
When I try to import the schema again, I get lots of "already exists" errors. There are no additional tables after that.
It looks like this is rather a problem with the package? Should I report this elsewhere?
icingadb package is version 1.1.1-1
$ zypper se -s icingadb
Loading repository data...
Reading installed packages...
S | Name | Type | Version | Arch | Repository
---+----------------------+------------+----------+--------+-------------------------------------
i+ | icingadb | package | 1.1.1-1 | x86_64 | ICINGA (stable release for openSUSE)
| icingadb | srcpackage | 1.1.1-1 | noarch | ICINGA (stable release for openSUSE)
i+ | icingadb-redis | package | 7.0.12-1 | x86_64 | ICINGA (stable release for openSUSE)
| icingadb-redis | srcpackage | 7.0.12-1 | noarch | ICINGA (stable release for openSUSE)
| icingadb-redis-devel | package | 7.0.12-1 | x86_64 | ICINGA (stable release for openSUSE)
i+ | icingadb-web | package | 1.1.1-1 | noarch | ICINGA (stable release for openSUSE)
v | icingadb-web | package | 1.1.0-1 | noarch | ICINGA (stable release for openSUSE)
| icingadb-web | srcpackage | 1.1.1-1 | noarch | ICINGA (stable release for openSUSE)
| icingadb-web | srcpackage | 1.1.0-1 | noarch | ICINGA (stable release for openSUSE)
This definitely sounds like problems with v1.1.1, seeing as the history
table got changed there:
https://icinga.com/docs/icinga-db/latest/doc/04-Upgrading/#upgrading-to-icinga-db-v111
Could you drop the database and test installing via Ansible again?
This is a fresh deployment in an ephemeral vagrant-libvirt setup, just for testing the roles and adapting them to SUSE/openSUSE, see the various pull requests adding support for SUSE/openSUSE.
So there is no old content in the database, everything is created fresh by Ansible...
Okay, I just installed icingadb-1.1.1-1
from scratch on openSUSE LEAP 15.5 and it worked:
- after only inserting
/usr/share/icingadb/schema/pgsql/schema.sql
- after additionally inserting
/usr/share/icingadb/schema/pgsql/upgrades/1.1.1.sql
Judging from this there's probably something wrong with the way you bootstrap the database, or different on SUSE compared to other distros.
If you can point me at the PR containing the part of the role adjustments who are likely to cause this misbehaviour, I can have a look over the next couple of days.
Hi, I did use the collection on SLES 15 the other day, had no problems with importing schemas to the db. I would like to close the issue cause it's not caused by the collection. And there's no response.