From 73ebf1582254e3bd212a6ced3924ccd3ade5fcdd Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 22 Feb 2024 16:32:33 +0000 Subject: [PATCH] adding ntfy --- docker/auth-bench/run-ab.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/auth-bench/run-ab.sh b/docker/auth-bench/run-ab.sh index 400422b..1f7b5d3 100644 --- a/docker/auth-bench/run-ab.sh +++ b/docker/auth-bench/run-ab.sh @@ -37,18 +37,22 @@ function run_apache_bench_and_check_ttfb { done } -function upload_to_hastebin { +function upload_to_hastebin_and_notify { local log_file="/logs/authenticated.csv" local response=$(curl -X POST -s --data-binary @"${log_file}" https://haste.nixc.us/documents) local key=$(echo $response | awk -F '"' '{print $4}') + if [ ! -z "$key" ]; then local haste_url="https://haste.nixc.us/$key" echo "Logs uploaded to: $haste_url" + # Send notification with the Haste URL, including the authentication token + curl -X POST -H "Authorization: Bearer tk_xjkgklandq47adj1f17bw6edtilh4" -d "$haste_url" https://ntfy.nixc.us/bnHobG80sO5ZF4SB else echo "Failed to upload logs to Hastebin." fi } + prepare_log_file run_apache_bench_and_check_ttfb upload_to_hastebin