check_curl: round digits
This commit is contained in:
parent
6ac2c4b9c1
commit
1c21029188
|
@ -100,7 +100,7 @@ CURL_EXIT=$?
|
||||||
|
|
||||||
# Parse curl output
|
# Parse curl output
|
||||||
HTTP_CODE=$(echo "$CURL_OUTPUT" | cut -d ';' -f 1)
|
HTTP_CODE=$(echo "$CURL_OUTPUT" | cut -d ';' -f 1)
|
||||||
RESPONSE_TIME=$(echo "$CURL_OUTPUT" | cut -d ';' -f 2)
|
RESPONSE_TIME=$(echo "$CURL_OUTPUT" | cut -d ';' -f 2 | xargs printf "%0.2f\n")
|
||||||
|
|
||||||
# Check curl exit status
|
# Check curl exit status
|
||||||
if [ $CURL_EXIT -ne 0 ]; then
|
if [ $CURL_EXIT -ne 0 ]; then
|
||||||
|
@ -390,7 +390,7 @@ if [ $(echo "$RESPONSE_TIME_MS > $CRIT_TIME" | bc) -eq 1 ]; then
|
||||||
echo "CRITICAL - Response time $RESPONSE_TIME seconds -> $URL | response_time=${RESPONSE_TIME_MS}ms"
|
echo "CRITICAL - Response time $RESPONSE_TIME seconds -> $URL | response_time=${RESPONSE_TIME_MS}ms"
|
||||||
exit 2
|
exit 2
|
||||||
elif [ $(echo "$RESPONSE_TIME_MS > $WARN_TIME" | bc) -eq 1 ]; then
|
elif [ $(echo "$RESPONSE_TIME_MS > $WARN_TIME" | bc) -eq 1 ]; then
|
||||||
echo "WARNING - response time $RESPONSE_TIME seconds -> $URL | response_time=${RESPONSE_TIME}s"
|
echo "WARNING - response time $RESPONSE_TIME seconds -> $URL | response_time=${RESPONSE_TIME_MS}s"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue