Hi Monks!

My Perl-fu is severely lacking, but I was hoping I could turn to all of you to help me with some monitoring I'm trying to get working on a Nagios box. I know how the cURL scripts should look, but I'm having trouble with getting PERL to run these as a monitoring job. Essentially the flow goes like this:

1) POST command calls an SSO service with a user/pass

2) That SSO token then gets inserted into the header of the request of the subsequent URL

3) The API spits back data

Simple enough, right?

My cURL scripts run like so:

curl -v -X POST -d "username=testusergoeshere@gmail.com&password=somec +oolpassword" https://xxxx.xxxxx.com/PathtotheSSOTool (out spits the token) curl -v -X GET --header "TOKEN: xxxxxxxxxxxxxxxxxxxxxxxxxxxx.*xxxxxxxx +xxxxxxxxxxxxx..*" http://url.of.the/api/call

Then, I'd like to be able to capture whatever the browser would spit back into a .log file. If it has stuff in it, great! If it returns with ERROR, we want it to alarm.

Easy enough, but I'm totally stuck on how to get started here. Any thoughts?


In reply to cURL scripts to monitor an API by jim.fazzone.5i

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.