Sha256: 09588bacfcbb812816d9be5d7ef7d73ae80994848702f9d1b5a0f549eebf34a6

Contents?: true

Size: 1.98 KB

Versions: 17

Compression:

Stored size: 1.98 KB

Contents

# Create a new dashboard with a timeseries widget and an overlay request

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

body = DatadogAPIClient::V1::Dashboard.new({
  layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
  title: "Example-Dashboard",
  widgets: [
    DatadogAPIClient::V1::Widget.new({
      definition: DatadogAPIClient::V1::TimeseriesWidgetDefinition.new({
        type: DatadogAPIClient::V1::TimeseriesWidgetDefinitionType::TIMESERIES,
        requests: [
          DatadogAPIClient::V1::TimeseriesWidgetRequest.new({
            on_right_yaxis: false,
            queries: [
              DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({
                data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS,
                name: "mymetric",
                query: "avg:system.cpu.user{*}",
              }),
            ],
            response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::TIMESERIES,
            display_type: DatadogAPIClient::V1::WidgetDisplayType::LINE,
          }),
          DatadogAPIClient::V1::TimeseriesWidgetRequest.new({
            response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::TIMESERIES,
            queries: [
              DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({
                data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS,
                name: "mymetricoverlay",
                query: "avg:system.cpu.user{*}",
              }),
            ],
            style: DatadogAPIClient::V1::WidgetRequestStyle.new({
              palette: "purple",
              line_type: DatadogAPIClient::V1::WidgetLineType::SOLID,
              line_width: DatadogAPIClient::V1::WidgetLineWidth::NORMAL,
            }),
            display_type: DatadogAPIClient::V1::WidgetDisplayType::OVERLAY,
          }),
        ],
      }),
    }),
  ],
})
p api_instance.create_dashboard(body)

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
datadog_api_client-2.29.1 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.28.1 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.27.1 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.26.1 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.26.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.25.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.24.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.22.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.21.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.20.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.19.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.18.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.17.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.16.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.15.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.14.0 examples/v1/dashboards/CreateDashboard_2261785072.rb
datadog_api_client-2.13.0 examples/v1/dashboards/CreateDashboard_2261785072.rb