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
Public Class Methods
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
# 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
ALERTS
# File lib/dogapi/facade.rb 426 def alert(query, options= {}) 427 @alert_svc.alert(query, options) 428 end
# File lib/dogapi/facade.rb 818 def aws_integration_create(config) 819 @aws_integration_svc.aws_integration_create(config) 820 end
# File lib/dogapi/facade.rb 822 def aws_integration_delete(config) 823 @aws_integration_svc.aws_integration_delete(config) 824 end
# 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
# File lib/dogapi/facade.rb 814 def aws_integration_list 815 @aws_integration_svc.aws_integration_list 816 end
# File lib/dogapi/facade.rb 826 def aws_integration_list_namespaces 827 @aws_integration_svc.aws_integration_list_namespaces 828 end
# 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 Integration
# File lib/dogapi/facade.rb 842 def aws_logs_add_lambda(config) 843 @aws_logs_svc.aws_logs_add_lambda(config) 844 end
# File lib/dogapi/facade.rb 862 def aws_logs_check_lambda(config) 863 @aws_logs_svc.aws_logs_check_lambda(config) 864 end
# File lib/dogapi/facade.rb 866 def aws_logs_check_services(config) 867 @aws_logs_svc.aws_logs_check_services(config) 868 end
# File lib/dogapi/facade.rb 858 def aws_logs_integration_delete(config) 859 @aws_logs_svc.aws_logs_integration_delete(config) 860 end
# File lib/dogapi/facade.rb 854 def aws_logs_integrations_list 855 @aws_logs_svc.aws_logs_integrations_list 856 end
# File lib/dogapi/facade.rb 846 def aws_logs_list_services 847 @aws_logs_svc.aws_logs_list_services 848 end
# File lib/dogapi/facade.rb 850 def aws_logs_save_services(config) 851 @aws_logs_svc.aws_logs_save_services(config) 852 end
# File lib/dogapi/facade.rb 878 def azure_integration_create(config) 879 @azure_integration_svc.azure_integration_create(config) 880 end
# File lib/dogapi/facade.rb 882 def azure_integration_delete(config) 883 @azure_integration_svc.azure_integration_delete(config) 884 end
AZURE INTEGRATION
# File lib/dogapi/facade.rb 874 def azure_integration_list 875 @azure_integration_svc.azure_integration_list 876 end
# File lib/dogapi/facade.rb 890 def azure_integration_update(config) 891 @azure_integration_svc.azure_integration_update(config) 892 end
# 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
# 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
# File lib/dogapi/facade.rb 597 def can_delete_monitors(monitor_ids) 598 @monitor_svc.can_delete_monitors(monitor_ids) 599 end
# 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
# File lib/dogapi/facade.rb 657 def cancel_downtime(downtime_id) 658 @monitor_svc.cancel_downtime(downtime_id) 659 end
# File lib/dogapi/facade.rb 661 def cancel_downtime_by_scope(scope) 662 @monitor_svc.cancel_downtime_by_scope(scope) 663 end
Post a comment
# File lib/dogapi/facade.rb 254 def comment(message, options= {}) 255 @comment_svc.comment(message, options) 256 end
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 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
DASHBOARD LISTS
# File lib/dogapi/facade.rb 386 def create_dashboard_list(name) 387 @dashboard_list_service.create(name) 388 end
# File lib/dogapi/facade.rb 495 def create_embed(graph_json, description= {}) 496 @embed_svc.create_embed(graph_json, description) 497 end
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
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
SCREENBOARD
# File lib/dogapi/facade.rb 510 def create_screenboard(description) 511 @screenboard_svc.create_screenboard(description) 512 end
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
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
# File lib/dogapi/facade.rb 459 def create_user(description= {}) 460 @user_svc.create_user(description) 461 end
# File lib/dogapi/facade.rb 438 def delete_alert(alert_id) 439 @alert_svc.delete_alert(alert_id) 440 end
Delete the given dashboard.
# File lib/dogapi/facade.rb 378 def delete_board(dashboard_id) 379 @dashboard_service.delete_board(dashboard_id) 380 end
# File lib/dogapi/facade.rb 263 def delete_comment(comment_id) 264 @comment_svc.delete_comment(comment_id) 265 end
Delete the given dashboard.
# File lib/dogapi/facade.rb 349 def delete_dashboard(dash_id) 350 @dash_service.delete_dashboard(dash_id) 351 end
# File lib/dogapi/facade.rb 402 def delete_dashboard_list(dashboard_list_id) 403 @dashboard_list_service.delete(dashboard_list_id) 404 end
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
# File lib/dogapi/facade.rb 807 def delete_integration(source_type_name) 808 @integration_svc.delete_integration(source_type_name) 809 end
# 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
# File lib/dogapi/facade.rb 741 def delete_logs_pipeline(pipeline_id) 742 @logs_pipeline_svc.delete_logs_pipeline(pipeline_id) 743 end
# 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
# File lib/dogapi/facade.rb 601 def delete_monitor(monitor_id, options = {}) 602 @monitor_svc.delete_monitor(monitor_id, options) 603 end
# File lib/dogapi/facade.rb 526 def delete_screenboard(board_id) 527 @screenboard_svc.delete_screenboard(board_id) 528 end
# 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
# File lib/dogapi/facade.rb 549 def delete_synthetics_tests(test_ids) 550 @synthetics_svc.delete_synthetics_tests(test_ids) 551 end
# 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
# File lib/dogapi/facade.rb 475 def disable_user(handle) 476 @user_svc.disable_user(handle) 477 end
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
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
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
# File lib/dogapi/facade.rb 499 def enable_embed(embed_id) 500 @embed_svc.enable_embed(embed_id) 501 end
# File lib/dogapi/facade.rb 905 def gcp_integration_create(config) 906 @gcp_integration_svc.gcp_integration_create(config) 907 end
# File lib/dogapi/facade.rb 901 def gcp_integration_delete(config) 902 @gcp_integration_svc.gcp_integration_delete(config) 903 end
GCP INTEGRATION
# File lib/dogapi/facade.rb 897 def gcp_integration_list 898 @gcp_integration_svc.gcp_integration_list 899 end
# File lib/dogapi/facade.rb 909 def gcp_integration_update(config) 910 @gcp_integration_svc.gcp_integration_update(config) 911 end
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
# File lib/dogapi/facade.rb 434 def get_alert(alert_id) 435 @alert_svc.get_alert(alert_id) 436 end
# File lib/dogapi/facade.rb 442 def get_all_alerts() 443 @alert_svc.get_all_alerts() 444 end
Fetch all dashboards.
# File lib/dogapi/facade.rb 373 def get_all_boards() 374 @dashboard_service.get_all_boards() 375 end
# File lib/dogapi/facade.rb 398 def get_all_dashboard_lists() 399 @dashboard_list_service.all() 400 end
# File lib/dogapi/facade.rb 665 def get_all_downtimes(options= {}) 666 @monitor_svc.get_all_downtimes(options) 667 end
EMBEDS
# File lib/dogapi/facade.rb 487 def get_all_embeds() 488 @embed_svc.get_all_embeds() 489 end
# File lib/dogapi/facade.rb 733 def get_all_logs_pipelines 734 @logs_pipeline_svc.get_all_logs_pipelines 735 end
# File lib/dogapi/facade.rb 605 def get_all_monitors(options= {}) 606 @monitor_svc.get_all_monitors(options) 607 end
# File lib/dogapi/facade.rb 522 def get_all_screenboards() 523 @screenboard_svc.get_all_screenboards() 524 end
# File lib/dogapi/facade.rb 557 def get_all_synthetics_tests 558 @synthetics_svc.get_all_synthetics_tests() 559 end
# File lib/dogapi/facade.rb 463 def get_all_users() 464 @user_svc.get_all_users() 465 end
Fetch the given dashboard.
# File lib/dogapi/facade.rb 368 def get_board(dashboard_id) 369 @dashboard_service.get_board(dashboard_id) 370 end
# 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
Fetch the given dashboard.
# File lib/dogapi/facade.rb 339 def get_dashboard(dash_id) 340 @dash_service.get_dashboard(dash_id) 341 end
# File lib/dogapi/facade.rb 394 def get_dashboard_list(dashboard_list_id) 395 @dashboard_list_service.get(dashboard_list_id) 396 end
Fetch all of the dashboards.
# File lib/dogapi/facade.rb 344 def get_dashboards 345 @dash_service.get_dashboards 346 end
# File lib/dogapi/facade.rb 653 def get_downtime(downtime_id, options = {}) 654 @monitor_svc.get_downtime(downtime_id, options) 655 end
# File lib/dogapi/facade.rb 491 def get_embed(embed_id, description= {}) 492 @embed_svc.get_embed(embed_id, description) 493 end
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
# 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 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
# File lib/dogapi/facade.rb 803 def get_integration(source_type_name) 804 @integration_svc.get_integration(source_type_name) 805 end
# 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
# File lib/dogapi/facade.rb 729 def get_logs_pipeline(pipeline_id) 730 @logs_pipeline_svc.get_logs_pipeline(pipeline_id) 731 end
# 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 information on an existing Datadog metric
# File lib/dogapi/facade.rb 758 def get_metadata(metric) 759 @metadata_svc.get(metric) 760 end
# File lib/dogapi/facade.rb 593 def get_monitor(monitor_id, options= {}) 594 @monitor_svc.get_monitor(monitor_id, options) 595 end
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
# File lib/dogapi/facade.rb 518 def get_screenboard(board_id) 519 @screenboard_svc.get_screenboard(board_id) 520 end
# 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
# 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
# File lib/dogapi/facade.rb 573 def get_synthetics_devices 574 @synthetics_svc.get_synthetics_devices() 575 end
# File lib/dogapi/facade.rb 577 def get_synthetics_locations 578 @synthetics_svc.get_synthetics_locations() 579 end
# 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
# File lib/dogapi/facade.rb 565 def get_synthetics_results(test_id) 566 @synthetics_svc.get_synthetics_results(test_id) 567 end
# File lib/dogapi/facade.rb 561 def get_synthetics_test(test_id) 562 @synthetics_svc.get_synthetics_test(test_id) 563 end
# 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
# 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
# File lib/dogapi/facade.rb 467 def get_user(handle) 468 @user_svc.get_user(handle) 469 end
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
# File lib/dogapi/facade.rb 787 def host_totals() 788 @hosts_svc.totals() 789 end
User invite
# File lib/dogapi/facade.rb 455 def invite(emails, options= {}) 456 @user_svc.invite(emails, options) 457 end
MONITORS
# File lib/dogapi/facade.rb 585 def monitor(type, query, options= {}) 586 @monitor_svc.monitor(type, query, options) 587 end
# File lib/dogapi/facade.rb 446 def mute_alerts() 447 @alert_svc.mute_alerts() 448 end
HOST MUTING
# File lib/dogapi/facade.rb 673 def mute_host(hostname, options= {}) 674 @monitor_svc.mute_host(hostname, options) 675 end
# File lib/dogapi/facade.rb 621 def mute_monitor(monitor_id, options= {}) 622 @monitor_svc.mute_monitor(monitor_id, options) 623 end
# File lib/dogapi/facade.rb 613 def mute_monitors() 614 @monitor_svc.mute_monitors() 615 end
# 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
# File lib/dogapi/facade.rb 503 def revoke_embed(embed_id) 504 @embed_svc.revoke_embed(embed_id) 505 end
# File lib/dogapi/facade.rb 534 def revoke_screenboard(board_id) 535 @screenboard_svc.revoke_screenboard(board_id) 536 end
MONITOR DOWNTIME
# File lib/dogapi/facade.rb 645 def schedule_downtime(scope, options= {}) 646 @monitor_svc.schedule_downtime(scope, options) 647 end
Run the given search query.
# File lib/dogapi/facade.rb 272 def search(query) 273 @search_svc.search query 274 end
HOSTS
# File lib/dogapi/facade.rb 783 def search_hosts(options = {}) 784 @hosts_svc.search(options) 785 end
# File lib/dogapi/facade.rb 637 def search_monitor_groups(options = {}) 638 @monitor_svc.search_monitor_groups(options) 639 end
# File lib/dogapi/facade.rb 633 def search_monitors(options = {}) 634 @monitor_svc.search_monitors(options) 635 end
# 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 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
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
# 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
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
# File lib/dogapi/facade.rb 450 def unmute_alerts() 451 @alert_svc.unmute_alerts() 452 end
# File lib/dogapi/facade.rb 677 def unmute_host(hostname) 678 @monitor_svc.unmute_host(hostname) 679 end
# File lib/dogapi/facade.rb 625 def unmute_monitor(monitor_id, options= {}) 626 @monitor_svc.unmute_monitor(monitor_id, options) 627 end
# File lib/dogapi/facade.rb 617 def unmute_monitors() 618 @monitor_svc.unmute_monitors() 619 end
# 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 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
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 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
# 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
# File lib/dogapi/facade.rb 649 def update_downtime(downtime_id, options= {}) 650 @monitor_svc.update_downtime(downtime_id, options) 651 end
# File lib/dogapi/facade.rb 799 def update_integration(source_type_name, config) 800 @integration_svc.update_integration(source_type_name, config) 801 end
# 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
# 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 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
# File lib/dogapi/facade.rb 589 def update_monitor(monitor_id, query, options= {}) 590 @monitor_svc.update_monitor(monitor_id, query, options) 591 end
# File lib/dogapi/facade.rb 514 def update_screenboard(board_id, description) 515 @screenboard_svc.update_screenboard(board_id, description) 516 end
# 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
# 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
# File lib/dogapi/facade.rb 471 def update_user(handle, description= {}) 472 @user_svc.update_user(handle, description) 473 end
# 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
# 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