mirror of
https://github.com/byReqz/status.git
synced 2024-11-24 00:14:56 +00:00
add ping and http result functions
This commit is contained in:
parent
8ca6ee3479
commit
364e5c063e
13
status.sh
13
status.sh
@ -8,5 +8,16 @@ if [[ -z "$http_hosts" ]];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
function get_code {
|
function get_code {
|
||||||
http_results="$(curl -s -I $http_hosts | grep HTTP)"
|
http_results="$(curl -s -I $http_hosts | grep HTTP | cut -d " " -f 2)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_ping {
|
||||||
|
ping_raw="$(fping -e "$ping_hosts")"
|
||||||
|
ping_reach="$(echo "$ping_raw" | grep -o -e "alive" -e "unreachable")"
|
||||||
|
ping_ms="$(echo "$ping_raw" | cut -d "(" -f 2 | cut -d ")" -f 1)"
|
||||||
|
ping_results="$ping_reach / $ping_ms"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_code
|
||||||
|
get_ping
|
||||||
|
echo "$http_results $ping_results"
|
||||||
|
Loading…
Reference in New Issue
Block a user