From b635dd74f28b54b265d7f9d0c9566dfbe4f994d3 Mon Sep 17 00:00:00 2001 From: Simon Belmas <22192134+simbelmas@users.noreply.github.com> Date: Thu, 27 Jun 2024 15:04:16 +0200 Subject: [PATCH] add ingress statistics generation script --- .gitignore | 1 + README.md | 10 ++++++++++ analyse.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 .gitignore create mode 100755 analyse.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5e5cfc6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +analyse_results.csv \ No newline at end of file diff --git a/README.md b/README.md index 3af3f58..d9f92c8 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file diff --git a/analyse.sh b/analyse.sh new file mode 100755 index 0000000..37b20a8 --- /dev/null +++ b/analyse.sh @@ -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 \ No newline at end of file