Sha256: 9ff138b01831c580630a92acd7110e5e4096187f89fdef1b5ef3b4d1a7b1421e

Contents?: true

Size: 1.29 KB

Versions: 7

Compression:

Stored size: 1.29 KB

Contents

# Validate a multi-alert monitor returns "OK" response

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
datadog_api_client-2.9.0 examples/v1/monitors/ValidateMonitor_4247196452.rb
datadog_api_client-2.8.0 examples/v1/monitors/ValidateMonitor_4247196452.rb
datadog_api_client-2.7.0 examples/v1/monitors/ValidateMonitor_4247196452.rb
datadog_api_client-2.6.0 examples/v1/monitors/ValidateMonitor_4247196452.rb
datadog_api_client-2.5.0 examples/v1/monitors/ValidateMonitor_4247196452.rb
datadog_api_client-2.4.0 examples/v1/monitors/ValidateMonitor_4247196452.rb
datadog_api_client-2.3.0 examples/v1/monitors/ValidateMonitor_4247196452.rb