zensqlmonitor / influxdb-zabbix

Gather data from Zabbix back-end and load to InfluxDB in near real-time for enhanced performance and easier usage with Grafana.
MIT License
71 stars 26 forks source link

unable to parse authentication credentials #2

Closed banzayats closed 7 years ago

banzayats commented 7 years ago

I'm getting the following error:

[dev@test1 influxdb-zabbix]$ ./influxdb-zabbix
2017/03/16 21:50:11 [T] Log Mode: Console(Trace)
2017/03/16 21:50:11 [I] ***** Starting influxdb-zabbix *****
2017/03/16 21:50:11 [T] --- Active tables:
2017/03/16 21:50:11 [T] ------ history with an interval of 60 sec
2017/03/16 21:50:11 [T] ------ history_uint with an interval of 60 sec
2017/03/16 21:50:11 [T] ------ trends with an interval of 60 sec
2017/03/16 21:50:11 [T] ------ trends_uint with an interval of 60 sec
2017/03/16 21:50:11 [T] --- Provider:
2017/03/16 21:50:11 [T] ------ postgresql
2017/03/16 21:50:11 [I] --- Start polling
2017/03/16 21:50:11 [I] <-- Extract | trends_uint         | 14 rows | took 12.235315ms
2017/03/16 21:50:11 [...db-zabbix/log/log.go:299 Error()] [E] Error while loading data: {"error":"unable to parse authentication credentials"}

2017/03/16 21:50:11 [I] <-- Extract | trends              | 36 rows | took 56.467573ms
2017/03/16 21:50:11 [...db-zabbix/log/log.go:299 Error()] [E] Error while loading data: {"error":"unable to parse authentication credentials"}

2017/03/16 21:50:11 [I] <-- Extract | history_uint        | 724 rows | took 75.283635ms
2017/03/16 21:50:11 [...db-zabbix/log/log.go:299 Error()] [E] Error while loading data: {"error":"unable to parse authentication credentials"}

2017/03/16 21:50:11 [I] <-- Extract | history             | 2249 rows | took 139.686878ms
2017/03/16 21:50:11 [...db-zabbix/log/log.go:299 Error()] [E] Error while loading data: {"error":"unable to parse authentication credentials"}

My influxdb-zabbix.conf file:

[influxdb]
  url="http://localhost:8086"
  database="zabbix_pg"

  ## Precision of writes, valid values are n, u, ms, s, m, and h
  precision= "ms"

  ## Connection timeout (in seconds). If not provided, will default to 0 (no timeout)
  # timeout=5

  ## Credentials
  username="influxdb-zabbix"
  password="zabbixmetrics"

###
### Zabbix DB
###
[zabbix]

  [zabbix.postgresql]
  ## PostgreSQL:
  ##   postgres://[user[:password]]@localhost[/dbname]\
  ##       ?sslmode=[disable|verify-ca|verify-full]
  ##   or a simple string:
  ##        host=localhost user=... password=... sslmode=... dbname=zabbix application_name=influxdb-zabbix
  ##
  address="host=localhost user=zabbix password=zabbixpass sslmode=disable database=zabbix application_name=influxdb-zabbix"

What may be wrong?

banzayats commented 7 years ago

I've hardcoded "Authorization" header in file ~/go/src/github.com/zensqlmonitor/influxdb-zabbix/output/influxdb/influxdb.go:

        req.Header.Set("Content-Type", "application/text")           
        req.Header.Add("Authorization", "Basic dGVzdDp0ZXN0X2FkbWlu")

Now authorization works. So I think there is some problem with loa.username

zensqlmonitor commented 7 years ago

Thanks