Using the "Search for Content" String in the Webserver Wiz

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sievers
Posts: 48
Joined: Tue May 24, 2011 7:34 am

Using the "Search for Content" String in the Webserver Wiz

Post by sievers »

Hello,

we have been given the task to monitor a website (hobit) which in turns monitors other websites. Now in itself this would be simple because the website only monitors RED or GREEN status (with a gif image)

On the website in question there are 50+ services, all with the same RED or GREEN gif. What I want to do is just copy some code from the HTML text and use that as content string for example

Code: Select all

"/hobbit-cgi/bb-hostsvc.sh?HOST=www.xxxxxxxxx.de&SERVICE=conn"><IMG SRC="/hobbit/gifs/static/green.gif"
would be the content string I input into the wizard. If the HTML code changes to red.gif, I get a NAGIOS escalation.

. I need the http://www.xxxxxx.de as reference since there are mulitple websites, otherwise it would just check the HTML code for green.gif

The problem now is that when I do this I get an NAGIOS error. And when I look at the configuration string it chopped off either by ; or "

Is there any way I can get the content string as a whole into the wizard with all the sympols ";>< etc.?

Thanks for your help

EDIT: Forgot to add that we are using NAGIOS XI 2011 R1.1
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: Using the "Search for Content" String in the Webserver W

Post by nscott »

Yes, you will need to go into the core config manager and change the service. In the command string you'll need to find context string that nagios is looking for and replace the double quotes that wrap the string with singles. That should work.
Nicholas Scott
Former Nagios employee
sievers
Posts: 48
Joined: Tue May 24, 2011 7:34 am

Re: Using the "Search for Content" String in the Webserver W

Post by sievers »

thank you so much it worked,


now I have my next question. Is it possible to monitor multiple content states with the same check.

For example in hobbit there is also a yellow Status, with yellow.gif.

Now if the status in hobbit changes to yellow it would turn red in Nagios since the content string would not find green.gif.

is there any way of telling nagios to stay status "OK" if the hobbit status is yellow.gif or green.gif , this would ensure that NAGIOS only escalates if the content on the hobbit server goes to red.gif (Basically like an OR Statement)
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Using the "Search for Content" String in the Webserver W

Post by mguthrie »

You should be able to do this with a regular expression match, which is available in the website wizard. I'm not a master of regular expressions myself, but it would be something like "/(yellow|green).gif/", but that's probably not quite right.
sievers
Posts: 48
Joined: Tue May 24, 2011 7:34 am

Re: Using the "Search for Content" String in the Webserver W

Post by sievers »

Can perhaps one of your collegues help with the regular expressio?
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Using the "Search for Content" String in the Webserver W

Post by agriffin »

Try this as a regular expression:

Code: Select all

"\/hobbit-cgi\/bb-hostsvc\.sh\?HOST=www\.xxxxxxxxx\.de&SERVICE=conn"><IMG SRC="\/hobbit\/gifs\/static\/(yellow|green)\.gif"
You will probably need to change some double quotes to single quotes again afterwards.
sievers
Posts: 48
Joined: Tue May 24, 2011 7:34 am

Re: Using the "Search for Content" String in the Webserver W

Post by sievers »

Hi,

I don´t understand the regular expression syntax.
Why put you all the commands in \/hobbit\/gifs\/static\ ???

Is is possibe to set the string like this?

Code: Select all

HOST=www.xxxx.de&SERVICE=http"><IMG SRC="/hobbit/gifs/static/(yellow|blue|green).gif
regards
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

Re: Using the "Search for Content" String in the Webserver W

Post by agriffin »

Yes, that should work too. Many tools using regular expressions have a special meaning for a forward slash character, so I escaped it out of habit (by putting a backslash in front of it). It's also a good idea in general to escape periods as well, since periods in regular expressions match any character. In this case it may not matter, though.
Locked