#Having trouble using influxdb exporter

1 messages · Page 1 of 1 (latest)

junior thistle
#

hi @tender sable what version of Harvest are you using? connection refused means Harvest is not able to connect to influx - let's double check the endpoint

#

is influx accepting http connections?

tender sable
#

Hi @junior thistle
im using harvest-22.08.0

and this is my setup

#

i see this in influxdb logs

ts=2022-09-20T15:07:54.727614Z lvl=info msg=Unauthorized log_id=0d2mVfNG000 error="token required"

#

but is this related to harvest?! not sure.
i specified correct token in harvest.yml

junior thistle
tender sable
#

Exporters:
prometheus:
exporter: Prometheus
local_http_addr: 0.0.0.0
port: 12990
prometheus1:
exporter: Prometheus
port_range: 13000-14000
my-influx:
exporter: InfluxDB
addr: localhost
bucket: harvest
org: harvest
token: mXHXQF2y3wsC3D3ItwC6RH3Wd3xtZCMEqBC_07AoPWELxGl4DBGGnhycOPrxviQcOUVU9JxqalXqn_NTk0RsxQ==

#

its most likely influxdb issue but not able to figure it out!!

junior thistle
#

let's try talking to influxdb outside of harvest - let me dig that up

#

my guess is your influx container is not visible from the host network

#

on the host machine what does this return? curl -I 'http://localhost:8086'

tender sable
#

HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: public, max-age=3600
Content-Length: 515
Content-Type: text/html; charset=utf-8
Etag: "51530175616"
Last-Modified: Thu, 30 Dec 2021 17:56:16 GMT
X-Influxdb-Build: OSS
X-Influxdb-Version: v2.4.0
Date: Tue, 20 Sep 2022 15:25:51 GMT

junior thistle
#

excellent, so your host can talk to your influx container. Now we need to confirm that your harvest container can see it

tender sable
#

okay. how do I do that

junior thistle
#

i'll start docker and check, but the gist is docker exec into your harvest container and then run the same curl from there. If curl is missing (likely) use wget

tender sable
#

okay. let me try that

#

not reachable from inside the container

/opt/harvest # wget 'http://localhost:8086'
Connecting to localhost:8086 (127.0.0.1:8086)
wget: can't connect to remote host (127.0.0.1): Connection refused

junior thistle
#

makes sense - this isn't really a harvest issue but a docker networking issue. How did you setup/start your containers. You'll need to change your influxdb exporter in harvest.yml to use the ip or name that matches your influx container network name

#

by that I mean, the Harvest log message you pasted at the top is Harvest saying that it is unable to push metrics to InfluxDB. That's because that container is unable to see InfluxDB. Maybe the container networking isn't setup? You didn't mention how you started these containers, perhaps that would be helpful to share. You could also check docker inspect each of the containers and confirm the Networks are setup correctly, same gateway, etc. From within the Harvest docker container what if you try to ping the influxdb container by name?

tender sable
#

ping influxdb works

#

this is how i setup:
started influxdb container usiong docker-compose

docker-compose -f influx.yml up -d

#

then i started harvest container

docker-compose -f harvest-compose.yml up -d

#

harvest-compose.yml

#

ran this to generate docker-compose.yml

bin/harvest generate docker full --port --output harvest-compose.yml

junior thistle
#

thanks! your harvest-compose.yml output is missing the network section. Did you remove it by hand or not copied?

tender sable
#

i removed it. i think it was set to 'backend'

#

if i tried to run docker-compose up. it was throwing error

junior thistle
#

yes it is - and that networks section matches a similar section in the included prom-stack.yml file. We can make it work either way, but since you're having docker network issues wanted to confirm. What if you edit your harvest.yml and change the influxdb addr to influxdb since that's the alias inside the container?

tender sable
#

let me try that.
should i set network to "backend" in influxdb and start the container?

#

just to be sure

junior thistle
#

you can leave it out for now - try changing localhost to influxdb in your harvest.yml and bounce the harvest container

tender sable
#

influxdb worked. can see the metrics now

#

no errors in logs

#

thanks a lot @junior thistle