Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions config/_default/menus/menus.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -698,10 +698,23 @@ main:
weight: 6
parent: "alerting"

## MONITORS - SLOs

- name: "Service Level Objectives"
url: "monitors/slos/"
url: "monitors/service_level_objectives/"
weight: 7
parent: "alerting"
identifier: "slos"

- name: "Monitor SLO"
url: "monitors/service_level_objectives/monitor/"
parent: "slos"
weight: 7.1

- name: "Event SLO"
url: "monitors/service_level_objectives/event/"
parent: "slos"
weight: 7.2

## MONITORS - Guides

Expand All @@ -710,8 +723,6 @@ main:
weight: 100
parent: "alerting"



#################
## TRACING/APM ##
#################
Expand Down
4 changes: 0 additions & 4 deletions config/_default/menus/menus.fr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,6 @@ main:
url: monitors/downtimes/
weight: 6
parent: alerting
- name: Service Level Objectives
url: monitors/slos/
weight: 7
parent: alerting
- name: Guides
url: monitors/guide/
weight: 100
Expand Down
9 changes: 2 additions & 7 deletions config/_default/menus/menus.ja.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ main:
url: "getting_started/integrations/"
parent: "getting_started"
weight: 3

## GETTING STARTED - Traces

- name: "トレースの収集"
Expand All @@ -30,7 +30,7 @@ main:
url: "getting_started/learning_center/"
parent: "getting_started"
weight: 6

- name: "Prometheus/Openmetrics"
identifier: "getting_started_prometheus"
url: "getting_started/integrations/prometheus"
Expand Down Expand Up @@ -562,11 +562,6 @@ main:
weight: 6
parent: "alerting"

- name: "SLO ウィジェット"
url: "monitors/slo_widget/"
weight: 7
parent: "alerting"

- name: "ガイド"
url: "monitors/guide/"
weight: 8
Expand Down
2 changes: 1 addition & 1 deletion content/en/agent/guide/python-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ f = open('textfile.txt', encoding='utf-8')
contents = f.read() # contents will be decoded to unicode using ‘utf-8’; these are not bytes!
```

Consult Ned Batchelder’s [Pragmatic Unicode][10] for further details.
Consult Ned Batchelder’s [Pragmatic Unicode][11] for further details.

### Print

Expand Down
5 changes: 5 additions & 0 deletions content/en/api/service_level_objectives/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Service Level Objectives
external_redirect: /api/
---

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from datadog import initialize, api

options = {
'api_key': '<YOUR_API_KEY>',
'app_key': '<YOUR_APP_KEY>'
}

slo_id_1 = '<YOUR_SLO_ID>'
slo_id_2 = '<YOUR_SLO_ID>'

initialize(**options)

delete_timeframes = {
slo_id_1: ["7d"]
slo_id_2: ["7d", "30d"]
}

api.ServiceLevelObjective.bulk_delete(delete_timeframes)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'rubygems'
require 'dogapi'

api_key = '<YOUR_API_KEY>'
app_key = '<YOUR_APP_KEY>'

slo_id_1 = '<YOUR_SLO_ID>'.freeze
slo_id_2 = '<YOUR_SLO_ID>'.freeze

dog = Dogapi::Client.new(api_key, app_key)

# Delete multiple timeframes
thresholds = {
slo_id_1: ["7d"]
slo_id_2: ["7d", "30d"]
}
dog.delete_timeframes_service_level_objective(thresholds)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
# Replace the API and APP keys below
# with the ones for your account

api_key=<YOUR_API_KEY>
app_key=<YOUR_APP_KEY>

# Bulk Delete SLOs
curl -X POST -H "Content-Type: application/json" \
-d '{"12341234123412341234123412341234": ["7d"], "43210000432100004321000043210000": ["30d"]}}' \
"https://api.datadoghq.com/api/v1/slo/bulk_delete?api_key=${api_key}&application_key=${app_key}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from datadog import initialize, api

options = {
'api_key': '<YOUR_API_KEY>',
'app_key': '<YOUR_APP_KEY>'
}

initialize(**options)

# Create a new SLO
thresholds = [
{"timeframe": "7d", "target": 95},
{"timeframe": "30d", "target": 95, "warning": 97},
]
tags = ["app:webserver", "frontend"]
api.ServiceLevelObjective.create(
type="metric",
name="Custom Metric SLO",
description="SLO tracking custom service SLO",
numerator="sum:my.custom.metric{type:good}.as_count()",
denominator="sum:my.custom.metric{*}.as_count()",
tags=tags,
thresholds=thresholds
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'rubygems'
require 'dogapi'

api_key = '<YOUR_API_KEY>'
app_key = '<YOUR_APP_KEY>'

dog = Dogapi::Client.new(api_key, app_key)

# Create a new SLO
thresholds = [
{:timeframe => "7d", :target => 95},
{:timeframe => "30d", :target => 95, :warning => 97},
]
tags = ['app:webserver', 'frontend']
dog.create_service_level_objective(
:type => "metric",
:name => "Custom Metric SLO",
:description => "SLO tracking custom service SLO",
:numerator => "sum:my.custom.metric{type:good}.as_count()",
:denominator => "sum:my.custom.metric{*}.as_count()",
:tags => tags,
:thresholds => thresholds
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
# Replace the API and APP keys below
# with the ones for your account

api_key=<YOUR_API_KEY>
app_key=<YOUR_APP_KEY>

curl -X POST -H "Content-type: application/json" \
-d '{
"type": "monitor",
"name": "Critical Foo Host Uptime",
"description": "Track the uptime of host foo which is critical to the core business.",
"tags": ["app:core", "kpi"],
"monitor_ids": [42],
"thresholds": [
{"timeframe": "30d", "target": 95, "warning": 98}
]
}' \
"https://api.datadoghq.com/api/v1/slo?api_key=${api_key}&application_key=${app_key}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from datadog import initialize, api

options = {
'api_key': '<YOUR_API_KEY>',
'app_key': '<YOUR_APP_KEY>'
}

slo_ids = ["<YOUR_SLO_ID>", "<YOUR_SLO_ID>"]

initialize(**options)

api.ServiceLevelObjective.delete_many(slo_ids)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'rubygems'
require 'dogapi'

api_key = '<YOUR_API_KEY>'
app_key = '<YOUR_APP_KEY>'
slo_ids = ['<YOUR_SLO_ID>', '<YOUR_SLO_ID>']

dog = Dogapi::Client.new(api_key, app_key)

# Delete multiple timeframes

dog.delete_many_service_level_objective(thresholds)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
# Replace the API and APP keys below
# with the ones for your account

api_key=<YOUR_API_KEY>
app_key=<YOUR_APP_KEY>
slo_ids=<YOUR_SLO_IDS_CSV>

# Delete a SLO
curl -X DELETE -H "Content-Type: applicaton/json" -d '[${slo_ids}]' \
"https://api.datadoghq.com/api/v1/slo/?api_key=${api_key}&application_key=${app_key}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from datadog import initialize, api

options = {
'api_key': '<YOUR_API_KEY>',
'app_key': '<YOUR_APP_KEY>'
}

slo_id = '<YOUR_SLO_ID>'

initialize(**options)

api.ServiceLevelObjective.delete(slo_id)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'rubygems'
require 'dogapi'

api_key = '<YOUR_API_KEY>'
app_key = '<YOUR_APP_KEY>'
slo_id = '<YOUR_SLO_ID>'

dog = Dogapi::Client.new(api_key, app_key)

dog.delete_service_level_objective(slo_id)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# Replace the API and APP keys below
# with the ones for your account

api_key=<YOUR_API_KEY>
app_key=<YOUR_APP_KEY>
slo_id=<YOUR_SLO_ID>

# Delete a SLO
curl -X DELETE "https://api.datadoghq.com/api/v1/slo/${slo_id}?api_key=${api_key}&application_key=${app_key}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from datadog import initialize, api

options = {
'api_key': '<YOUR_API_KEY>',
'app_key': '<YOUR_APP_KEY>'
}

slo_id = "<YOUR_SLO_ID>"

initialize(**options)

# Update an existing SLO (cannot change the 'type')

thresholds = [
{"timeframe": "7d", "target": 95},
{"timeframe": "30d", "target": 95, "warning": 97},
]
tags = ["app:webserver", "frontend"]
api.ServiceLevelObjective.update(
id=slo_id,
type="metric",
name="Custom Metric SLO",
description="SLO tracking custom service SLO",
numerator="sum:my.custom.metric{type:good}.as_count()",
denominator="sum:my.custom.metric{*}.as_count()",
tags=tags,
thresholds=thresholds
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'rubygems'
require 'dogapi'

api_key = '<YOUR_API_KEY>'
app_key = '<YOUR_APP_KEY>'
slo_id = '<YOUR_SLO_ID>'

dog = Dogapi::Client.new(api_key, app_key)

# Update an existing SLO (cannot change the 'type')
thresholds = [
{:timeframe => "7d", :target => 95},
{:timeframe => "30d", :target => 95, :warning => 97},
]
tags = ['app:webserver', 'frontend']

dog.update_service_level_objective(
slo_id,
:type => "metric",
:name => "Custom Metric SLO",
:description => "SLO tracking custom service SLO",
:numerator => "sum:my.custom.metric{type:good}.as_count()",
:denominator => "sum:my.custom.metric{*}.as_count()",
:tags => tags,
:thresholds => thresholds
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# Replace the API and APP keys below
# with the ones for your account

api_key=<YOUR_API_KEY>
app_key=<YOUR_APP_KEY>
slo_id=<YOUR_SLO_ID>

# Edit a SLO
curl -X PUT -H "Content-type: application/json" \
-d '{
"name": "Host0 uptime",
"description": "We may need to replace this host if it is constantly down."
}' \
"https://api.datadoghq.com/api/v1/slo/${slo_id}?api_key=${api_key}&application_key=${app_key}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from datadog import initialize, api

options = {
'api_key': '<YOUR_API_KEY>',
'app_key': '<YOUR_APP_KEY>'
}

slo_id = '<YOUR_SLO_ID>'

initialize(**options)

api.ServiceLevelObjective.get(slo_id)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'rubygems'
require 'dogapi'

api_key = '<YOUR_API_KEY>'
app_key = '<YOUR_APP_KEY>'
slo_id = '<YOUR_SLO_ID>'

dog = Dogapi::Client.new(api_key, app_key)

dog.get_service_level_objective(slo_id)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# Replace the API and APP keys below
# with the ones for your account

api_key=<YOUR_API_KEY>
app_key=<YOUR_APP_KEY>
slo_id=<YOUR_SLO_ID>

# Get a SLO
curl -X GET "https://api.datadoghq.com/api/v1/slo/${slo_id}?api_key=${api_key}&application_key=${app_key}"
Loading