
Jika kamu merasa tulisan ini bermanfaat & membantu kamu, kamu bisa berdonasi lewat saweria
If you feel this website help you, you can donate at saweria
Lists Tools You Must Installed
Response Time using Curl
curl --write-out or w
got a lot of usefull variable that can give you information about your app. You can get speed_download, response_code, time_total, etc.

Curl was Really Handy Tool
But in this tutorial, we only use time_total (time_total, the total time, in seconds, that the full operation lasted)
Lets create simple script to measure response time
#!/bin/bash
SECONDS=0
#you can this script read variable from .env
#if not, just give it comment
#set -o allexport
#source .env
#set +o allexport
#if you have load balancer, you can test load balancer using curl
response_manager1=`(curl -s -w %{time_total}s -o /dev/null --http2 --resolve yourAPI.com:443:192.168.1.101 https://yourAPI.com)`
response_manager2=`(curl -s -w %{time_total}s -o /dev/null --http2 --resolve yourAPI.com:443:192.168.1.102 https://yourAPI.com)`
response_manager3=`(curl -s -w %{time_total}s -o /dev/null --http2 --resolve yourAPI.com:443:192.168.1.103 https://yourAPI.com)`
response_random_jokes=`(curl -s -w %{time_total}s -o /dev/null --http2 https://icanhazdadjoke.com/)`
ELAPSED="$(($SECONDS / 3600))hrs $((($SECONDS / 60) % 60))min $(($SECONDS % 60))sec"
/usr/bin/telegram-notif "Server Response Time:
//Load balancer test
Manager1: $response_manager1
Manager2: $response_manager2
Manager3: $response_manager3
//RandomJokes
Random jokes: $response_random_jokes
It takes $ELAPSED to get all data from server
"
curl -d "
//Load balancer test
Manager1: $response_manager1
Manager2: $response_manager2
Manager3: $response_manager3
//RandomJokes
Random jokes: $response_random_jokes
It takes $ELAPSED to get all data from server
" ntfy.sh/your_ntfy_channel > /dev/null

Telegram Notification

nfty Notification