[rt-users] RT - DataDog Integration

Jim Brandt jbrandt at bestpractical.com
Thu Jan 28 13:43:43 EST 2016


Hi Matt,

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.:

https://metacpan.org/pod/RT::Extension::AdminConditionsAndActions

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.

And if you're thinking about releasing it as an extension, this will get 
you started:

https://bestpractical.com/docs/rt/4.2/writing_extensions.html

Good luck.
Jim

On 1/28/16 1:26 PM, Matt Wells wrote:
> 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.
>
> 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.
> Condition: On Create
> Action: User defined
> Template: Blank
>
> Custom condition:
> return 0;
>
> Custom action preparation code:
> my $ticket = $self->TicketObj;
> my $subject = $Tickets->Subject;
> my $name = $requestor;
> my $queue = $queue
> system('/usr/bin/perl /opt/rt4/lib/RT/Action/DataDogEvent.pm $name 
> $ticket "$subject" $ queue');
> return 1;
>
> Custom action commit code:
> return 0;
>
> The Script that's getting called.
> /opt/rt4/lib/RT/Action/DataDogEvent.pm
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use WebService::DataDog;
> use Try::Tiny;
> use Data::Dumper;
>
> my $datadog = WebService::DataDog->new(
>         api_key         => '123apikey',
>         application_key => '123appkey',
>         verbose         => 0, # Enable this for debugging output
> #verbose       => 1,
> );
>
> my $event = $datadog->build('Event');
> my $event_list;
>
> my $name   = $ARGV[0];
> my $ticket = $ARGV[1];
> my $subject = $ARGV[2];
> my $queue = $ARGV[3];
>
> # Post a new event to stream
> $event->create(
> title => "$name - $ticket",
> text  => "$subject",
> tags => ['NOCRT', "$queue"],
>
> );
>
>
> On Mon, Jan 25, 2016 at 1:32 PM, Matt Wells <matt.wells at mosaic451.com 
> <mailto:matt.wells at mosaic451.com>> wrote:
>
>     Has anyone ever attempted to integrate RT with DataDog and it's
>     web api or configurations?
>     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 -
>     http://search.cpan.org/~jpinkham/WebService-DataDog-0.9.0/lib/WebService/DataDog.pm
>     <http://search.cpan.org/%7Ejpinkham/WebService-DataDog-0.9.0/lib/WebService/DataDog.pm>
>
>
>
>
> -- 
> Matt Wells
> Chief Systems Architect
> RHCA, RHCVA - #110-000-353
> (702) 808-0424
> matt.wells at mosaic451.com <mailto:matt.wells at mosaic451.com>
>  Las Vegas | Phoenix | Portland Mosaic451.com
> 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.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ---------
> RT 4.4 and RTIR Training Sessions (http://bestpractical.com/services/training.html)
> * Hamburg Germany — March 14 & 15, 2016

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20160128/6615cef6/attachment.html>


More information about the rt-users mailing list