check_curl

This commit is contained in:
Cyberes 2023-04-21 23:54:19 -06:00
parent 157b860f97
commit 5b9ececd11
2 changed files with 8 additions and 4 deletions

View File

@ -87,7 +87,8 @@ OUTPUT_MSG=""
OUTPUT_CODE=0
if [ $RESPONSE_CODE -eq 200 ] && [ "$(echo "$RESPONSE_TIME < $CRITICAL_LEVEL" | bc -l)" -eq 1 ]; then
OUTPUT_MSG="OK: ${RESPONSE_TIME}s - $url."
OUTPUT_MSG="OK: ${RESPONSE_TIME}s - $URL."
$OUTPUT_CODE=0
elif [ $RESPONSE_CODE -eq 200 ] && [ "$(echo "$RESPONSE_TIME < $WARNING_LEVEL" | bc -l)" -eq 1 ]; then
OUTPUT_MSG="WARNING: response time is slow ($RESPONSE_TIME seconds)."
OUTPUT_CODE=1
@ -103,8 +104,8 @@ if [[ -n ${CONTAINS+x} ]]; then
if ! grep -q "$CONTAINS" "$TMP_RESPONSE"; then
OUTPUT_MSG+="\nCRITICAL: response did not contain required string!\nFound: $(cat "$TMP_RESPONSE")"
OUTPUT_CODE=2
else
OUTPUT_MSG+="\nOK: response contained required string."
# else
# OUTPUT_MSG+="\nOK: response contained required string."
fi
fi
rm -rf "$TMP_RESPONSE"

View File

@ -14,3 +14,6 @@ git -C /opt/icinga2-checks pull || git clone https://git.dp15.us/dpanzer/icinga2
ln -s /opt/icinga2-checks/check_iowait.sh /usr/lib64/nagios/plugins/check_iowait
ln -s /opt/icinga2-checks/check_bandwidth /usr/lib64/nagios/plugins/check_bandwidth
rm /usr/lib64/nagios/plugins/check_curl
ln -s /opt/icinga2-checks/check_curl /usr/lib64/nagios/plugins/check_curl