I am trying to construct a check_http command that will alert me to the actual PRESENCE of a text string, not the ABSENCE. I oftentimes use the –s flag to specify the absence of a certain text string. How can I do the opposite, though? I want to have Nagios check a webpage, and when it gets a text-based message of “(DATABASE ERROR)” I want it to begin alerting.
Is there a way with check_http to do this?
check_http configuration
Re: check_http configuration
The answer happened to be under my nose, but the text on the manpages was too small or something:
-R, --eregi=STRING
Search page for case-insensitive regex STRING
--invert-regex
Return CRITICAL if found, OK if not
define command {
command_name command_dberror
command_line $USER1$/check_http -H $HOSTADDRESS$ -u "/url" -R "DATABASE ERROR" --invert-regex
}
-R, --eregi=STRING
Search page for case-insensitive regex STRING
--invert-regex
Return CRITICAL if found, OK if not
define command {
command_name command_dberror
command_line $USER1$/check_http -H $HOSTADDRESS$ -u "/url" -R "DATABASE ERROR" --invert-regex
}