1
votes

Is there a simple test to make sure I have proper influxdb communication?

My configuration looks like this

influxHost = influxhost:8086
smtpHost = mail:25
emailFrom = [email protected]


template cpu {
    body = `Alert definition:
        Name: {{.Alert.Name}}
Crit: {{.Alert.Crit}}

Tags:{{range $k, $v := .Tags}}
     {{$k}}: {{$v}}{{end}}
     `
         subject = cpu idle at {{.Alert.Vars.q | .E}} on {{.Tags.host}}
}



notification default {
    email = [email protected]
        next = default
        timeout = 1h
}

On the bosun expression evulator I am doing

influx("db",'''SELECT mean(usage_idle) FROM "cpu"  group by host''',"10m","","2m")

I keep getting

influx: did not get a valid result from InfluxDB
1

1 Answers

2
votes

Make sure you have the correct influx database and that there is data in the specified time range. I usually try from the admin site first:

influxdb admin site

Then insert the query into the influx(...) expression

bosun influx expression

Bosun will add the time conditions to the WHERE and GROUP BY clauses as needed, so the full influxql generated should be something like:

SELECT mean(usage_idle) FROM cpu WHERE time >= '2016-12-07 20:00:00' AND time <= '2016-12-07 20:10:00' GROUP BY host,time(2m)

If it still doesn't work try SELECT * FROM cpu on the admin page to see what data is in the table (telegraf has gone thru a few changes). Also note in the recent versions you probably want to add cpu = 'cpu-total' to the WHERE clause to get the overall average.