Griesbacher / nagflux

A connector which copies performancedata from Nagios / Icinga(2) / Naemon to InfluxDB
GNU General Public License v2.0
66 stars 32 forks source link

Nagflux doesn't work with influxDB/https and auto-signed certificat #12

Closed jframeau closed 8 years ago

jframeau commented 8 years ago

Hi,

config:

From github, nagflux can't connect to influxdb as go http client denies access to such https connector.

I managed to add a bit of code to skip certicate check:

--- a/target/influx/Connector.go +++ b/target/influx/Connector.go @@ -1,6 +1,7 @@ package influx

import (

After that, nagflux connection went well, but nagflux failed to create the database:

2016-08-23 12:15:55 Info: good 2016-08-23 12:15:55 Info: Influxdb running 2016-08-23 12:16:05 Panic: Database does not exists and was not able to created panic: Database does not exists and was not able to created

Any idea to get https working ?

jfr

Griesbacher commented 8 years ago

I'll have a look at it, but I'm pretty sure that self signed certificates won't work at the moment.

Griesbacher commented 8 years ago

I didn't use that http.Client properly... There is a fix, so if you build it on your own, you could test it. Let me know if there are any further problems.

jframeau commented 8 years ago

Ok, thx, nagflux works nicely with influxdb/https autosigned certificate now.

Just a little trouble when influxdb is not started:

        if !s.isAlive {
                s.log.Info("Waiting for InfluxDB server")
        }

        for i := 0; i < 12 && !s.isAlive; i++ {
                s.TestIfIsAlive()
-               time.Sleep(5)
+               time.Sleep(time.Duration(5) * time.Second)
                s.log.Info(".")
        }
jframeau commented 8 years ago

Also, out of curiosity, is there a point to not use official Influxdb go client library : https://github.com/influxdata/influxdb/tree/master/client ?

Griesbacher commented 8 years ago

Thanks for the bug fix! The Influxdb client library was still under development when I started and it changed a lot of times, so I decided to do it on my own, due to the fact there was no vendor option in go this can be very annoying.

blakec-som commented 3 years ago

@jframeau wondering if you can share your Connector.go file? I'm having this exact issue and can't quite figure out what changes to make.