free / sql_exporter

Database agnostic SQL exporter for Prometheus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error creating exporter: yaml: line 27: found unexpected end of stream

Nyan256 opened this issue · comments

commented

Hello, thanks for developing this code.

I am having trouble running the application, here is the full error message:

[user@server bin]$ ./sql_exporter
I1110 19:29:50.845718   54369 main.go:52] Starting SQL exporter (version=, branch=, revision=) (go=go1.17.2, user=, date=)
I1110 19:29:50.846146   54369 config.go:18] Loading configuration from sql_exporter.yml
F1110 19:29:50.846367   54369 main.go:56] Error creating exporter: yaml: line 27: found unexpected end of stream
goroutine 1 [running]:
github.com/golang/glog.stacks(0x0)
	/home/user/go/pkg/mod/github.com/golang/glog@v1.0.0/glog.go:769 +0x8a
github.com/golang/glog.(*loggingT).output(0xf49580, 0x3, 0xc0003cc460, {0xc55c94, 0xc0001edf00}, 0x1, 0x0)
	/home/user/go/pkg/mod/github.com/golang/glog@v1.0.0/glog.go:720 +0x46e
github.com/golang/glog.(*loggingT).printf(0x9fddaf, 0x1b, {0xa0624b, 0x1b}, {0xc0001edf00, 0x1, 0x1})
	/home/user/go/pkg/mod/github.com/golang/glog@v1.0.0/glog.go:655 +0x110
github.com/golang/glog.Fatalf(...)
	/home/user/go/pkg/mod/github.com/golang/glog@v1.0.0/glog.go:1148
main.main()
	/home/user/go/pkg/mod/github.com/free/sql_exporter@v0.0.0-20191127220300-6f96b0d6b403/cmd/sql_exporter/main.go:56 +0x454

My full sql_exporter.yml is:


# Global defaults.
global:
  # Subtracted from Prometheus' scrape_timeout to give us some headroom and prevent Prometheus from timing out first.
  scrape_timeout_offset: 500ms
  # Minimum interval between collector runs: by default (0s) collectors are executed on every scrape.
  min_interval: 60s
  # Maximum number of open connections to any one target. Metric queries will run concurrently on multiple connections,
  # as will concurrent scrapes.
  max_connections: 3
  # Maximum number of idle connections to any one target. Unless you use very long collection intervals, this should
  # always be the same as max_connections.
  max_idle_connections: 3

# The target to monitor and the collectors to execute on it.
target:
  # Data source name always has a URI schema that matches the driver name. In some cases (e.g. MySQL)
  # the schema gets dropped or replaced to match the driver expected DSN format.
  #data_source_name: 'mysql://username:password@protocol(host:port)/dbname'
  data_source_name: 'mysql://user:password@server:3306/db

  # Collectors (referenced by name) to execute on the target.
  collectors: [db_metrics]

# Collector files specifies a list of globs. One collector definition is read from each matching file.
collector_files:
  - "mysql.collector.yml"

mysql.collector.yml is in the same directory
Am I missing something obvious here? I have gone over the last line in the file again and again and can't find anything that is wrong.

Many thanks

commented

I screwed up with the data_source_name and left off a trailing '.
Furthermore I can't count so was looking at the wrong line! :-D