check_http

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
veenm
Posts: 148
Joined: Tue Jun 18, 2013 5:58 am

check_http

Post by veenm »

Hi Team,

I have one requirment , i need to search for 2 string that is a AND condition means if both strings are present then only alert has to be triggered. Lets say i have a XML URL output like below.

<ROOT><ALERT><DATE></DATE><EVENTID>0</EVENTID><SYSTEM>WRKL</SYSTEM><SUBJECT>SRV</SUBJECT><COMPUTER>xxxx</COMPUTER><DESCRIPTION></DESCRIPTION></ALERTxxxxxxxxx><ALERT><DATE></DATE><EVENTID>0</EVENTID><SYSTEM>WRKL</SYSTEM>xxxxx<SUBJECT>APPL</SUBJECT><COMPUTER></COMPUTER><DESCRIPTION></DESCRIPTION></ALERT><ALERT><DATE></DATE><EVENTID>0</EVENTID>xxxx<SYSTEM>WRKL</SYSTEM><SUBJECT>BUILD</SUBJECT><COMPUTER></COMPUTER>xxxx<DESCRIPTION></DESCRIPTION></ALERT>xxxxxxx</ROOT>


If <EVENTID>0</EVENTID> AND <SUBJECT>SRV</SUBJECT> are present then only alert needs to be triggred . How can i monitoring this using check_http plugin using -r as a option.
Please let me know.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: check_http

Post by sreinhardt »

check_http will not do what you are looking for, as the string matching would essentially be OR logic, in the sense that both strings are checked separately, if either is true or both are, you will get a true result back, there is no way to change this to AND. I would instead suggest looking at something like weblogic or selenium checks instead. You could also write a custom script to handle this same logic with curl or something similar.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
veenm
Posts: 148
Joined: Tue Jun 18, 2013 5:58 am

Re: check_http

Post by veenm »

Hi ,

Thank for the reply , i have written a script using curl and grep -e logic. now script is working totally fine. I want to pass a sting in double quotes ("") to nrpe from nagios . Is that possible to pass the string in double quotes . If yes please let me know who can i do that .
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: check_http

Post by abrist »

NRPE Considers double quotes to illegal characters. You can base encode the string before you pass it through nrpe, or you could try to use the master branch of nrpe on github:
https://github.com/NagiosEnterprises/nrpe
Eric merged my patch which removed double quotes as nasty metas.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked