| 1 |
General / Development Discussion / Logging onfail when running in nagios plugin mode |
Jul 19th, 2010, 4:09pm |
| Started by rb1980 | Last post by rb1980 |
Hi, I am running WebInject as a Nagios plugin, and everything is fine, except that I want to be able to "capture" the request/response when the check fails. Unfortunately, when running in nagios reporttype mode, the http.log logging is disabled. I could probably hack thru the code to get this to work, but figured I would ask if anyone has already done it and could send me the updated script to save some time... Thanks. |
Reply Quote Notify of replies
|
| 2 |
General / User Forum / webinject fails unless root or local web server |
Dec 11th, 2007, 7:51pm |
| Started by wgibbs | Last post by wgibbs |
I just resolved my issue after making a long post. It turns out it was a permission issue. /etc/resolv.conf had 600 for permissions and apparently even if you use an IP addresss, Webinject fails. So be sure to check /etc/resolv.conf for readability in addition to other permissions. |
Reply Quote Notify of replies
|
| 3 |
General / User Forum / 500 error when using WebInject. |
Nov 21st, 2007, 3:50pm |
| Started by rspott | Last post by rspott |
First off, excellent application. Outperforming Load-Runner by a mile! (or 10!) I have a web-app that I am more than able to parse through with webinject. However, when I attempt to grab a pdf file I get a 500 error. I realize the 500 error comes from the server (in this case an IIS box, not that it matters). Here is what I get when I use "Fiddler" to proxy my requests I get a form, that I successfully submit, the form reloads as it is supposed to, and then the UI has a javascript pop up that has a standard get request in it. This get request calls a pdf file. so... page 1 (form response) BLAH BLAH BLAH HTML.... ... <script language='javascript'>scrollTo(0,0);</script> <script lang=Javascript> window.open( '../Reports/ShowReport.aspx?reportId=b112af95-5952-4569-adc9-db717776573 7' ,'b112af9559524569adc9db7177765737' ,'width=450, height=450, resizable=1, scrollbars=1' ); </script> ..... page 2 (Go get that crazy PDF file) Request: GET /something/Reports/ShowReport.aspx?reportId=b112af95-5952-4569-adc9-db71 77765737 HTTP/1.1 Accept: */* Accept-Language: en-us Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; iOpus-I-M; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.1) Host: something.com Proxy-Connection: Keep-Alive Cookie: [redacted cookie data] [redacted cookie data] [redacted cookie data] Response: HTTP/1.1 200 OK Date: Wed, 21 Nov 2007 18:29:07 GMT Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET X-AspNet-Version: 2.0.50727 Transfer-Encoding: chunked Cache-Control: private Content-Type: application/pdf 150c %PDF-1.3% 1 0 obj [/PDF /Text /ImageB /ImageC /ImageI] endobj 3 0 obj << /Type /Page /Parent 2 0 R /MediaBox [0 0 612.000071 792.000092] /Contents 4 0 R /Resources << /ProcSet 1 0 R /XObject << >> /Font << /F5 5 0 R /F6 6 0 R /F7 7 0 R >> >> /Annots [ 8 0 R ] >> endobj 4 0 obj << /Length 3928 /Filter /FlateDecode >> stream x��\�s�_�L�_<:�9__ʏ 33; …. Continued binary data that makes up the PDF file…. When I go get this stuff with webinject I use the following cases: <case id="20" description1="20 POST /something/Fulfillments/FulfillmentDashboard.aspx HTTP/1.1" description2="done" method="post" url="http://something.com/something/Fulfillments/FulfillmentDashboard.aspx&qu ot; logrequest="yes" posttype="application/x-www-form-urlencoded" postbody[redacted]" parseresponse1="reportId=|'|escape" logresponse="yes" /> <case id="21" description1="21 GET /something/Reports/ShowReport.aspx?reportId={PARSEDRESULT1} HTTP/1.1" description2="done" method="get" url=" http://something.com/something/Reports/ShowReport.aspx\?reportId={PARSEDRESULT1}" logrequest="yes" logresponse="yes" addheader="Transfer-Encoding: chunked|Content-Type: application/pdf" /> When I look at the log, I get this: ************************* LOG SEPARATOR ************************* BLAH BLAH BLAH HTML….. <script language='javascript'>scrollTo(0,0);</script> <script lang=Javascript> window.open( '../Reports/ShowReport.aspx?reportId=c6f1eca3-749d-4818-b76d-abd07687b3b 0' ,'c6f1eca3749d4818b76dabd07687b3b0' ,'width=450, height=450, resizable=1, scrollbars=1' ); </script> </form> </body> </html> ************************* LOG SEPARATOR ************************* GET http://something.com/something/Reports/ShowReport.aspx%5C?reportId=c6f1e ca3-749d-4818-b76d-abd07687b3b0 Transfer-Encoding: chunked User-Agent: WebInject Content-Type: application/pdf Cookie: cookies are here, redacted… Cookie2: $Version="1" 500 (Internal Server Error) Server closed connection without sending any data back Content-Type: text/plain Client-Date: Tue, 20 Nov 2007 20:01:15 GMT Client-Warning: Internal response 500 Server closed connection without sending any data back GET http://something.com/something/Reports/ShowReport.aspx%5C?reportId=c6f1e ca3-749d-4818-b76d-abd07687b3b0 Transfer-Encoding: chunked User-Agent: WebInject Content-Type: application/pdf Cookie: cookies here, redacted…. Cookie2: $Version="1" 500 (Internal Server Error) Server closed connection without sending any data back Content-Type: text/plain Client-Date: Tue, 20 Nov 2007 20:01:15 GMT Client-Warning: Internal response 500 Server closed connection without sending any data back ************************* LOG SEPARATOR ************************* So, riddle me this, is there something that prevents webinject from downloading this PDF? Or something that might cause these errors? The GUID that gets generated allows for ONE viewing or get request. When I perform all but case 21 with web-inject and then take the GUID and paste the URL into Internet Exploder, all is well and away we go, PDF downloaded! Do I need any additional information? Am I missing something obvious? |
Reply Quote Notify of replies
|
| 4 |
General / Development Discussion / Directory Handling Bugs |
Nov 8th, 2007, 12:16pm |
| Started by Jon Angliss | Last post by Jon Angliss |
I just grabbed WebInject yesterday, as I was looking to add some extended monitoring to Nagios. My original plan was to install webinject in /usr/local/bin, and have the scripts located under /usr/local/nagios/libexec/scripts. This brought up an interesting bug, which I see was mentioned here and here. It looks like work is being done on the second one. The other issue is related to temporary files. With the above setup in mind, the nagios user wouldn't have write access to anything but the nagios/var directory, however, it seems that WebInject wants to take a temporary file, and put it inside the directory where the testcases are located. This should be easily changed out to using something simple like mktemp (or Perl equivalent). |
Reply Quote Notify of replies
|
| 6 |
General / User Forum / link in error message |
Oct 25th, 2007, 3:11pm |
| Started by jmaher | Last post by jmaher |
Is it possible to have a link in the error message of a test case? I am using WebInject as a Nagios plugin. Here is a sample of the errormessage in a test case I am using: errormessage="A test for ${TEST_URL}${TEST_FILE} has failed" I tried to simply insert a <a href='${TEST_URL}${TEST_FILE}'> tag but receive an error when doing so. I've also tried using <a href='${TEST_URL}${TEST_FILE}'> combinations which show up in Nagios as text, not links... Any ideas on how to accomplish this? |
Reply Quote Notify of replies
|
| 7 |
General / User Forum / Adding cookies |
Oct 18th, 2007, 6:03pm |
| Started by cpetterborg | Last post by cpetterborg |
We had the need to set cookies within out webinject environment. I added code to webinject.pl to allow the setting of cookies in an external file and reading those in to the cookie_jar. Here is the patch (from a "diff -p"): Code: *** webinject.pl 2007-09-20 11:17:05.000000000 -0600 --- webinject-cfar.pl 2007-10-18 13:19:38.836755146 -0600 *************** our (@casefilelist, $currentcasefile, $c *** 47,53 **** our (%case, $verifylater, $verifylaterneg); our (%config); our ($currentdatetime, $totalruntime, $starttimer, $endtimer); ! our ($opt_configfile, $opt_version, $opt_output); our ($reporttype, $returnmessage, %exit_codes); --- 47,53 ---- our (%case, $verifylater, $verifylaterneg); our (%config); our ($currentdatetime, $totalruntime, $starttimer, $endtimer); ! our ($opt_configfile, $opt_version, $opt_output, $cookie_file); our ($reporttype, $returnmessage, %exit_codes); *************** sub engine { #wrap the whole engine in *** 81,89 **** whackoldfiles(); #delete files leftover from previous run (do this here so they are whacked each run) ! #contsruct objects $useragent = LWP::UserAgent->new(keep_alive=>1); $cookie_jar = HTTP::Cookies->new; $useragent->agent('WebInject'); #http useragent that will show up in webserver logs $useragent->max_redirect('0'); #don't follow redirects for GET's (POST's already don't follow, by default) --- 81,108 ---- whackoldfiles(); #delete files leftover from previous run (do this here so they are whacked each run) ! #construct objects $useragent = LWP::UserAgent->new(keep_alive=>1); $cookie_jar = HTTP::Cookies->new; + + # To set cookies, use -C/--cookie-file option + # You will need to set up your cookie file to look like this (without the initial #'s): + #Set-Cookie3: cookiename=cookievalue; path="cookiepath"; domain=domainname; version=versionnumber + # Here's an example: + #Set-Cookie3: username=jsmith; path="/"; domain=.my.domain.com; version=1 + # + # If you wish to set a cookie, but don't know what to do, you can set one like this and then save the cookies: + # $cookie_jar->set_cookie(1, 'username', 'jsmith', '/', '.google.com'); + # $cookie_jar->save('/tmp/cookies.txt'); + # + # or you can print them out on standard-out with: + # print $cookie_jar->as_string; + + if ($cookie_file) { + $cookie_jar->load($cookie_file); + } + + $useragent->agent('WebInject'); #http useragent that will show up in webserver logs $useragent->max_redirect('0'); #don't follow redirects for GET's (POST's already don't follow, by default) *************** sub getoptions { #command line options *** 1382,1387 **** --- 1401,1407 ---- 'c|config=s' => \$opt_configfile, 'o|output=s' => \$opt_output, 'n|no-output' => \$nooutput, + 'C|cookie-file=s' =>\$cookie_file, ) or do { print_usage(); *************** sub getoptions { #command line options *** 1394,1400 **** sub print_usage { print <<EOB Usage: ! webinject.pl [-c|--config config_file] [-o|--output output_location] [-n|--no-output] [testcase_file [XPath]] webinject.pl --version|-v EOB } --- 1414,1420 ---- sub print_usage { print <<EOB Usage: ! webinject.pl [-c|--config config_file] [-o|--output output_location] [-n|--no-output] [-C|--cookie-file cookie-file-location] [testcase_file [XPath]] webinject.pl --version|-v EOB } |
| There is some limited documentation with in the code, including hints on the cookie file format and a way to create you own cookie file that you can then move and use later. If you have questions on this, let me know. Cary |
Reply Quote Notify of replies
|
| 8 |
General / User Forum / WebInject Parser Error |
Oct 12th, 2007, 3:20pm |
| Started by aravinj | Last post by aravinj |
Hi, I'm using webinject to test a servlet which mimics a webservice and expects xml messages in the postbody. When I try to send a message with the following contents the webinject engine does not even post this to the servlet URL It gives a "Not well-formed" error. <message> <document uri="command-0" version="1"> <property name="command" value="query" /> <content> <query> <attribute> <parent>campus</parent> <name>legaldiscription</name> <sort>true</sort> </attribute> </query> </content> </document> </message> Webinject error on running a testcase that posts this file: not well-formed at line 41, column 61, byte 7586 at C:/Perl/site/lib/XML/Parser.pm line 168 The problem seems to be with the line <name>legaldiscription</name> If I replace legaldiscription with an other field name, Webinject test case passes. Does anyone know if the word legaldiscription has a special meaning in WebInject? |
Reply Quote Notify of replies
|
| 9 |
General / User Forum / Re: webinjectGUI.exe crashed after installing Open |
Oct 10th, 2007, 12:26pm |
| Started by pongster | Last post by vanagaudi |
Jepp, you need to replace "libeay32.dll" and "ssleay32.dll" in %SYSTEMROOT%/system32/ directory. This had been the case on my XP installation. To identify working dll's: libeay32.dll, size 808 kB, date 28.01.2004 ssleay32.dll, size 156 kB, date 28.01.2004 I've found several different versions of libeay32.dll and size of 808 kB. I would like to attach them to this post, but don't know how. BR Helmut |
Reply Quote Notify of replies
|
Return to the board index.
|