<span style>Hi There,</span><div style><br></div><div style>I am having very strange problems creating a nagios plugin in Bash using check_http to check contents of a Amazon S3 Bucket.</div><div style><br></div><div style>
I am grabbing the URL of the file to grab from a txt file (changes often) inside the bucket and using awk and grep extracting the Filename.</div><div style><br></div><div style>I have using the following syntax:</div><div style>
<br></div><div style>check_http -H <a href="http://myhost.com/" target="_blank" style="color:rgb(17,85,204)">myhost.com</a> -N -v -u /testing.exe</div><div style><br></div><div style>Now this works fine when I run from the command line it also works fine when running from the bash script. The problem lies when I try the use the variable extracted using awk.</div>
<div style><br></div><div style>Here are the results of running my bash script :</div><div style><br></div><div style><div>is 135 <a href="http://charactersktdfde.co.uk/SetupddfImporter1020.exe" target="_blank" style="color:rgb(17,85,204)">charactersktdfde.co.uk:80/SetupddfImporter1020.exe</a></div>
<div>STATUS: HTTP/1.1 400 Bad Request</div><div>**** HEADER ****</div><div>Transfer-Encoding: chunked</div><div>Date: Tue, 10 Apr 2012 21:47:21 GMT</div><div>Connection: close</div><div>Server: AmazonS3</div><div>**** CONTENT ****</div>
<div> [[ skipped ]]</div><div>HTTP WARNING: HTTP/1.1 400 Bad Request - 135 bytes in 0.027 second response time |time=0.027087s;;;0.000000 size=135B;;;0</div></div><div style><br></div><div style>Here is what should appear:</div>
<div style><br></div><div style><div><a href="http://update.efefktdfde.co.uk/SetupddfImporter1020.exe" target="_blank" style="color:rgb(17,85,204)">http://update.efefktdfde.co.uk:80/SetupddfImporter1020.exe</a> is 1460 characters</div>
<div>STATUS: HTTP/1.1 200 OK</div><div>**** HEADER ****</div><div>x-amz-id-2: lmJo9jgflJdp+ehTirekL19lXFY5KsNJ13UkiSWlNjiWzeYtVJ1OX7VIDZrsMNUJ</div><div>x-amz-request-id: 7D72700CDF05E228</div><div>Date: Tue, 10 Apr 2012 21:47:13 GMT</div>
<div>x-amz-meta-cb-modifiedtime: Fri, 07 Oct 2011 03:36:32 GMT</div><div>Last-Modified: Mon, 24 Oct 2011 20:41:44 GMT</div><div>ETag: "ca684ddfa09409f8890e8c92bc68f619"</div><div>Accept-Ranges: bytes</div><div>
Content-Type: application/octet-stream</div>
<div>Content-Length: 6056760</div><div>Server: AmazonS3</div><div>**** CONTENT ****</div><div> [[ skipped ]]</div><div>HTTP OK: HTTP/1.1 200 OK - 1460 bytes in 0.122 second response time |time=0.122165s;;;0.000000 size=1460B;;;0</div>
<div><br></div></div><div style>In the bash script I am using the syntax:</div><div style><br></div><div style><div>test=$(cat /tmp/updates.txt | grep ServerFileName | awk 'BEGIN{FS="="}{print $2}' | grep HHR)</div>
</div><div style>command="$check_http -v -N -H <a href="http://update.efefktdfde.co.uk/" target="_blank" style="color:rgb(17,85,204)">update.efefktdfde.co.uk</a> -u"/"$test"</div><div style><br></div>
<div style>
If I just do test=SetupddfImporter1020.exe then call command it works fine, so I would think its my variable however if I run a If statement to check if the one generating by the awk command is the same as test=SetupddfImporter1020.exe it says they are equal/</div>
<div style><br></div><div style>This is driving me round the bend, any help would be much appreciated!!</div>