I need a plugin that allows me to nagios looking for a well-defined text in the content of my web page. if the text is found I would ok sion error who can help me please
2 Answers
The standard plugin check_http
can do this:
check_http -H [hostname] -I [ip address] -u [url] -R [text to match]
The check will fail for the usual reasons, but also if the text (or regular expression) is not found in the returned page.
If you want to fail if the text is found, add the option --invert-regex
.
-
I have HTTP CRITICAL: HTTP/1.1 400 Bad Request - pattern not found - 1270 bytes in 0,069 second response time |time=0,068840s;;;0,000000 size=1270B;;;0 Mar 18, 2013 at 13:11
-
-
check_http -H chourouk1 -I @IP -u www.alchourouk.com -R "Site web réalisé par" Mar 18, 2013 at 13:42
-
The argument for
-u
should be the path part of the URL. Try-u /
. You might also have to do-H www.alchourouk.com
if your host has more than one virtual host.– FlupMar 18, 2013 at 13:58 -
/usr/lib/nagios/plugins/check_http -H www.alchourouk.com -u / -R "Site web réalisé" HTTP CRITICAL: HTTP/1.1 302 Found - pattern not found - 443 bytes in 0,402 second response time |time=0,402222s;;;0,000000 size=443B;;;0 Mar 18, 2013 at 14:01
Flup's answer seems great for a simple page.
If you want to do something similar but need to navigate through a set of login pages, we make use of http://webinject.org/ which allows a test to fill in forms etc.