Last active
March 30, 2020 19:39
-
-
Save mmastoras/892881008d32240696be3a076ecb8a9c to your computer and use it in GitHub Desktop.
Influx cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ influx -ssl -host <host> -port <port> | |
# select database | |
> use <database name> | |
# set time format | |
> precision rfc3339 | |
# show all measurements | |
> show measurements | |
# select data from measurement | |
> select * from "<measurement name>" order by time DESC limit 10; | |
# use inner join to select a tag, in this case hostname is a tag and can only be retrieved when selected w/ a non-tag | |
> select "hostname" from (select last("BytesInPerSecCount"), "hostname" from "kafka.topic" where time > now() - 5m group by "hostname"); | |
# group by examples in granfa dashboards | |
SELECT mean("BytesInPerSecOneMinuteRate") as "BytesIn" FROM "kafka.topic" WHERE $timeFilter GROUP BY time($interval),"topic" fill(null) | |
SELECT mean("TotalFetchRequestsPerSecCount") as "FetchRequests" FROM "kafka.topic" WHERE $timeFilter GROUP BY time($interval), "topic" fill(null) | |
SELECT mean("TotalProduceRequestsPerSecCount") as "ProdReq" FROM "kafka.topic" WHERE $timeFilter GROUP BY time($interval), "topic" fill(null) | |
> select * from "kafka.topic" where "topic" = 'container_logs_alpha' order by time DESC limit 5; | |
## alert when cluster status !=green set alert to trigger if value > 0 | |
> SELECT count("status") FROM "elasticsearch_cluster_health" WHERE ("host" =~ /search6-ds-coordinator1/) AND "status" =~/'yellow|red/ AND $timeFilter GROUP BY time($__interval) fill(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment