Sha256: 398554a8c4693b5f36d8e6fed9da2095dce627d2abe2de28f115117775e05e64

Contents?: true

Size: 1.21 KB

Versions: 12

Compression:

Stored size: 1.21 KB

Contents

# Create a metric monitor with a custom schedule returns "OK" response

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

body = DatadogAPIClient::V1::Monitor.new({
  message: "some message Notify: @hipchat-channel",
  name: "Example-Monitor",
  query: "avg(current_1mo):avg:system.load.5{*} > 0.5",
  tags: [],
  options: DatadogAPIClient::V1::MonitorOptions.new({
    thresholds: DatadogAPIClient::V1::MonitorThresholds.new({
      critical: 0.5,
    }),
    notify_audit: false,
    include_tags: false,
    scheduling_options: DatadogAPIClient::V1::MonitorOptionsSchedulingOptions.new({
      evaluation_window: DatadogAPIClient::V1::MonitorOptionsSchedulingOptionsEvaluationWindow.new({
        day_starts: "04:00",
        month_starts: 1,
      }),
      custom_schedule: DatadogAPIClient::V1::MonitorOptionsCustomSchedule.new({
        recurrences: [
          DatadogAPIClient::V1::MonitorOptionsCustomScheduleRecurrence.new({
            rrule: "FREQ=DAILY;INTERVAL=1",
            timezone: "America/Los_Angeles",
            start: "2024-10-26T09:13:00",
          }),
        ],
      }),
    }),
  }),
  type: DatadogAPIClient::V1::MonitorType::QUERY_ALERT,
})
p api_instance.create_monitor(body)

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
datadog_api_client-2.28.1 examples/v1/monitors/CreateMonitor_1539578087.rb
datadog_api_client-2.27.1 examples/v1/monitors/CreateMonitor_1539578087.rb
datadog_api_client-2.26.1 examples/v1/monitors/CreateMonitor_1539578087.rb
datadog_api_client-2.26.0 examples/v1/monitors/CreateMonitor_1539578087.rb
datadog_api_client-2.25.0 examples/v1/monitors/CreateMonitor_1539578087.rb
datadog_api_client-2.24.0 examples/v1/monitors/CreateMonitor_1539578087.rb
datadog_api_client-2.22.0 examples/v1/monitors/CreateMonitor_1539578087.rb
datadog_api_client-2.21.0 examples/v1/monitors/CreateMonitor_1539578087.rb
datadog_api_client-2.20.0 examples/v1/monitors/CreateMonitor_1539578087.rb
datadog_api_client-2.19.0 examples/v1/monitors/CreateMonitor_1539578087.rb
datadog_api_client-2.18.0 examples/v1/monitors/CreateMonitor_1539578087.rb
datadog_api_client-2.17.0 examples/v1/monitors/CreateMonitor_1539578087.rb