Jennifer Pinkham > WebService-DataDog-0.9.0 > WebService::DataDog::Alert

Download:
WebService-DataDog-0.9.0.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: v0.9.0   Source   Latest Release: WebService-DataDog-1.0.0

NAME ^

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

VERSION ^

Version 0.9.0

SYNOPSIS ^

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

Per DataDog: "Alerts allow you to watch a particular metric query and receive a notification when the value either exceeds or falls below the pre-defined threshold."

METHODS ^

retrieve_all()

Retrieve details for all alerts.

        my $alert = $datadog->build('Alert');
        my $alert_list = $alert->retrieve_all();

Parameters: None

create()

Create new DataDog alert for specified metric query. If successful, returns created alert id.

NOTE: 'silenced' seems to have no effect in create mode, but works fine in update/edit mode.

        my $alert = $datadog->build('Alert');
        my $alert_id = $alert->create(
                query    => $query,      # Metric query to alert on
                name     => $alert_name, # Optional. default=dynamic, based on query
                message  => $message,    # Optional. default=None
                silenced => $boolean,    # Optional. default=0
        );
        
        Example:
        my $alert_id = $alert->create(
                        query    => "sum(last_1d):sum:system.net.bytes_rcvd{host:host0} > 100",
                        name     => "Bytes received on host0",
                        message  => "We may need to add web hosts if this is consistently high.",
                );

Parameters:

retrieve()

Retrieve details for specified alert. NOTE: a 404 response typically indicates you specified an incorrect alert id.

        my $alert = $datadog->build('Alert');
        my $alert_data = $alert->retrieve( id => $alert_id );

Parameters:

update()

Update existing DataDog alert for specified alert id. NOTE: a 404 response typically indicates you specified an incorrect alert id.

        my $alert = $datadog->build('Alert');
        $alert->update(
                id       => $alert_id,   # ID of alert to modify
                query    => $query,      # Metric query to alert on
                name     => $alert_name, # Optional.
                message  => $message,    # Optional.
                silenced => $boolean,    # Optional.
        );
        
        Example:
        # Change name of existing alert
        $alert->update(
                id    => $alert_id,
                name  => "Bytes received on host0",
        );

Parameters:

mute_all()

Mute all alerts. "Muting will prevent all alerts from notifying through email and posts to the event stream. State changes will only be visible by checking the alert page."

        my $alert = $datadog->build('Alert');
        $alert->mute_all();

Parameters: None

unmute_all()

Unmute all alerts.

        my $alert = $datadog->build('Alert');
        $alert->unmute_all();

Parameters: None

delete()

Delete specified alert.

        my $alert = $datadog->build('Alert');
        $alert->delete( id => $alert_id );

Parameters:

INTERNAL FUNCTIONS ^

_error_checks()

Common error checking for creating/updating alerts.

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

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.

syntax highlighting: