Created
October 21, 2016 14:47
-
-
Save manojVivek/494f77d60057e60baed304b252b23255 to your computer and use it in GitHub Desktop.
A simple elementary script to monitor the request count for each source ips at seconds granularity by grepping the haproxy-info log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COLUMNS=300 | |
export COLUMNS | |
source_ips=( "10.0.0.1" "10.0.0.2" "10.0.0.3") | |
header=("Time" ${source_ips[@]}) | |
for value in "${header[@]}"; do | |
printf "%-8s\n" "${value}" | |
done | column -x | |
for i in $(seq -w 1 60); | |
do | |
results=() | |
results+=("$1$i") | |
for ip in ${source_ips[*]}; | |
do | |
results+=(`grep "$1$i" $2 | grep $ip | wc -l`) | |
done | |
for value in "${results[@]}"; do | |
printf "%-8s\n" "${value}" | |
done | column -x | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment