You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
1.0 KiB
Bash
23 lines
1.0 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Wrapper for check_generic
|
|
#
|
|
|
|
plugins="$1"
|
|
shift
|
|
name="$6"
|
|
|
|
# This crazy ass shit does the following:
|
|
#
|
|
# 1) Runs a web check on the first argument given (http://admitted.Princeton.EDU in the example below)
|
|
# 2) Looks for a string or regex given by the second argument (Congratulations)
|
|
# 3) Substitutes the wrong output given by the third argument (403 Forbidden) to the fourth argument (OK)
|
|
# 4) If the resultant output looks like the fifth argument (=~/HTTP\/1.1 OK/), the success, else failure
|
|
#
|
|
# Example:
|
|
# check_command check_http_string!admitted.Princeton.EDU!Congratulations!403 Forbidden!OK!'=~/HTTP\/1.1 OK/'
|
|
# command $USER1$/check_http_generic $USER1$ '$ARG1$' '$ARG2$' '$ARG3$' '$ARG4$' "$ARG5$" "$SERVICEDESC$"
|
|
|
|
#${plugins}/check_generic -e $(/usr/local/monitoring/princeton/generic_http.cmd $plugins "$1" "$2" "$3" "$4") -o "$5" -n $name -i -p test -vvv
|
|
${plugins}/check_generic -e "${plugins}/check_http -H $1 -f follow -v | sed -n '/$2/ { h; b }; $ { x; /$2/ { x; s/^[^:]\+: //; s/$3/$4/; x }; x; p }'" -o "$5" -n $name -i -p test ### -vvv
|