Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG/DOCUMENTATION] TROUBLESHOOTING_INFLUXDB doc #741

Open
Dinth opened this issue Jan 15, 2025 · 4 comments
Open

[BUG/DOCUMENTATION] TROUBLESHOOTING_INFLUXDB doc #741

Dinth opened this issue Jan 15, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@Dinth
Copy link

Dinth commented Jan 15, 2025

Describe the bug
Hi. Im trying to set up the docker version (web/collector) of Scrutiny with an existing InfluxDB instance running on a different host. It seems that the env variables mentioned in the documentation (https://github.com/AnalogJ/scrutiny/blob/master/docs/TROUBLESHOOTING_INFLUXDB.md) are not correct. Particularly after setting up INFLUXDB_HOSTNAME to external host, Scrutiny is still looking for InfluxDB on localhost.

Expected behavior
After setting up the variables INFLUXDB_ADMIN_TOKEN, INFLUXDB_ORG_ID, INFLUXDB_HOSTNAME, Scrutiny should connect to the database and set it up using admin token.

Screenshots
image

Log Files

 ___   ___  ____  __  __  ____  ____  _  _  _  _

/ __) / __)(  _ \(  )(  )(_  _)(_  _)( \( )( \/ )

\__ \( (__  )   / )(__)(   )(   _)(_  )  (  \  /

(___/ \___)(_)\_)(______) (__) (____)(_)\_) (__)

github.com/AnalogJ/scrutiny                             dev-0.8.1

Start the scrutiny server

time="2025-01-15T08:49:12Z" level=info msg="Trying to connect to scrutiny sqlite db: /opt/scrutiny/config/scrutiny.db\n" type=web

time="2025-01-15T08:49:12Z" level=info msg="Successfully connected to scrutiny sqlite db: /opt/scrutiny/config/scrutiny.db\n" type=web

time="2025-01-15T08:49:12Z" level=info msg="InfluxDB certificate verification: true\n" type=web

panic: failed to check influxdb setup status - Get "http://localhost:8086/api/v2/setup": dial tcp [::1]:8086: connect: connection refused

goroutine 1 [running]:

github.com/analogj/scrutiny/webapp/backend/pkg/web/middleware.RepositoryMiddleware({0x11d4088?, 0xc0001a2d80?}, {0x11d8790?, 0xc0004c18f0?})

	/go/src/github.com/analogj/scrutiny/webapp/backend/pkg/web/middleware/repository.go:15 +0xd6

github.com/analogj/scrutiny/webapp/backend/pkg/web.(*AppEngine).Setup(0xc00019d2f0, 0x1045936?)

	/go/src/github.com/analogj/scrutiny/webapp/backend/pkg/web/server.go:26 +0xa5

github.com/analogj/scrutiny/webapp/backend/pkg/web.(*AppEngine).Start(0xc00019d2f0)

	/go/src/github.com/analogj/scrutiny/webapp/backend/pkg/web/server.go:82 +0x12c

main.main.func2(0xc0003c7f40)

	/go/src/github.com/analogj/scrutiny/webapp/backend/cmd/scrutiny/scrutiny.go:133 +0x39c

github.com/urfave/cli/v2.(*Command).Run(0xc0002e8fc0, 0xc0003c7dc0)

	/go/src/github.com/analogj/scrutiny/vendor/github.com/urfave/cli/v2/command.go:164 +0x5c8

github.com/urfave/cli/v2.(*App).RunContext(0xc0003f2480, {0x11cb4a8?, 0xc0001a8020}, {0xc0001a6000, 0x2, 0x2})

	/go/src/github.com/analogj/scrutiny/vendor/github.com/urfave/cli/v2/app.go:306 +0xbac

github.com/urfave/cli/v2.(*App).Run(...)

	/go/src/github.com/analogj/scrutiny/vendor/github.com/urfave/cli/v2/app.go:215

main.main()

	/go/src/github.com/analogj/scrutiny/webapp/backend/cmd/scrutiny/scrutiny.go:158 +0x774


The log files will be available on your host in the config directory. Please attach them to this issue.

Please also provide the output of docker info

@Dinth Dinth added the bug Something isn't working label Jan 15, 2025
@AnalogJ
Copy link
Owner

AnalogJ commented Jan 15, 2025

Good catch, those env variables should be prefixed with SCRUTINY_ (eg. SCRUTINY_INFLUXDB_ADMIN_TOKEN)

@Dinth
Copy link
Author

Dinth commented Jan 15, 2025

Hmmm, unfortunately SCRUTINY_INFLUXDB_HOSTNAME doesnt seem to work either - its still trying to connect to db at localhost. I can see a different behaviour if i use SCRUTINY_WEB_INFLUXDB_HOST, but it still doesnt work - for some reason if i put the influxdb server IP address in SCRUTINY_WEB_INFLUXDB_HOST, then its trying to connect to database at my DNS server IP (different one) and port

@Dinth
Copy link
Author

Dinth commented Jan 15, 2025

Ok i think i have it:

c.SetDefault("web.influxdb.scheme", "http")
	c.SetDefault("web.influxdb.host", "localhost")
	c.SetDefault("web.influxdb.port", "8086")
	c.SetDefault("web.influxdb.org", "scrutiny")
	c.SetDefault("web.influxdb.bucket", "metrics")
(...)
	//configure env variable parsing.
	c.SetEnvPrefix("SCRUTINY")
	c.SetEnvKeyReplacer(strings.NewReplacer("-", "_", ".", "_"))
	c.AutomaticEnv()

So it should be SCRUTINY_WEB_INFLUXDB_HOST, but unlike the documentation just IP number without the schema and port?

[edit]
OK, this seems to work:
SCRUTINY_WEB_INFLUXDB_HOST=10.10.1.11
SCRUTINY_WEB_INFLUXDB_ORG=scrutiny <- org name not id
SCRUTINY_WEB_INFLUXDB_PORT=8086
SCRUTINY_WEB_INFLUXDB_TOKEN= <- just token without admin_ bit

does it look correct for you? im not sure if Scrutiny has done that automatic setup though - it didnt want to connect until i create the org and bucket.

@Dinth Dinth changed the title [BUG/DOCUMENTATION] [BUG/DOCUMENTATION] TROUBLESHOOTING_INFLUXDB doc Jan 15, 2025
@AnalogJ
Copy link
Owner

AnalogJ commented Jan 15, 2025

ah, sorry we must have nested the influx configuration under the web key in the config. Yes, SCRUTINY_WEB_INFLUXDB_HOST looks correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants