<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Matt,<br>
    <br>
    It would probably be easier to put all of the DataDog code right in
    an RT Action module rather than making a system call. If you take a
    look at the docs for this extension, it describes how to do that,
    where to put the new action files, etc.:<br>
    <br>
    <a class="moz-txt-link-freetext" href="https://metacpan.org/pod/RT::Extension::AdminConditionsAndActions">https://metacpan.org/pod/RT::Extension::AdminConditionsAndActions</a><br>
    <br>
    And it's worth installing that extension if you'll be working with
    custom conditions and actions because it makes it much easier to
    manage them.<br>
    <br>
    And if you're thinking about releasing it as an extension, this will
    get you started:<br>
    <br>
    <a class="moz-txt-link-freetext" href="https://bestpractical.com/docs/rt/4.2/writing_extensions.html">https://bestpractical.com/docs/rt/4.2/writing_extensions.html</a><br>
    <br>
    Good luck.<br>
    Jim<br>
    <br>
    <div class="moz-cite-prefix">On 1/28/16 1:26 PM, Matt Wells wrote:<br>
    </div>
    <blockquote
cite="mid:CAJ9FbdL5AG7-74_BH-ukKX+hQCOoz_a8dat-pHoaAYsoJDtkuA@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi all, so I have some things work on this. I'm
        wondering if anyone can help me with the last part. I really
        can't thank you guys enough for any help you can give.
        <div><br>
        </div>
        <div>So I have a custom scrip that's working if I run it maually
          but getting it through RT is causing issues. So this is what
          I've got.<br>
        </div>
        <div>
          <div>Condition: On Create</div>
          <div>Action: User defined</div>
          <div>Template: Blank</div>
          <div><br>
          </div>
          <div>Custom condition:<span class="" style="white-space:pre"> </span></div>
          <div>return 0;</div>
          <div><br>
          </div>
          <div>Custom action preparation code:<span class="" style="white-space:pre">   </span></div>
          <div>my $ticket = $self->TicketObj;</div>
          <div>my $subject = $Tickets->Subject;</div>
          <div>my $name = $requestor;</div>
          <div>my $queue = $queue</div>
          <div>system('/usr/bin/perl
            /opt/rt4/lib/RT/Action/DataDogEvent.pm $name $ticket
            "$subject" $ queue');</div>
          <div>return 1;</div>
          <div><br>
          </div>
          <div>Custom action commit code:<span class="" style="white-space:pre">        </span></div>
          <div>return 0;</div>
        </div>
        <div><br>
        </div>
        <div>The Script that's getting called. </div>
        <div>/opt/rt4/lib/RT/Action/DataDogEvent.pm<br>
        </div>
        <div>
          <div>#!/usr/bin/perl</div>
          <div><br>
          </div>
          <div>use strict;</div>
          <div>use warnings;</div>
          <div><br>
          </div>
          <div>use WebService::DataDog;</div>
          <div>use Try::Tiny;</div>
          <div>use Data::Dumper;</div>
          <div><br>
          </div>
          <div>my $datadog = WebService::DataDog->new(</div>
          <div>    api_key     => '123apikey',</div>
          <div>    application_key => '123appkey',</div>
          <div>    verbose     => 0, # Enable this for
            debugging output</div>
          <div>#<span class="" style="white-space:pre"> </span>verbose 
               => 1,</div>
          <div>);</div>
          <div><br>
          </div>
          <div>my $event = $datadog->build('Event');</div>
          <div>my $event_list;</div>
          <div><br>
          </div>
          <div>my $name  = $ARGV[0];</div>
          <div>my $ticket = $ARGV[1];</div>
          <div>my $subject = $ARGV[2];</div>
          <div>my $queue = $ARGV[3];</div>
          <div><br>
          </div>
          <div># Post a new event to stream</div>
          <div>$event->create(</div>
          <div><span class="" style="white-space:pre">  </span>title
            => "$name - $ticket",</div>
          <div><span class="" style="white-space:pre">  </span>text
            => "$subject",</div>
          <div><span class="" style="white-space:pre">  </span>tags =>
            ['NOCRT', "$queue"],</div>
          <div><br>
          </div>
          <div>);</div>
        </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, Jan 25, 2016 at 1:32 PM, Matt
          Wells <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:matt.wells@mosaic451.com" target="_blank">matt.wells@mosaic451.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div>
                <div dir="ltr">
                  <div>Has anyone ever attempted to integrate RT with
                    DataDog and it's web api or configurations?</div>
                  <div>I've seen some integrations with
                    "SendNagiosAlert" but was wondering if anyone had
                    done something similar with DataDog? I'm starting
                    to play with it now using this -</div>
                  <div><a moz-do-not-send="true"
href="http://search.cpan.org/%7Ejpinkham/WebService-DataDog-0.9.0/lib/WebService/DataDog.pm"
                      target="_blank">http://search.cpan.org/~jpinkham/WebService-DataDog-0.9.0/lib/WebService/DataDog.pm</a><br>
                  </div>
                  <div><br>
                  </div>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature">
          <div dir="ltr">
            <div>Matt Wells<br>
              Chief Systems Architect<br>
              <span style="font-size:12.8000001907349px">RHCA,</span>RHCVA
              - #110-000-353<br>
              (702) 808-0424<br>
              <a moz-do-not-send="true"
                href="mailto:matt.wells@mosaic451.com" target="_blank">matt.wells@mosaic451.com</a><br>
              Las Vegas | Phoenix | Portland Mosaic451.com <br>
              CONFIDENTIALITY NOTICE: This transmittal is a confidential
              communication or may otherwise be privileged. If you are
              not intended recipient, you are hereby notified that you
              have received this transmittal in error and that any
              review, dissemination, distribution or copying of this
              transmittal is strictly prohibited. If you have received
              this communication in error, please notify this office,
              and immediately delete this message and all its
              attachments, if any.<br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">
---------
RT 4.4 and RTIR Training Sessions (<a class="moz-txt-link-freetext" href="http://bestpractical.com/services/training.html">http://bestpractical.com/services/training.html</a>)
* Hamburg Germany  March 14 & 15, 2016</pre>
    </blockquote>
    <br>
  </body>
</html>