Hey folks, Im having some troubles with an influxdb query with kapacitor.
First off, heres the tick script I have:
var requests = batch
|query('''
SELECT sum("value")
FROM "apache_logs"."default".app_apache_status
WHERE "http_status" != '500'
''')
.period(20s)
.every(20s)
.align()
.fill(0.0)
var requestErrors = batch
|query('''
SELECT sum("value")
FROM "apache_logs"."default".app_apache_status
WHERE "http_status" = '500'
''')
.period(20s)
.every(20s)
.align()
.fill(0.0)
requests
|join(requestErrors)
.as('requests', 'requestErrors')
.tolerance(20s)
|log()
.level('DEBUG')
|alert()
.crit(lambda: "sum" > 0)
.log('/tmp/kapacitor-app_apache_status-http_requests')
.hipChat()
The fields in my measurement "app_apache_status" that are relevant to this
are: time, value (an int) and http_status (apparently a string?). The
queries should be pretty explanatory - one to get all 500 errors, the other
to get everything else.
The place where Im running into issues is that the query to get all of the
500 errors returns 0 rows most of the time which seems to be messing with
the ability to join to the other batch. Even with adding fill(0) it still
returns 0 rows.
My question: is there a way to always return at least 1 row where the sum
is simply 0, even if there are 0 rows that are found in the time range?
--
Remember to include the InfluxDB version number with all issue reports
---
You received this message because you are subscribed to the Google Groups
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/6b233752-edd2-4523-9022-5c83dbcae344%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.