Commit 943d717d authored by Azat Khuziyakhmetov's avatar Azat Khuziyakhmetov
Browse files

now BEEGFS values are NOT collected as per second

parent c676c41d
......@@ -56,12 +56,12 @@ while read -r line; do
if [ ! -w "$BGFSLOGFILE" ]; then
touch $BGFSLOGFILE
fi
# Create necessary arrays
declare -A prev_metrics
declare -A aggr_metrics
declare -A metrics
# Read previous metrics
PREVTS=0
debug "Previous measurements:"
......@@ -73,12 +73,6 @@ while read -r line; do
debug "$key = $value"
done < "$BGFSLOGFILE"
# difference between timestamps
FRACTS=$((CURTS - PREVTS))
if [ "$FRACTS" -le "0" ]; then
FRACTS=1
fi
# Parse the current measurements
debug "Parsing current measurments"
prev_is_val=false
......@@ -99,10 +93,10 @@ while read -r line; do
if [ "$prev_metric" = "" ]; then prev_metric=0; fi
diff=`bc <<< "($cur_metric - $prev_metric) / $FRACTS"`
debug "$m: ( $cur_metric - $prev_metric ) / $FRACTS = $diff"
diff=`bc <<< "($cur_metric - $prev_metric)"`
debug "$m: ( $cur_metric - $prev_metric ) = $diff"
if [ "$diff" -ge "0" ]; then
metrics[$m]=$diff
else
......@@ -120,7 +114,7 @@ while read -r line; do
else
out="$out,"
fi
out="$out$m=${metrics[$m]}"
done
......@@ -131,10 +125,9 @@ while read -r line; do
for m in ${!aggr_metrics[@]}; do
mf="$m=${aggr_metrics[$m]}\n$mf"
done
mf="timestamp=$CURTS\n$mf"
mf="timestamp=$CURTS\n$mf"
echo -e "$mf" > $BGFSLOGFILE
debug "measurements are exported"
debug "measurements are exported"
done < <(printf '%s\n' "$data")
exit 0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment