WebService::DataDog::Alert - Interface to Alert functions in DataDog's API.
Version 0.8.0
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."
Retrieve details for all alerts.
my $alert = $datadog->build('Alert'); my $alert_list = $alert->retrieve_all();
Parameters: None
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:
query
Metric query to alert on.
name
Optional. Name of the alert. Default = dynamic, based on query.
message
Optional. A message to include with notifications for this alert. Email notifications can be sent to specific users by using the same '@username' notation as events.
silenced
Optional. Default = false. Whether the alert should notify by email and in the event stream. An alert with 'silenced' set to True is effectively muted. The alert will continue to detect state changes, but they will only be visible on the alert list page.
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 );
id
Id of alert you want to retrieve the details for.
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", );
ID of alert you want to modify.
Optional. Name of the alert.
Optional.Whether the alert should notify by email and in the event stream. An alert with 'silenced' set to True is effectively muted. The alert will continue to detect state changes, but they will only be visible on the alert list page.
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();
Unmute all alerts.
my $alert = $datadog->build('Alert'); $alert->unmute_all();
Delete specified alert.
my $alert = $datadog->build('Alert'); $alert->delete( id => $alert_id );
Dashboard id you want to delete.
Common error checking for creating/updating alerts.
Jennifer Pinkham, <jpinkham at cpan.org>.
<jpinkham at cpan.org>
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.
bug-WebService-DataDog at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc WebService::DataDog::Alert
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=WebService-DataDog
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/WebService-DataDog
CPAN Ratings
http://cpanratings.perl.org/d/WebService-DataDog
Search CPAN
http://search.cpan.org/dist/WebService-DataDog/
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.
To install WebService::DataDog, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::DataDog
CPAN shell
perl -MCPAN -e shell install WebService::DataDog
For more information on module installation, please visit the detailed CPAN module installation guide.