Page 1 of 1

Web page content help - using check_http

Posted: Mon Sep 23, 2013 5:25 pm
by ecarrasq
System Info

Linux Distribution and version?

*Linux version 2.6.18-348.16.1.el5PAE #1 SMP Wed Aug 21 04:49:45 EDT 2013 i686 i686 i386 GNU/Linux
CentOS release 5.7 (Final)


32 or 64bit?

32 bit

VMware Image or Manual Install of XI?

VMware Image

Are there specials configurations on your system, ie; is Gnome installed? Are you using a proxy? Are you using SSL?

Forced SSL on NagiosXi login web screen

Nagios Xi version: Nagios XI 2012R2.3

Issue:

I need help in creating a web page content check using check_http (http://nagiosplugins.org/man/check_http), or another type of plugin that can do the following.

Scenario:

We have a web page that will show the word "GREEN, YELLOW, or RED" at any point in time with date following the text (GREEN, YELLOW, or RED".
Example:

YELLOW: 3.19 seconds for duration of call
I would like to alert, as follows:

GREEN = Ok
YELLOW = Warning with the text following the word YELLOW
RED = Critical with the text following the word RED

Any ideas?

Thank you very much,
Eddie

Re: Web page content help - using check_http

Posted: Mon Sep 23, 2013 6:53 pm
by BanditBBS
If you can't find a plugin to do exactly what you want, there is this one: http://exchange.nagios.org/directory/Pl ... nt/details

Most plugins that check for web page content only check if content is there, if it is, then returns OK, if it isn't then returns Critical. The one I linked works like that, but it could be modified to look at your page for the three different results. relatively easy I think.

Re: Web page content help - using check_http

Posted: Tue Sep 24, 2013 10:09 am
by sreinhardt
As bandit mentioned, most plugins are meant to check for one item. Considering yours is so specific, writing a bash or other script that pulled the webpage and searched for your three terms would not be terribly hard at all. Something like curl the page, grep the page for each of your terms, print the results to standard out, and exit with the correct code for OK, warning, or critical.