Skip to content

Instantly share code, notes, and snippets.

@xuhaiL
xuhaiL / purge_prom_pushgateway.sh
Created July 18, 2022 09:38 — forked from fvigotti/purge_prom_pushgateway.sh
this is a sample script that clean old metrics from pushgateway, not very clean but working anyway, used as sample in a issue
trap 'echo "got sigterm" ; exit 0' SIGTERM
EXPIRATION_SECONDS=${EXPIRATION_SECONDS:-900}
PGW_URL=${PGW_URL:-http://pushgateway}
function convert_to_standardnotation(){
# convert number from scientific notation to standar d( ie '1.5383780136826127e+09' )
printf '%.0f' $1
}