Skip to content
Snippets Groups Projects
Commit 27d285c9 authored by Raphael Storm Larsen's avatar Raphael Storm Larsen
Browse files

pushed scaling to live version

parent 5c3be4bd
Branches main
No related tags found
No related merge requests found
......@@ -52,6 +52,7 @@ function scale {
# Safety valve is off, we're running the command
$SSH_COMMAND $COMMAND
discord_log "Scaling to $1 frontpage users."
echo "$1" > /home/ubuntu/logs/frontpage
else
# Saftey valve is on, we only print what we would do
......@@ -78,6 +79,13 @@ fi
# Get current download times:
DOWNLOAD_TIME=$( curl -s -g 'http://admin:admin@192.168.132.61:9090/api/v1/query?query=last_download_time{name="'$COMPANY_NAME'"}' | jq -r '.data.result[].value[1] ')
NUMBER_OF_FRONTPAGE_USERS=$( curl -s -g 'http://admin:admin@192.168.132.61:9090/api/v1/query?query=frontpage_count{name="'$COMPANY_NAME'"}' | jq -r '.data.result[].value[1] ')
LOCAL_FRONTPAGE=$(cat /home/ubuntu/logs/frontpage)
if (( "$NUMBER_OF_FRONTPAGE_USERS" != "$LOCAL_FRONTPAGE" )); then
echo "Frontpage count not aligned with local value."
exit 1
fi
echo "Observed download time: $DOWNLOAD_TIME"
# check if we are below the lower threshold. If we are, we scale up
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment