add ingress statistics generation script

This commit is contained in:
Simon Belmas
2024-06-27 15:04:16 +02:00
parent 14483b7428
commit b635dd74f2
3 changed files with 39 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
analyse_results.csv

View File

@@ -1,6 +1,7 @@
# html-kube-tester
## Workload
Workload to test application behavior while making changes on infrastructure.
Ingress fqdn has to be configured by either:
@@ -15,3 +16,12 @@ Connntent git will be displayed in an iframe with node name on top.
Node name is displayed on the top of the page and also in kube-node.json and on kube-node.txt
Thanks to https://github.com/amoldalwai/RoadFighter.git for having something fun to display.
## Analyse script
A script is given to test inngress availability.
analyse.sh {ingress fqdn} [keep_results]
Option *keep_results* does not ovewrite file on startup.
Information is displayed in csv format: date (iso) | node hosting workload | request total time | response http code

28
analyse.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/zsh -e
# This script asserts that init.sh workload script is left as is.
script_dir=$(dirname $(readlink -f ${0}))
results_file=${script_dir}/analyse_results.csv
if [[ -z "${1}" ]] ; then
echo "First parameter must be url"
exit 1
else
analyse_url=${1}
fi
if [[ "${2}" == "keep_results" ]] ; then
keep_results=true
else
keep_results=false
echo '' > ${results_file}
fi
echo Launching test, press CTRL+C to exit
while true ; do
echo "$(date -Iseconds);$(curl -m 2 -s -w ";%{time_total};%{http_code}" -k "${analyse_url}" | tr -d "\n")" | tee -a ${results_file}
sleep 1
done