class Dogapi::Client

A simple DogAPI client

See Dogapi::V1 for the thick underlying clients

Class methods return a tuple of (response_code, response_body). Unless otherwise noted, the response body is deserialized JSON. Up-to-date information about the JSON object structure is available in the HTTP API documentation, here.

Attributes

datadog_host[RW]
v2[RW]

Public Class Methods

new(api_key, application_key=nil, host=nil, device=nil, silent=true, timeout=nil, endpoint=nil, skip_ssl_validation=false) click to toggle source

rubocop:disable Metrics/MethodLength, Metrics/LineLength

    # File lib/dogapi/facade.rb
 68 def initialize(api_key, application_key=nil, host=nil, device=nil, silent=true, timeout=nil, endpoint=nil, skip_ssl_validation=false)
 69 
 70   if api_key
 71     @api_key = api_key
 72   else
 73     raise 'Please provide an API key to submit your data'
 74   end
 75 
 76   @application_key = application_key
 77   @datadog_host = endpoint || Dogapi.find_datadog_host()
 78   @host = host || Dogapi.find_localhost()
 79   @device = device
 80 
 81   # FIXME: refactor to avoid all this code duplication
 82   @metric_svc = Dogapi::V1::MetricService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 83   @event_svc = Dogapi::V1::EventService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 84   @tag_svc = Dogapi::V1::TagService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 85   @comment_svc = Dogapi::V1::CommentService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 86   @search_svc = Dogapi::V1::SearchService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 87   @dash_service = Dogapi::V1::DashService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 88   @dashboard_service = Dogapi::V1::DashboardService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 89   @dashboard_list_service = Dogapi::V1::DashboardListService.new(
 90     @api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation
 91   )
 92   @alert_svc = Dogapi::V1::AlertService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 93   @user_svc = Dogapi::V1::UserService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 94   @snapshot_svc = Dogapi::V1::SnapshotService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 95   @embed_svc = Dogapi::V1::EmbedService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 96   @screenboard_svc = Dogapi::V1::ScreenboardService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 97   @monitor_svc = Dogapi::V1::MonitorService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 98   @synthetics_svc = Dogapi::V1::SyntheticsService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
 99   @service_check_svc = Dogapi::V1::ServiceCheckService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
100   @metadata_svc = Dogapi::V1::MetadataService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
101   @legacy_event_svc = Dogapi::EventService.new(@datadog_host)
102   @hosts_svc = Dogapi::V1::HostsService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
103   @integration_svc = Dogapi::V1::IntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
104   @aws_integration_svc = Dogapi::V1::AwsIntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
105   @aws_logs_svc = Dogapi::V1::AwsLogsService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
106   @usage_svc = Dogapi::V1::UsageService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
107   @azure_integration_svc = Dogapi::V1::AzureIntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
108   @gcp_integration_svc = Dogapi::V1::GcpIntegrationService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
109   @service_level_objective_svc = Dogapi::V1::ServiceLevelObjectiveService.new(@api_key, @application_key, silent,
110                                                                               timeout, @datadog_host, skip_ssl_validation)
111   @logs_pipeline_svc = Dogapi::V1::LogsPipelineService.new(@api_key, @application_key, silent, timeout, @datadog_host, skip_ssl_validation)
112 
113   # Support for Dashboard List API v2.
114   @v2 = Dogapi::ClientV2.new(@api_key, @application_key, true, true, @datadog_host, skip_ssl_validation)
115 
116 end

Public Instance Methods

add_items_to_dashboard_list(dashboard_list_id, dashboards) click to toggle source
    # File lib/dogapi/facade.rb
406 def add_items_to_dashboard_list(dashboard_list_id, dashboards)
407   @dashboard_list_service.add_items(dashboard_list_id, dashboards)
408 end
add_tags(host_id, tags, source=nil) click to toggle source

Add the tags to the given host

host_id can be the host's numeric id or string name

tags is and Array of Strings

    # File lib/dogapi/facade.rb
298 def add_tags(host_id, tags, source=nil)
299   @tag_svc.add(host_id, tags, source)
300 end
alert(query, options= {}) click to toggle source

ALERTS

    # File lib/dogapi/facade.rb
426 def alert(query, options= {})
427   @alert_svc.alert(query, options)
428 end
all_tags(source=nil) click to toggle source

Get all tags and their associated hosts at your org

    # File lib/dogapi/facade.rb
282 def all_tags(source=nil)
283   @tag_svc.get_all(source)
284 end
aws_integration_create(config) click to toggle source
    # File lib/dogapi/facade.rb
818 def aws_integration_create(config)
819   @aws_integration_svc.aws_integration_create(config)
820 end
aws_integration_delete(config) click to toggle source
    # File lib/dogapi/facade.rb
822 def aws_integration_delete(config)
823   @aws_integration_svc.aws_integration_delete(config)
824 end
aws_integration_generate_external_id(config) click to toggle source
    # File lib/dogapi/facade.rb
830 def aws_integration_generate_external_id(config)
831   @aws_integration_svc.aws_integration_generate_external_id(config)
832 end
aws_integration_list() click to toggle source

AWS INTEGRATION

    # File lib/dogapi/facade.rb
814 def aws_integration_list
815   @aws_integration_svc.aws_integration_list
816 end
aws_integration_list_namespaces() click to toggle source
    # File lib/dogapi/facade.rb
826 def aws_integration_list_namespaces
827   @aws_integration_svc.aws_integration_list_namespaces
828 end
aws_integration_update(config, new_config) click to toggle source
    # File lib/dogapi/facade.rb
834 def aws_integration_update(config, new_config)
835   @aws_integration_svc.aws_integration_update(config, new_config)
836 end
aws_logs_add_lambda(config) click to toggle source

AWS Logs Integration

    # File lib/dogapi/facade.rb
842 def aws_logs_add_lambda(config)
843   @aws_logs_svc.aws_logs_add_lambda(config)
844 end
aws_logs_check_lambda(config) click to toggle source
    # File lib/dogapi/facade.rb
862 def aws_logs_check_lambda(config)
863   @aws_logs_svc.aws_logs_check_lambda(config)
864 end
aws_logs_check_services(config) click to toggle source
    # File lib/dogapi/facade.rb
866 def aws_logs_check_services(config)
867   @aws_logs_svc.aws_logs_check_services(config)
868 end
aws_logs_integration_delete(config) click to toggle source
    # File lib/dogapi/facade.rb
858 def aws_logs_integration_delete(config)
859   @aws_logs_svc.aws_logs_integration_delete(config)
860 end
aws_logs_integrations_list() click to toggle source
    # File lib/dogapi/facade.rb
854 def aws_logs_integrations_list
855   @aws_logs_svc.aws_logs_integrations_list
856 end
aws_logs_list_services() click to toggle source
    # File lib/dogapi/facade.rb
846 def aws_logs_list_services
847   @aws_logs_svc.aws_logs_list_services
848 end
aws_logs_save_services(config) click to toggle source
    # File lib/dogapi/facade.rb
850 def aws_logs_save_services(config)
851   @aws_logs_svc.aws_logs_save_services(config)
852 end
azure_integration_create(config) click to toggle source
    # File lib/dogapi/facade.rb
878 def azure_integration_create(config)
879   @azure_integration_svc.azure_integration_create(config)
880 end
azure_integration_delete(config) click to toggle source
    # File lib/dogapi/facade.rb
882 def azure_integration_delete(config)
883   @azure_integration_svc.azure_integration_delete(config)
884 end
azure_integration_list() click to toggle source

AZURE INTEGRATION

    # File lib/dogapi/facade.rb
874 def azure_integration_list
875   @azure_integration_svc.azure_integration_list
876 end
azure_integration_update(config) click to toggle source
    # File lib/dogapi/facade.rb
890 def azure_integration_update(config)
891   @azure_integration_svc.azure_integration_update(config)
892 end
azure_integration_update_host_filters(config) click to toggle source
    # File lib/dogapi/facade.rb
886 def azure_integration_update_host_filters(config)
887   @azure_integration_svc.azure_integration_update_host_filters(config)
888 end
batch_metrics() { || ... } click to toggle source
    # File lib/dogapi/facade.rb
176 def batch_metrics()
177   @metric_svc.switch_to_batched
178   begin
179     yield
180     @metric_svc.flush_buffer # flush_buffer should returns the response from last API call
181   ensure
182     @metric_svc.switch_to_single
183   end
184 end
can_delete_monitors(monitor_ids) click to toggle source
    # File lib/dogapi/facade.rb
597 def can_delete_monitors(monitor_ids)
598   @monitor_svc.can_delete_monitors(monitor_ids)
599 end
can_delete_service_level_objective(slo_ids) click to toggle source
    # File lib/dogapi/facade.rb
705 def can_delete_service_level_objective(slo_ids)
706   @service_level_objective_svc.can_delete_service_level_objective(slo_ids)
707 end
cancel_downtime(downtime_id) click to toggle source
    # File lib/dogapi/facade.rb
657 def cancel_downtime(downtime_id)
658   @monitor_svc.cancel_downtime(downtime_id)
659 end
cancel_downtime_by_scope(scope) click to toggle source
    # File lib/dogapi/facade.rb
661 def cancel_downtime_by_scope(scope)
662   @monitor_svc.cancel_downtime_by_scope(scope)
663 end
comment(message, options= {}) click to toggle source

Post a comment

    # File lib/dogapi/facade.rb
254 def comment(message, options= {})
255   @comment_svc.comment(message, options)
256 end
create_board(title, widgets, layout_type, options= {}) click to toggle source

Create a dashboard.

    # File lib/dogapi/facade.rb
358 def create_board(title, widgets, layout_type, options= {})
359   @dashboard_service.create_board(title, widgets, layout_type, options)
360 end
create_dashboard(title, description, graphs, template_variables = nil, read_only = false) click to toggle source

Create a dashboard.

    # File lib/dogapi/facade.rb
329 def create_dashboard(title, description, graphs, template_variables = nil, read_only = false)
330   @dash_service.create_dashboard(title, description, graphs, template_variables, read_only)
331 end
create_dashboard_list(name) click to toggle source

DASHBOARD LISTS

    # File lib/dogapi/facade.rb
386 def create_dashboard_list(name)
387   @dashboard_list_service.create(name)
388 end
create_embed(graph_json, description= {}) click to toggle source
    # File lib/dogapi/facade.rb
495 def create_embed(graph_json, description= {})
496   @embed_svc.create_embed(graph_json, description)
497 end
create_integration(source_type_name, config) click to toggle source

INTEGRATIONS

    # File lib/dogapi/facade.rb
795 def create_integration(source_type_name, config)
796   @integration_svc.create_integration(source_type_name, config)
797 end
create_logs_pipeline(name, filter, options = {}) click to toggle source

LOGS PIPELINES

    # File lib/dogapi/facade.rb
725 def create_logs_pipeline(name, filter, options = {})
726   @logs_pipeline_svc.create_logs_pipeline(name, filter, options)
727 end
create_screenboard(description) click to toggle source

SCREENBOARD

    # File lib/dogapi/facade.rb
510 def create_screenboard(description)
511   @screenboard_svc.create_screenboard(description)
512 end
create_service_level_objective(type, slo_name, thresholds, options = {}) click to toggle source

SERVICE LEVEL OBJECTIVES

    # File lib/dogapi/facade.rb
685 def create_service_level_objective(type, slo_name, thresholds, options = {})
686   @service_level_objective_svc.create_service_level_objective(type, slo_name, thresholds, options)
687 end
create_synthetics_test(type, config, options = {}) click to toggle source

SYNTHETICS

    # File lib/dogapi/facade.rb
541 def create_synthetics_test(type, config, options = {})
542   @synthetics_svc.create_synthetics_test(type, config, options)
543 end
create_user(description= {}) click to toggle source
    # File lib/dogapi/facade.rb
459 def create_user(description= {})
460   @user_svc.create_user(description)
461 end
delete_alert(alert_id) click to toggle source
    # File lib/dogapi/facade.rb
438 def delete_alert(alert_id)
439   @alert_svc.delete_alert(alert_id)
440 end
delete_board(dashboard_id) click to toggle source

Delete the given dashboard.

    # File lib/dogapi/facade.rb
378 def delete_board(dashboard_id)
379   @dashboard_service.delete_board(dashboard_id)
380 end
delete_comment(comment_id) click to toggle source
    # File lib/dogapi/facade.rb
263 def delete_comment(comment_id)
264   @comment_svc.delete_comment(comment_id)
265 end
delete_dashboard(dash_id) click to toggle source

Delete the given dashboard.

    # File lib/dogapi/facade.rb
349 def delete_dashboard(dash_id)
350   @dash_service.delete_dashboard(dash_id)
351 end
delete_dashboard_list(dashboard_list_id) click to toggle source
    # File lib/dogapi/facade.rb
402 def delete_dashboard_list(dashboard_list_id)
403   @dashboard_list_service.delete(dashboard_list_id)
404 end
delete_event(id) click to toggle source

Delete an event

id of the event to delete

    # File lib/dogapi/facade.rb
217 def delete_event(id)
218   @event_svc.delete(id)
219 end
delete_integration(source_type_name) click to toggle source
    # File lib/dogapi/facade.rb
807 def delete_integration(source_type_name)
808   @integration_svc.delete_integration(source_type_name)
809 end
delete_items_from_dashboard_list(dashboard_list_id, dashboards) click to toggle source
    # File lib/dogapi/facade.rb
414 def delete_items_from_dashboard_list(dashboard_list_id, dashboards)
415   @dashboard_list_service.delete_items(dashboard_list_id, dashboards)
416 end
delete_logs_pipeline(pipeline_id) click to toggle source
    # File lib/dogapi/facade.rb
741 def delete_logs_pipeline(pipeline_id)
742   @logs_pipeline_svc.delete_logs_pipeline(pipeline_id)
743 end
delete_many_service_level_objective(slo_ids) click to toggle source
    # File lib/dogapi/facade.rb
713 def delete_many_service_level_objective(slo_ids)
714   @service_level_objective_svc.delete_many_service_level_objective(slo_ids)
715 end
delete_monitor(monitor_id, options = {}) click to toggle source
    # File lib/dogapi/facade.rb
601 def delete_monitor(monitor_id, options = {})
602   @monitor_svc.delete_monitor(monitor_id, options)
603 end
delete_screenboard(board_id) click to toggle source
    # File lib/dogapi/facade.rb
526 def delete_screenboard(board_id)
527   @screenboard_svc.delete_screenboard(board_id)
528 end
delete_service_level_objective(slo_id) click to toggle source
    # File lib/dogapi/facade.rb
709 def delete_service_level_objective(slo_id)
710   @service_level_objective_svc.delete_service_level_objective(slo_id)
711 end
delete_synthetics_tests(test_ids) click to toggle source
    # File lib/dogapi/facade.rb
549 def delete_synthetics_tests(test_ids)
550   @synthetics_svc.delete_synthetics_tests(test_ids)
551 end
delete_timeframes_service_level_objective(ops) click to toggle source
    # File lib/dogapi/facade.rb
717 def delete_timeframes_service_level_objective(ops)
718   @service_level_objective_svc.delete_timeframes_service_level_objective(ops)
719 end
detach_tags(host_id, source=nil) click to toggle source

Remove all tags from the given host

host_id can be the host's numeric id or string name

    # File lib/dogapi/facade.rb
320 def detach_tags(host_id, source=nil)
321   @tag_svc.detach(host_id, source)
322 end
detatch_tags(host_id) click to toggle source

DEPRECATED: Spelling mistake temporarily preserved as an alias.

    # File lib/dogapi/facade.rb
312 def detatch_tags(host_id)
313   warn '[DEPRECATION] Dogapi::Client.detatch() is deprecated. Use `detach` instead.'
314   detach_tags(host_id)
315 end
disable_user(handle) click to toggle source
    # File lib/dogapi/facade.rb
475 def disable_user(handle)
476   @user_svc.disable_user(handle)
477 end
emit_event(event, options= {}) click to toggle source

Record an event

Optional arguments:

:host        => String
:device      => String
    # File lib/dogapi/facade.rb
201 def emit_event(event, options= {})
202   scope = override_scope options
203 
204   @event_svc.post(event, scope)
205 end
emit_point(metric, value, options= {}) click to toggle source

Record a single point of metric data

Optional arguments:

:timestamp => Ruby stdlib Time
:host      => String
:device    => String
:options   => Map

options = “count” to specify a counter metric options = [“tag1”, “tag2”] to tag the point

    # File lib/dogapi/facade.rb
132 def emit_point(metric, value, options= {})
133   defaults = { :timestamp => Time.now }
134   options = defaults.merge(options)
135 
136   self.emit_points(
137     metric,
138     [[options[:timestamp], value]],
139     options
140   )
141 end
emit_points(metric, points, options= {}) click to toggle source

Record a set of points of metric data

points is an array of [Time, value] doubles

Optional arguments:

:host   => String
:device => String
:options   => Map

options = “count” to specify a counter metric options = [“tag1”, “tag2”] to tag the point

    # File lib/dogapi/facade.rb
154 def emit_points(metric, points, options= {})
155   scope = override_scope options
156 
157   points.each do |p|
158     p[0].kind_of? Time or raise 'Not a Time'
159     p[0] = p[0].to_i
160     p[1] = p[1].to_f # TODO: stupid to_f will never raise an exception
161   end
162 
163   @metric_svc.submit(metric, points, scope, options)
164 end
enable_embed(embed_id) click to toggle source
    # File lib/dogapi/facade.rb
499 def enable_embed(embed_id)
500   @embed_svc.enable_embed(embed_id)
501 end
gcp_integration_create(config) click to toggle source
    # File lib/dogapi/facade.rb
905 def gcp_integration_create(config)
906   @gcp_integration_svc.gcp_integration_create(config)
907 end
gcp_integration_delete(config) click to toggle source
    # File lib/dogapi/facade.rb
901 def gcp_integration_delete(config)
902   @gcp_integration_svc.gcp_integration_delete(config)
903 end
gcp_integration_list() click to toggle source

GCP INTEGRATION

    # File lib/dogapi/facade.rb
897 def gcp_integration_list
898   @gcp_integration_svc.gcp_integration_list
899 end
gcp_integration_update(config) click to toggle source
    # File lib/dogapi/facade.rb
909 def gcp_integration_update(config)
910   @gcp_integration_svc.gcp_integration_update(config)
911 end
get_active_metrics(from) click to toggle source

Get a list of active metrics since a given time from The seconds since the unix epoch [Time, Integer]

    # File lib/dogapi/facade.rb
189 def get_active_metrics(from)
190   @metric_svc.get_active_metrics(from)
191 end
get_alert(alert_id) click to toggle source
    # File lib/dogapi/facade.rb
434 def get_alert(alert_id)
435   @alert_svc.get_alert(alert_id)
436 end
get_all_alerts() click to toggle source
    # File lib/dogapi/facade.rb
442 def get_all_alerts()
443   @alert_svc.get_all_alerts()
444 end
get_all_boards() click to toggle source

Fetch all dashboards.

    # File lib/dogapi/facade.rb
373 def get_all_boards()
374   @dashboard_service.get_all_boards()
375 end
get_all_dashboard_lists() click to toggle source
    # File lib/dogapi/facade.rb
398 def get_all_dashboard_lists()
399   @dashboard_list_service.all()
400 end
get_all_downtimes(options= {}) click to toggle source
    # File lib/dogapi/facade.rb
665 def get_all_downtimes(options= {})
666   @monitor_svc.get_all_downtimes(options)
667 end
get_all_embeds() click to toggle source

EMBEDS

    # File lib/dogapi/facade.rb
487 def get_all_embeds()
488   @embed_svc.get_all_embeds()
489 end
get_all_logs_pipelines() click to toggle source
    # File lib/dogapi/facade.rb
733 def get_all_logs_pipelines
734   @logs_pipeline_svc.get_all_logs_pipelines
735 end
get_all_monitors(options= {}) click to toggle source
    # File lib/dogapi/facade.rb
605 def get_all_monitors(options= {})
606   @monitor_svc.get_all_monitors(options)
607 end
get_all_screenboards() click to toggle source
    # File lib/dogapi/facade.rb
522 def get_all_screenboards()
523   @screenboard_svc.get_all_screenboards()
524 end
get_all_synthetics_tests() click to toggle source
    # File lib/dogapi/facade.rb
557 def get_all_synthetics_tests
558   @synthetics_svc.get_all_synthetics_tests()
559 end
get_all_users() click to toggle source
    # File lib/dogapi/facade.rb
463 def get_all_users()
464   @user_svc.get_all_users()
465 end
get_board(dashboard_id) click to toggle source

Fetch the given dashboard.

    # File lib/dogapi/facade.rb
368 def get_board(dashboard_id)
369   @dashboard_service.get_board(dashboard_id)
370 end
get_custom_metrics_usage(start_hr, end_hr = nil) click to toggle source
    # File lib/dogapi/facade.rb
932 def get_custom_metrics_usage(start_hr, end_hr = nil)
933   @usage_svc.get_custom_metrics_usage(start_hr, end_hr)
934 end
get_dashboard(dash_id) click to toggle source

Fetch the given dashboard.

    # File lib/dogapi/facade.rb
339 def get_dashboard(dash_id)
340   @dash_service.get_dashboard(dash_id)
341 end
get_dashboard_list(dashboard_list_id) click to toggle source
    # File lib/dogapi/facade.rb
394 def get_dashboard_list(dashboard_list_id)
395   @dashboard_list_service.get(dashboard_list_id)
396 end
get_dashboards() click to toggle source

Fetch all of the dashboards.

    # File lib/dogapi/facade.rb
344 def get_dashboards
345   @dash_service.get_dashboards
346 end
get_downtime(downtime_id, options = {}) click to toggle source
    # File lib/dogapi/facade.rb
653 def get_downtime(downtime_id, options = {})
654   @monitor_svc.get_downtime(downtime_id, options)
655 end
get_embed(embed_id, description= {}) click to toggle source
    # File lib/dogapi/facade.rb
491 def get_embed(embed_id, description= {})
492   @embed_svc.get_embed(embed_id, description)
493 end
get_event(id) click to toggle source

Get the details of an event

id of the event to get

    # File lib/dogapi/facade.rb
210 def get_event(id)
211   @event_svc.get(id)
212 end
get_fargate_usage(start_hr, end_hr = nil) click to toggle source
    # File lib/dogapi/facade.rb
944 def get_fargate_usage(start_hr, end_hr = nil)
945   @usage_svc.get_fargate_usage(start_hr, end_hr)
946 end
get_hosts_usage(start_hr, end_hr = nil) click to toggle source

Get hourly usage information for different datadog service Usage data is delayed by up to 72 hours from when it was incurred. It is retained for the past 15 months.# format of dates is ISO-8601 UTC YYYY-MM-DDThh ex:

require 'time'
Time.now.utc.strftime('%Y-%m-%dT%H')

> “2019-05-05T13”

    # File lib/dogapi/facade.rb
924 def get_hosts_usage(start_hr, end_hr = nil)
925   @usage_svc.get_hosts_usage(start_hr, end_hr)
926 end
get_integration(source_type_name) click to toggle source
    # File lib/dogapi/facade.rb
803 def get_integration(source_type_name)
804   @integration_svc.get_integration(source_type_name)
805 end
get_items_of_dashboard_list(dashboard_list_id) click to toggle source
    # File lib/dogapi/facade.rb
418 def get_items_of_dashboard_list(dashboard_list_id)
419   @dashboard_list_service.get_items(dashboard_list_id)
420 end
get_logs_pipeline(pipeline_id) click to toggle source
    # File lib/dogapi/facade.rb
729 def get_logs_pipeline(pipeline_id)
730   @logs_pipeline_svc.get_logs_pipeline(pipeline_id)
731 end
get_logs_usage(start_hr, end_hr = nil) click to toggle source
    # File lib/dogapi/facade.rb
928 def get_logs_usage(start_hr, end_hr = nil)
929   @usage_svc.get_logs_usage(start_hr, end_hr)
930 end
get_metadata(metric) click to toggle source

Get metadata information on an existing Datadog metric

    # File lib/dogapi/facade.rb
758 def get_metadata(metric)
759   @metadata_svc.get(metric)
760 end
get_monitor(monitor_id, options= {}) click to toggle source
    # File lib/dogapi/facade.rb
593 def get_monitor(monitor_id, options= {})
594   @monitor_svc.get_monitor(monitor_id, options)
595 end
get_points(query, from, to) click to toggle source

Get a set of points by query between from and to

from The seconds since the unix epoch [Time, Integer] to The seconds since the unix epoch [Time, Integer] query The query string [String]

    # File lib/dogapi/facade.rb
172 def get_points(query, from, to)
173   @metric_svc.get(query, from, to)
174 end
get_screenboard(board_id) click to toggle source
    # File lib/dogapi/facade.rb
518 def get_screenboard(board_id)
519   @screenboard_svc.get_screenboard(board_id)
520 end
get_service_level_objective(slo_id) click to toggle source
    # File lib/dogapi/facade.rb
693 def get_service_level_objective(slo_id)
694   @service_level_objective_svc.get_service_level_objective(slo_id)
695 end
get_service_level_objective_history(slo_id, from_ts, to_ts) click to toggle source
    # File lib/dogapi/facade.rb
697 def get_service_level_objective_history(slo_id, from_ts, to_ts)
698   @service_level_objective_svc.get_service_level_objective_history(slo_id, from_ts, to_ts)
699 end
get_synthetics_devices() click to toggle source
    # File lib/dogapi/facade.rb
573 def get_synthetics_devices
574   @synthetics_svc.get_synthetics_devices()
575 end
get_synthetics_locations() click to toggle source
    # File lib/dogapi/facade.rb
577 def get_synthetics_locations
578   @synthetics_svc.get_synthetics_locations()
579 end
get_synthetics_result(test_id, result_id) click to toggle source
    # File lib/dogapi/facade.rb
569 def get_synthetics_result(test_id, result_id)
570   @synthetics_svc.get_synthetics_result(test_id, result_id)
571 end
get_synthetics_results(test_id) click to toggle source
    # File lib/dogapi/facade.rb
565 def get_synthetics_results(test_id)
566   @synthetics_svc.get_synthetics_results(test_id)
567 end
get_synthetics_test(test_id) click to toggle source
    # File lib/dogapi/facade.rb
561 def get_synthetics_test(test_id)
562   @synthetics_svc.get_synthetics_test(test_id)
563 end
get_synthetics_usage(start_hr, end_hr = nil) click to toggle source
    # File lib/dogapi/facade.rb
940 def get_synthetics_usage(start_hr, end_hr = nil)
941   @usage_svc.get_synthetics_usage(start_hr, end_hr)
942 end
get_traces_usage(start_hr, end_hr = nil) click to toggle source
    # File lib/dogapi/facade.rb
936 def get_traces_usage(start_hr, end_hr = nil)
937   @usage_svc.get_traces_usage(start_hr, end_hr)
938 end
get_user(handle) click to toggle source
    # File lib/dogapi/facade.rb
467 def get_user(handle)
468   @user_svc.get_user(handle)
469 end
graph_snapshot(metric_query, start_ts, end_ts, event_query=nil) click to toggle source

Graph snapshot

    # File lib/dogapi/facade.rb
480 def graph_snapshot(metric_query, start_ts, end_ts, event_query=nil)
481   @snapshot_svc.snapshot(metric_query, start_ts, end_ts, event_query)
482 end
host_tags(host_id, source=nil, by_source=false) click to toggle source

Get all tags for the given host

host_id can be the host's numeric id or string name

    # File lib/dogapi/facade.rb
289 def host_tags(host_id, source=nil, by_source=false)
290   @tag_svc.get(host_id, source, by_source)
291 end
host_totals() click to toggle source
    # File lib/dogapi/facade.rb
787 def host_totals()
788   @hosts_svc.totals()
789 end
invite(emails, options= {}) click to toggle source

User invite

    # File lib/dogapi/facade.rb
455 def invite(emails, options= {})
456   @user_svc.invite(emails, options)
457 end
monitor(type, query, options= {}) click to toggle source

MONITORS

    # File lib/dogapi/facade.rb
585 def monitor(type, query, options= {})
586   @monitor_svc.monitor(type, query, options)
587 end
mute_alerts() click to toggle source
    # File lib/dogapi/facade.rb
446 def mute_alerts()
447   @alert_svc.mute_alerts()
448 end
mute_host(hostname, options= {}) click to toggle source

HOST MUTING

    # File lib/dogapi/facade.rb
673 def mute_host(hostname, options= {})
674   @monitor_svc.mute_host(hostname, options)
675 end
mute_monitor(monitor_id, options= {}) click to toggle source
    # File lib/dogapi/facade.rb
621 def mute_monitor(monitor_id, options= {})
622   @monitor_svc.mute_monitor(monitor_id, options)
623 end
mute_monitors() click to toggle source
    # File lib/dogapi/facade.rb
613 def mute_monitors()
614   @monitor_svc.mute_monitors()
615 end
resolve_monitors(monitor_groups = [], options = {}, version = nil) click to toggle source
    # File lib/dogapi/facade.rb
629 def resolve_monitors(monitor_groups = [], options = {}, version = nil)
630   @monitor_svc.resolve_monitors(monitor_groups, options, version)
631 end
revoke_embed(embed_id) click to toggle source
    # File lib/dogapi/facade.rb
503 def revoke_embed(embed_id)
504   @embed_svc.revoke_embed(embed_id)
505 end
revoke_screenboard(board_id) click to toggle source
    # File lib/dogapi/facade.rb
534 def revoke_screenboard(board_id)
535   @screenboard_svc.revoke_screenboard(board_id)
536 end
schedule_downtime(scope, options= {}) click to toggle source

MONITOR DOWNTIME

    # File lib/dogapi/facade.rb
645 def schedule_downtime(scope, options= {})
646   @monitor_svc.schedule_downtime(scope, options)
647 end
search_hosts(options = {}) click to toggle source

HOSTS

    # File lib/dogapi/facade.rb
783 def search_hosts(options = {})
784   @hosts_svc.search(options)
785 end
search_monitor_groups(options = {}) click to toggle source
    # File lib/dogapi/facade.rb
637 def search_monitor_groups(options = {})
638   @monitor_svc.search_monitor_groups(options)
639 end
search_monitors(options = {}) click to toggle source
    # File lib/dogapi/facade.rb
633 def search_monitors(options = {})
634   @monitor_svc.search_monitors(options)
635 end
search_service_level_objective(slo_ids = nil, query = nil, offset = nil, limit = nil) click to toggle source
    # File lib/dogapi/facade.rb
701 def search_service_level_objective(slo_ids = nil, query = nil, offset = nil, limit = nil)
702   @service_level_objective_svc.search_service_level_objective(slo_ids, query, offset, limit)
703 end
service_check(check, host, status, options= {}) click to toggle source

SERVICE CHECKS

    # File lib/dogapi/facade.rb
749 def service_check(check, host, status, options= {})
750   @service_check_svc.service_check(check, host, status, options)
751 end
share_screenboard(board_id) click to toggle source
    # File lib/dogapi/facade.rb
530 def share_screenboard(board_id)
531   @screenboard_svc.share_screenboard(board_id)
532 end
start_event(event, options= {}) { || ... } click to toggle source

DEPRECATED: Recording events with a duration has been deprecated. The functionality will be removed in a later release.

    # File lib/dogapi/facade.rb
237 def start_event(event, options= {})
238   warn '[DEPRECATION] Dogapi::Client.start_event() is deprecated. Use `emit_event` instead.'
239   defaults = { :source_type => nil }
240   options = defaults.merge(options)
241 
242   scope = override_scope options
243 
244   @legacy_event_svc.start(@api_key, event, scope, options[:source_type]) do
245     yield
246   end
247 end
start_pause_synthetics_test(test_id, new_status) click to toggle source
    # File lib/dogapi/facade.rb
553 def start_pause_synthetics_test(test_id, new_status)
554   @synthetics_svc.start_pause_synthetics_test(test_id, new_status)
555 end
stream(start, stop, options= {}) click to toggle source

Get an optionally filtered event stream

start is a Time object for when to start the stream

stop is a Time object for when to end the stream

Optional arguments:

:priority   => "normal" or "low"
:sources    => String, see https://github.com/DataDog/dogapi/wiki/Event for a current list of sources
:tags       => Array of Strings
    # File lib/dogapi/facade.rb
231 def stream(start, stop, options= {})
232   @event_svc.stream(start, stop, options)
233 end
unmute_alerts() click to toggle source
    # File lib/dogapi/facade.rb
450 def unmute_alerts()
451   @alert_svc.unmute_alerts()
452 end
unmute_host(hostname) click to toggle source
    # File lib/dogapi/facade.rb
677 def unmute_host(hostname)
678   @monitor_svc.unmute_host(hostname)
679 end
unmute_monitor(monitor_id, options= {}) click to toggle source
    # File lib/dogapi/facade.rb
625 def unmute_monitor(monitor_id, options= {})
626   @monitor_svc.unmute_monitor(monitor_id, options)
627 end
unmute_monitors() click to toggle source
    # File lib/dogapi/facade.rb
617 def unmute_monitors()
618   @monitor_svc.unmute_monitors()
619 end
update_alert(alert_id, query, options= {}) click to toggle source
    # File lib/dogapi/facade.rb
430 def update_alert(alert_id, query, options= {})
431   @alert_svc.update_alert(alert_id, query, options)
432 end
update_board(dashboard_id, title, widgets, layout_type, options= {}) click to toggle source

Update a dashboard.

    # File lib/dogapi/facade.rb
363 def update_board(dashboard_id, title, widgets, layout_type, options= {})
364   @dashboard_service.update_board(dashboard_id, title, widgets, layout_type, options)
365 end
update_comment(comment_id, options= {}) click to toggle source

Post a comment

    # File lib/dogapi/facade.rb
259 def update_comment(comment_id, options= {})
260   @comment_svc.update_comment(comment_id, options)
261 end
update_dashboard(dash_id, title, description, graphs, template_variables = nil, read_only = false) click to toggle source

Update a dashboard.

    # File lib/dogapi/facade.rb
334 def update_dashboard(dash_id, title, description, graphs, template_variables = nil, read_only = false)
335   @dash_service.update_dashboard(dash_id, title, description, graphs, template_variables, read_only)
336 end
update_dashboard_list(dashboard_list_id, name) click to toggle source
    # File lib/dogapi/facade.rb
390 def update_dashboard_list(dashboard_list_id, name)
391   @dashboard_list_service.update(dashboard_list_id, name)
392 end
update_downtime(downtime_id, options= {}) click to toggle source
    # File lib/dogapi/facade.rb
649 def update_downtime(downtime_id, options= {})
650   @monitor_svc.update_downtime(downtime_id, options)
651 end
update_integration(source_type_name, config) click to toggle source
    # File lib/dogapi/facade.rb
799 def update_integration(source_type_name, config)
800   @integration_svc.update_integration(source_type_name, config)
801 end
update_items_of_dashboard_list(dashboard_list_id, dashboards) click to toggle source
    # File lib/dogapi/facade.rb
410 def update_items_of_dashboard_list(dashboard_list_id, dashboards)
411   @dashboard_list_service.update_items(dashboard_list_id, dashboards)
412 end
update_logs_pipeline(pipeline_id, name, filter, options = {}) click to toggle source
    # File lib/dogapi/facade.rb
737 def update_logs_pipeline(pipeline_id, name, filter, options = {})
738   @logs_pipeline_svc.update_logs_pipeline(pipeline_id, name, filter, options)
739 end
update_metadata(metric, options= {}) click to toggle source

Update metadata fields for an existing Datadog metric. If the metadata does not exist for the metric it is created by the update. Optional arguments:

:type             => String, type of the metric (ex. "gauge", "rate", etc.)
                     see http://docs.datadoghq.com/metrictypes/
:description      => String, description of the metric
:short_name       => String, short name of the metric
:unit             => String, unit type associated with the metric (ex. "byte", "operation")
                     see http://docs.datadoghq.com/units/ for full list
:per_unit         => String, per unit type (ex. "second" as in "queries per second")
                     see http://docs.datadoghq.com/units/ for full
:statsd_interval  => Integer, statsd flush interval for metric in seconds (if applicable)
    # File lib/dogapi/facade.rb
775 def update_metadata(metric, options= {})
776   @metadata_svc.update(metric, options)
777 end
update_monitor(monitor_id, query, options= {}) click to toggle source
    # File lib/dogapi/facade.rb
589 def update_monitor(monitor_id, query, options= {})
590   @monitor_svc.update_monitor(monitor_id, query, options)
591 end
update_screenboard(board_id, description) click to toggle source
    # File lib/dogapi/facade.rb
514 def update_screenboard(board_id, description)
515   @screenboard_svc.update_screenboard(board_id, description)
516 end
update_service_level_objective(slo_id, type, options = {}) click to toggle source
    # File lib/dogapi/facade.rb
689 def update_service_level_objective(slo_id, type, options = {})
690   @service_level_objective_svc.update_service_level_objective(slo_id, type, options)
691 end
update_synthetics_test(test_id, type, config, options = {}) click to toggle source
    # File lib/dogapi/facade.rb
545 def update_synthetics_test(test_id, type, config, options = {})
546   @synthetics_svc.update_synthetics_test(test_id, type, config, options)
547 end
update_tags(host_id, tags, source=nil) click to toggle source

Replace the tags on the given host

host_id can be the host's numeric id or string name

tags is and Array of Strings

    # File lib/dogapi/facade.rb
307 def update_tags(host_id, tags, source=nil)
308   @tag_svc.update(host_id, tags, source)
309 end
update_user(handle, description= {}) click to toggle source
    # File lib/dogapi/facade.rb
471 def update_user(handle, description= {})
472   @user_svc.update_user(handle, description)
473 end
validate_monitor(type, query, options= {}) click to toggle source
    # File lib/dogapi/facade.rb
609 def validate_monitor(type, query, options= {})
610   @monitor_svc.validate_monitor(type, query, options)
611 end

Private Instance Methods

override_scope(options= {}) click to toggle source
    # File lib/dogapi/facade.rb
950 def override_scope(options= {})
951   defaults = { :host => @host, :device => @device }
952   options = defaults.merge(options)
953   Scope.new(options[:host], options[:device])
954 end