0

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

4

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 – user165158 Mar 18 '13 at 13:11
  • Strange that you got a 400. What was the full command line you used? – Flup Mar 18 '13 at 13:36
  • check_http -H chourouk1 -I @IP -u www.alchourouk.com -R "Site web réalisé par" – user165158 Mar 18 '13 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. – Flup Mar 18 '13 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 – user165158 Mar 18 '13 at 14:01
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.