Sha256: a6580497caf108230c90894861802cbd767d671a94847e02f4f66b00505f5e05

Contents?: true

Size: 1.95 KB

Versions: 17

Compression:

Stored size: 1.95 KB

Contents

# Create a RUM formula and functions monitor returns "OK" response

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

body = DatadogAPIClient::V1::Monitor.new({
  name: "Example-Create_a_RUM_formula_and_functions_monitor_returns_OK_response",
  type: DatadogAPIClient::V1::MonitorType::RUM_ALERT,
  query: 'formula("query2 / query1 * 100").last("15m") >= 0.8',
  message: "some message Notify: @hipchat-channel",
  tags: [
    "test:examplecreatearumformulaandfunctionsmonitorreturnsokresponse",
    "env:ci",
  ],
  priority: 3,
  options: DatadogAPIClient::V1::MonitorOptions.new({
    thresholds: DatadogAPIClient::V1::MonitorThresholds.new({
      critical: 0.8,
    }),
    variables: [
      DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinition.new({
        data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventsDataSource::RUM,
        name: "query2",
        search: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionSearch.new({
          query: "",
        }),
        indexes: [
          "*",
        ],
        compute: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionCompute.new({
          aggregation: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventAggregation::COUNT,
        }),
        group_by: [],
      }),
      DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinition.new({
        data_source: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventsDataSource::RUM,
        name: "query1",
        search: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionSearch.new({
          query: "status:error",
        }),
        indexes: [
          "*",
        ],
        compute: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventQueryDefinitionCompute.new({
          aggregation: DatadogAPIClient::V1::MonitorFormulaAndFunctionEventAggregation::COUNT,
        }),
        group_by: [],
      }),
    ],
  }),
})
p api_instance.create_monitor(body)

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
datadog_api_client-2.9.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-2.8.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-2.7.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-2.6.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-2.5.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-2.4.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-2.3.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-2.2.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-2.1.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-2.0.2 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-2.0.1 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-2.0.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-1.11.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-1.10.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-1.9.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-1.8.0 examples/v1/monitors/CreateMonitor_3883669300.rb
datadog_api_client-1.7.0 examples/v1/monitors/CreateMonitor_3883669300.rb