Skip to content

How to clean the JuiceFS expired metric on pushgateway automatically #1173

Answered by nature1995
nature1995 asked this question in Q&A
Discussion options

You must be logged in to vote

This script can allow you to clean the JuiceFS metric and the basic metric automatically.
Please change the EXPIRATION_SECONDS(s) value

trap 'echo "got sigterm" ; exit 0' SIGTERM

EXPIRATION_SECONDS=${EXPIRATION_SECONDS:-900}
PGW_URL=${PGW_URL:-http://127.0.0.1:9091}

function convert_to_standardnotation() {
    # convert number from scientific notation to standard( ie  '1.5383780136826127e+09' )
    local -r _METRIC=$1
    local -r _VARNAME=$2
    echo $_METRIC | sed -r "s/.*${_VARNAME}=\"([^\"]*).*/\\1/g"
}

function check_metric_line(){
    local -r _line=$1
    METRIC_TIME=$(echo $_line | awk '{print $2}' )
    #echo "mtime = $_line -> $METRIC_TIME "
    METRIC_TIME=$(convert_to_stand…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nature1995
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
kind/question Further information is requested
1 participant
Converted from issue

This discussion was converted from issue #1172 on December 21, 2021 07:42.