Created
September 29, 2020 09:45
-
-
Save pavdmyt/1194ec73d9d63c7c52da7b71f40488c2 to your computer and use it in GitHub Desktop.
Print Prometheus block's minTime and maxTime
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
#!/bin/bash | |
# Given a Prometheus block name, prints timerange | |
# for the metrics stored inside. | |
# | |
# Usage example: | |
# for b in `cat block_names.txt`; do ./get_block_time.sh $b; done | |
TIMEZONE="EEST" | |
BLOCK_DIR="/srv/prometheus_data/$1" | |
min_time="$(cat ${BLOCK_DIR}/meta.json | jq '.minTime')" | |
max_time="$(cat ${BLOCK_DIR}/meta.json | jq '.maxTime')" | |
echo "--- $1 ---" | |
echo ";;; Min time:" | |
TZ=$TIMEZONE date -d @"${min_time%???}" | |
echo ";;; Max time:" | |
TZ=$TIMEZONE date -d @"${max_time%???}" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment