Sha256: 816d334b6a4da60326e7af8d0997383bbbd0dc135cd64c7f614140991ca1589d

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 KB

Contents

# Validate an existing monitor returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::MonitorsAPI.new

# there is a valid "monitor" in the system
MONITOR_ID = ENV["MONITOR_ID"]

body = DatadogAPIClient::V1::Monitor.new({
  name: "Example-Validate_an_existing_monitor_returns_OK_response",
  type: DatadogAPIClient::V1::MonitorType::LOG_ALERT,
  query: 'logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2',
  message: "some message Notify: @hipchat-channel",
  tags: [
    "test:examplevalidateanexistingmonitorreturnsokresponse",
    "env:ci",
  ],
  priority: 3,
  options: DatadogAPIClient::V1::MonitorOptions.new({
    enable_logs_sample: true,
    escalation_message: "the situation has escalated",
    evaluation_delay: 700,
    groupby_simple_monitor: true,
    include_tags: true,
    locked: false,
    new_host_delay: 600,
    no_data_timeframe: nil,
    notify_audit: false,
    notify_no_data: false,
    renotify_interval: 60,
    require_full_window: true,
    timeout_h: 24,
    thresholds: DatadogAPIClient::V1::MonitorThresholds.new({
      critical: 2,
      warning: 1,
    }),
  }),
})
p api_instance.validate_existing_monitor(MONITOR_ID.to_i, body)

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
datadog_api_client-2.0.2 examples/v1/monitors/ValidateExistingMonitor.rb
datadog_api_client-2.0.1 examples/v1/monitors/ValidateExistingMonitor.rb
datadog_api_client-2.0.0 examples/v1/monitors/ValidateExistingMonitor.rb
datadog_api_client-1.11.0 examples/v1/monitors/ValidateExistingMonitor.rb
datadog_api_client-1.10.0 examples/v1/monitors/ValidateExistingMonitor.rb
datadog_api_client-1.9.0 examples/v1/monitors/ValidateExistingMonitor.rb