The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::DataDog::Event - Interface to Event functions in DataDog's API.

VERSION

Version 0.8.0

SYNOPSIS

This module allows you interact with the Event endpoint of the DataDog API.

Per DataDog: "The events service allows you to programatically post events to the stream and fetch events from the stream."

METHODS

search()

Search the event stream using specified parameters.

        my $event = $datadog->build('Event');
        my $event_list = $event->search(
                start     => $start_time,
                end       => $end_time, # Optional - default 'now'
                priority  => $priority, # Optional - low|normal
                sources   => $sources,  # Optional - list of sources. Ex: Datadog, Github, Pingdom, Webmetrics
                tags      => $tag_list, # Optional - list of tags associated with the event
        );
        
        Examples:
        + Find all events in the last 48 hours.
        my $event_list = $event->search(
                start => time() - ( 48 * 60 * 60 ),
        );
        
        + Find all events in the last 24 hours tagged with 'env:prod'.
        my $event_list = $event->search(
                start => time() - ( 24 * 60 * 60 ),
                end   => time(),
                tags  => [ 'env:prod' ],
        );
        

Parameters:

  • start

    The start of the date/time range to be searched. UNIX/Epoch/POSIX time.

  • end

    Optional. The end of the date/time range to be searched. UNIX/Epoch/POSIX time. Default = now.

  • priority

    Optional. Event priority level. Accepted values: low, normal.

  • sources

    Optional. List of sources that generated events.

  • tags

    Optional. List of tags associated with the events.

get_event()

Deprecated. Please use retrieve() instead.

retrieve()

Get details of specified event. NOTE: Receiving a 404 response likely means the requested event id does not exist.

        my $event = $datadog->build('Event');
        my $event_data = $event->retrieve( id => $event_id );

post_event()

Deprecated. Please use create() instead.

create()

Post event to DataDog event stream. This will overlay red areas on all dashboards, corresponding to each event. Example uses: code pushes, server/service restarts, etc.

Per DataDog: "This end point allows you to post events to the stream. You can tag them, set priority and event aggregate them with other events."

        my $event = $datadog->build('Event');
        $event->create(
                title            => $event_title,               
                text             => $event_text,  # Body/Description of the event.
                date_happened    => $timestamp,   # Optional, default "now"
                priority         => $priority,    # Optional. normal|low
                related_event_id => $event_id,    # Optional, id of aggregate event
                tags             => $tag_list,    # Optional - tags to apply to event (easy to search by)
                alert_type       => $alert_type,  # Optional. error|warning|info|success
                aggregation_key  => $agg_key,     # Optional. Arbitrary string to use for aggregation.
                source_type_name => $source_type, # Optional. nagios|hudson|jenkins|user|my apps|feed|chef|puppet|git|bitbucket|fabric|capistrano
        );
        
        Examples:
        + Submit a user event, with timestamp of `now`.
        $event->create(
                title            => 'Test event',
                text             => 'Testing posting to event stream',
                source_type_name => 'user',
        );
        

Parameters:

  • title

    The event title.

  • text

    Optional. Event body/description.

  • date_happened

    Optional. Default value 'now'. POSIX/Unix time.

  • priority

    Optional. Allowed values: normal, low.

  • related_event_id

    Optional. The id of the aggregate event.

  • tags

    Optional. List of tags associated with the event.

  • alert_type

    Optional. "error", "warning", "info" or "success"

  • aggregation_key

    Optional. An arbitrary string to use for aggregation.

  • source_type_name

    Optional. The type of event being posted. Allowed values: nagios, hudson, jenkins, user, my apps, feed, chef, puppet, git, bitbucket, fabric, capistrano

INTERNAL FUNCTIONS

_search_error_checks()

Error checking for search()

_create_error_checks()

Error checking for create()

AUTHOR

Jennifer Pinkham, <jpinkham at cpan.org>.

BUGS

Please report any bugs or feature requests to bug-WebService-DataDog at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WebService-DataDog. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

        perldoc WebService::DataDog::Event

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2013 Jennifer Pinkham.

This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License.

See http://dev.perl.org/licenses/ for more information.