Re: [Nagios-users] check_http and regular expressions
Here is command line definition which works fine for what you are trying to achieve. define command{ command_namecheck_https_reverse command_line$USER1$/check_http -H $HOSTADDRESS$ -S -u $ARG1$ -r $ARG2$ -r $ARG3$ --invert-regex } On Thu, Aug 27, 2009 at 9:30 PM, Marc Powell m...@ena.com wrote: On Aug 27, 2009, at 5:27 PM, Masoud Tabrizi wrote: I am running the command as you suggested but it seems like there is something missing; what am I doing wrong? Nothing, you just don't know how nagios determines status. It's not the plugin text output, that's just for humans. Nagios determines OK, CRITICAL, etc from the exit code of the plugin. All commans are run from /usr/lib/nagios/plugins directory; /usr/lib/nagios/plugins/check_http -H x -u /sample/test.html -p 80 –a user:password -s TAPE Response: HTTP OK HTTP/1.1 200 OK - 0.018 second response time | time=0.018116s;;;0.00 size=3648B;;;0 echo $? - should be 0 Now I run it with negate as you suggested: ./negate /usr/lib/nagios/plugins/check_http -H x -u /sample/ test.html -p 80 –a user:password -s TAPE HTTP OK HTTP/1.1 200 OK - 0.006 second response time | time=0.006001s;;;0.00 size=3648B;;;0 echo $? - should be 2 -- Marc -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null -- Cordially, Shadhin Rahman -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] check_http and regular expressions
I am running the command as you suggested but it seems like there is something missing; what am I doing wrong? All commans are run from /usr/lib/nagios/plugins directory; /usr/lib/nagios/plugins/check_http -H x -u /sample/test.html -p 80 –a user:password -s TAPE Response: HTTP OK HTTP/1.1 200 OK - 0.018 second response time |time=0.018116s;;;0.00 size=3648B;;;0 Now I run it with negate as you suggested: ./negate /usr/lib/nagios/plugins/check_http -H x -u /sample/test.html -p 80 –a user:password -s TAPE HTTP OK HTTP/1.1 200 OK - 0.006 second response time |time=0.006001s;;;0.00 size=3648B;;;0 Now I change the string to something which doesn’t exist: /usr/lib/nagios/plugins/check_http -H x -u /sample/test.html -p 80 –a user:password –s Testing HTTP CRITICAL - string not found|time=0.012479s;;;0.00 size=3648B;;;0 ./negate /usr/lib/nagios/plugins/check_http -H x -u /sample/test.html -p 80 –a user:password -s Testing HTTP CRITICAL - string not found|time=0.005779s;;;0.00 size=3648B;;;0 Any help is appreciated! Masoud -Original Message- From: Marc Powell [mailto:m...@ena.com] Sent: Wednesday, August 26, 2009 6:43 PM To: Nagios User list Subject: Re: [Nagios-users] check_http and regular expressions On Aug 26, 2009, at 3:20 PM, Masoud Tabrizi wrote: Perhaps I was not clear the first time around: Here is what I want to do: Search for the string ERROR If not found - return OK Else - return NOK Yes, you were clear and I understood. The solution I provided does that. I did the *exact* same thing just today, authentication and everything. -- Marc -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] check_http and regular expressions
On Thu, 27 Aug 2009, Masoud Tabrizi wrote: I am running the command as you suggested but it seems like there is something missing; what am I doing wrong? All commans are run from /usr/lib/nagios/plugins directory; /usr/lib/nagios/plugins/check_http -H x -u /sample/test.html -p 80 ???a user:password -s TAPE Response: HTTP OK HTTP/1.1 200 OK - 0.018 second response time |time=0.018116s;;;0.00 size=3648B;;;0 Now I run it with negate as you suggested: ./negate /usr/lib/nagios/plugins/check_http -H x -u /sample/test.html -p 80 ???a user:password -s TAPE HTTP OK HTTP/1.1 200 OK - 0.006 second response time |time=0.006001s;;;0.00 size=3648B;;;0 Now I change the string to something which doesn???t exist: /usr/lib/nagios/plugins/check_http -H x -u /sample/test.html -p 80 ???a user:password ???s Testing HTTP CRITICAL - string not found|time=0.012479s;;;0.00 size=3648B;;;0 ./negate /usr/lib/nagios/plugins/check_http -H x -u /sample/test.html -p 80 ???a user:password -s Testing HTTP CRITICAL - string not found|time=0.005779s;;;0.00 size=3648B;;;0 That all looks pretty normal. Negate doesn't change the plugin output; it only flips the result code. -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] check_http and regular expressions
On Aug 27, 2009, at 5:27 PM, Masoud Tabrizi wrote: I am running the command as you suggested but it seems like there is something missing; what am I doing wrong? Nothing, you just don't know how nagios determines status. It's not the plugin text output, that's just for humans. Nagios determines OK, CRITICAL, etc from the exit code of the plugin. All commans are run from /usr/lib/nagios/plugins directory; /usr/lib/nagios/plugins/check_http -H x -u /sample/test.html -p 80 –a user:password -s TAPE Response: HTTP OK HTTP/1.1 200 OK - 0.018 second response time | time=0.018116s;;;0.00 size=3648B;;;0 echo $? - should be 0 Now I run it with negate as you suggested: ./negate /usr/lib/nagios/plugins/check_http -H x -u /sample/ test.html -p 80 –a user:password -s TAPE HTTP OK HTTP/1.1 200 OK - 0.006 second response time | time=0.006001s;;;0.00 size=3648B;;;0 echo $? - should be 2 -- Marc -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
[Nagios-users] check_http and regular expressions
Hello All, I need to check on a http page and get an OK if that particular string is NOT present. Using check_http I would like to get an OK after checking on the http page if the matching string is not present on the page. Could someone tell me how to do this? I am using check_http version 1.4.9 along with Nagios 2.9 I am currently running ./check_http -H 10.10.10.10 -p 80 -u /something/something/log -a username:password -r [^ERROR] (if there are no ERRORS, it should return OK) Thanks for your help ‘Masoud -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] check_http and regular expressions
On Aug 26, 2009, at 2:49 PM, Masoud Tabrizi wrote: Hello All, I need to check on a http page and get an OK if that particular string is NOT present. Using check_http I would like to get an OK after checking on the http page if the matching string is not present on the page. Could someone tell me how to do this? I am using check_http version 1.4.9 along with Nagios 2.9 I am currently running ./check_http -H 10.10.10.10 -p 80 -u / something/something/log -a username:password -r [^ERROR] (if there are no ERRORS, it should return OK) I haven't used the regex functionality but for such a simple case the negate plugin will work fine -- /path/to/plugins/negate /path/to/check_http -H 10.10.10.10 -p 80 -u / something/something/log -a username:password -s ERROR -- Marc -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] check_http and regular expressions
Perhaps I was not clear the first time around: Here is what I want to do: Search for the string ERROR If not found - return OK Else- return NOK -Original Message- From: Marc Powell [mailto:m...@ena.com] Sent: Wednesday, August 26, 2009 4:02 PM To: Nagios User list Subject: Re: [Nagios-users] check_http and regular expressions On Aug 26, 2009, at 2:49 PM, Masoud Tabrizi wrote: Hello All, I need to check on a http page and get an OK if that particular string is NOT present. Using check_http I would like to get an OK after checking on the http page if the matching string is not present on the page. Could someone tell me how to do this? I am using check_http version 1.4.9 along with Nagios 2.9 I am currently running ./check_http -H 10.10.10.10 -p 80 -u / something/something/log -a username:password -r [^ERROR] (if there are no ERRORS, it should return OK) I haven't used the regex functionality but for such a simple case the negate plugin will work fine -- /path/to/plugins/negate /path/to/check_http -H 10.10.10.10 -p 80 -u / something/something/log -a username:password -s ERROR -- Marc -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
Re: [Nagios-users] check_http and regular expressions
On Aug 26, 2009, at 3:20 PM, Masoud Tabrizi wrote: Perhaps I was not clear the first time around: Here is what I want to do: Search for the string ERROR If not found - return OK Else - return NOK Yes, you were clear and I understood. The solution I provided does that. I did the *exact* same thing just today, authentication and everything. -- Marc -- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july ___ Nagios-users mailing list Nagios-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null