Hello,
I am attempting to connect grafana to a zabbix datasource that uses postgres as the database.
My grafana server is failing to start with the following error:
> t=2018-08-15T11:32:57-0500 lvl=info msg="Initializing DB" logger=sqlstore dbtype=postgres
> t=2018-08-15T11:32:57-0500 lvl=info msg="Starting DB migration" logger=migrator
> t=2018-08-15T11:32:57-0500 lvl=info msg="Executing migration" logger=migrator id="copy data account to org"
> t=2018-08-15T11:32:57-0500 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account to org"
> t=2018-08-15T11:32:57-0500 lvl=info msg="Executing migration" logger=migrator id="copy data account_user to org_user"
> t=2018-08-15T11:32:57-0500 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account_user to org_user"
> t=2018-08-15T11:32:57-0500 lvl=info msg="Executing migration" logger=migrator id="add index dashboard.account_id"
> t=2018-08-15T11:32:57-0500 lvl=eror msg="Executing migration failed" logger=migrator id="add index dashboard.account_id" error="pq: column \"account_id\" does not exist"
> t=2018-08-15T11:32:57-0500 lvl=eror msg="Exec failed" logger=migrator error="pq: column \"account_id\" does not exist" sql="CREATE INDEX \"IDX_dashboard_account_id\" ON \"dashboard\" (\"account_id\");"
> t=2018-08-15T11:32:57-0500 lvl=eror msg="Fail to initialize orm engine" logger=sqlstore error="Sqlstore::Migration failed err: pq: column \"account_id\" does not exist\n"
The zabbix piece is working fine, and collecting data. However, Grafana is not starting. It seems that the server process is trying to do a migration right away. It complains about some columns on the dashboard table not existing, which is accurate. Here is a description of the dashboard table referenced above which confirms the account_id column does not exist. All this data is created by the sql file provided by zabbix that is part of their setup process.
zabbix=# \d dashboard
Table "public.dashboard"
Column | Type | Modifiers
-------------+------------------------+--------------------
dashboardid | bigint | not null
name | character varying(255) | not null
userid | bigint | not null
private | integer | not null default 1
Indexes:
"dashboard_pkey" PRIMARY KEY, btree (dashboardid)
Foreign-key constraints:
"c_dashboard_1" FOREIGN KEY (userid) REFERENCES users(userid)
Referenced by:
TABLE "dashboard_user" CONSTRAINT "c_dashboard_user_1" FOREIGN KEY (dashboardid) REFERENCES dashboard(dashboardid) ON DELETE CASCADE
TABLE "dashboard_usrgrp" CONSTRAINT "c_dashboard_usrgrp_1" FOREIGN KEY (dashboardid) REFERENCES dashboard(dashboardid) ON DELETE CASCADE
TABLE "widget" CONSTRAINT "c_widget_1" FOREIGN KEY (dashboardid) REFERENCES dashboard(dashboardid) ON DELETE CASCADE
Is there some intermediary piece I need to do to get Grafana ready to read from my Zabbix/postgres database?
Here is my grafana.ini for reference:
[> root@reportserver]# cat /etc/grafana/grafana.ini
# This file is managed by Puppet, any changes will be overwritten
[database]
host = localhost
name = zabbix
password = redacted
type = postgres
user = zabbix[server]
cert_file = /etc/grafana/certificate.pem
cert_key = /etc/grafana/key.pem
domain = redacted
http_port = 3000
protocol = https
root_url = %(protocol)s://%(domain)s:%(http_port)s/