Last active
April 9, 2023 10:17
-
-
Save anekos/2344693c443abdf26f2b96f8ba411d08 to your computer and use it in GitHub Desktop.
telegraf → TimescaleDB を Grafana に表示する
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
SELECT | |
host, | |
MAX(usage_user), | |
time_bucket('10min', time) AS bucket | |
FROM | |
telegraf.cpu | |
WHERE | |
( | |
to_timestamp($__unixEpochFrom()) - | |
(NOW() - NOW() AT TIME ZONE 'UTC') | |
) < time | |
AND | |
time < | |
( | |
to_timestamp($__unixEpochTo()) - | |
(NOW() - NOW() AT TIME ZONE 'UTC') | |
) | |
GROUP BY | |
host, bucket | |
HAVING | |
host = 'example.com' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment