イベントサービスを使用すると、プログラムでイベントをイベントストリームにポストしたり、イベントストリームから取得することができます。イベントは 4000 文字に制限されています。4000 文字を超えるメッセージを含むイベントが送信された場合は、最初の 4000 文字だけが表示されます。
GET https://api.datadoghq.eu/api/v1/events/{event_id}https://api.ddog-gov.com/api/v1/events/{event_id}https://api.datadoghq.com/api/v1/events/{event_id}https://api.us3.datadoghq.com/api/v1/events/{event_id}
このエンドポイントを使用して、イベント詳細に対するクエリを発行できます。
注: クエリ対象のイベントに何らかのマークダウン形式が含まれている場合は、
出力に %
、\
、n
などの文字が表示される場合があります。
名前
種類
説明
event_id [required]
integer
The ID of the event.
OK
Object containing an event response.
フィールド
種類
説明
event
object
Object representing an event.
alert_type
enum
If an alert event is enabled, set its type.
For example, error
, warning
, info
, success
, user_update
,
recommendation
, and snapshot
.
Allowed enum values: error,warning,info,success,user_update,recommendation,snapshot
date_happened
int64
POSIX timestamp of the event. Must be sent as an integer (i.e. no quotes). Limited to events no older than 7 days.
device_name
string
A device name.
host
string
Host name to associate with the event. Any tags associated with the host are also applied to this event.
id
int64
Integer ID of the event.
payload
string
Payload of the event.
priority
enum
The priority of the event. For example, normal
or low
.
Allowed enum values: normal,low
source_type_name
string
The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. A complete list of source attribute values available here.
tags
[string]
A list of tags to apply to the event.
text
string
The body of the event. Limited to 4000 characters. The text supports markdown.
To use markdown in the event text, start the text block with %%% \n
and end the text block with \n %%%
.
Use msg_text
with the Datadog Ruby library.
title
string
The event title. Limited to 100 characters. Use msg_title
with the Datadog Ruby library.
url
string
URL of the event.
status
string
A status.
{
"event": {
"alert_type": "info",
"date_happened": "integer",
"device_name": "string",
"host": "string",
"id": "integer",
"payload": "{}",
"priority": "normal",
"source_type_name": "string",
"tags": [
"environment:test"
],
"text": "Oh boy!",
"title": "Did you hear the news today?",
"url": "string"
},
"status": "string"
}
Authentication Error
Error response object.
{
"errors": [
"Bad Request"
]
}
Item Not Found
Error response object.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export event_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/events/${event_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := datadog.NewDefaultContext(context.Background())
eventId := int64(789) // int64 | The ID of the event.
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
resp, r, err := apiClient.EventsApi.GetEvent(ctx, eventId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `EventsApi.GetEvent``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetEvent`: EventResponse
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from EventsApi.GetEvent:\n%s\n", responseContent)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.EventsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
EventsApi apiInstance = new EventsApi(defaultClient);
Long eventId = 56L; // Long | The ID of the event.
try {
EventResponse result = apiInstance.getEvent(eventId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EventsApi#getEvent");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
java "Example.java"
from datadog import initialize, api
options = {
'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'
}
initialize(**options)
api.Event.get(2603387619536318140)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
python "example.py"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import events_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = events_api.EventsApi(api_client)
event_id = 1 # int | The ID of the event.
# example passing only required values which don't have defaults set
try:
# Get an event
api_response = api_instance.get_event(event_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling EventsApi->get_event: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
python3 "example.py"
require 'rubygems'
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
dog = Dogapi::Client.new(api_key, app_key)
event_id = '1375909614428331251'
dog.get_event(event_id)
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
rb "example.rb"
require 'datadog_api_client'
api_instance = DatadogAPIClient::V1::EventsAPI.new
event_id = 789 # Integer | The ID of the event.
begin
# Get an event
result = api_instance.get_event(event_id)
p result
rescue DatadogAPIClient::V1::APIError => e
puts "Error when calling EventsAPI->get_event: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
rb "example.rb"
POST https://api.datadoghq.eu/api/v1/eventshttps://api.ddog-gov.com/api/v1/eventshttps://api.datadoghq.com/api/v1/eventshttps://api.us3.datadoghq.com/api/v1/events
このエンドポイントを使用して、イベントをストリームにポストできます。 イベントにタグ付けし、優先度を設定し、他のイベントと統合します。
イベントリクエストオブジェクト
{
"aggregation_key": "string",
"alert_type": "info",
"date_happened": "integer",
"device_name": "string",
"host": "string",
"priority": "normal",
"related_event_id": "integer",
"source_type_name": "string",
"tags": [
"environment:test"
],
"text": "Oh boy!",
"title": "Did you hear the news today?"
}
OK
Object containing an event response.
{
"alert_type": "info",
"date_happened": "integer",
"device_name": "string",
"host": "string",
"id": "integer",
"payload": "{}",
"priority": "normal",
"related_event_id": "integer",
"source_type_name": "string",
"status": "string",
"tags": [
"environment:test"
],
"text": "Oh boy!",
"title": "Did you hear the news today?",
"url": "string"
}
Bad Request
Error response object.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/events" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"text": "Oh boy!",
"title": "Did you hear the news today?"
}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := datadog.NewDefaultContext(context.Background())
body := *datadog.NewEventCreateRequest("Oh boy!", "Did you hear the news today?") // EventCreateRequest | Event request object
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
resp, r, err := apiClient.EventsApi.CreateEvent(ctx).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `EventsApi.CreateEvent``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateEvent`: EventCreateResponse
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from EventsApi.CreateEvent:\n%s\n", responseContent)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.EventsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
EventsApi apiInstance = new EventsApi(defaultClient);
EventCreateRequest body = new EventCreateRequest(); // EventCreateRequest | Event request object
try {
EventCreateResponse result = apiInstance.createEvent(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EventsApi#createEvent");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
java "Example.java"
from datadog import initialize, api
options = {
'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'
}
initialize(**options)
title = "Something big happened!"
text = 'And let me tell you all about it here!'
tags = ['version:1', 'application:web']
api.Event.create(title=title, text=text, tags=tags)
# If you are programmatically adding a comment to this new event
# you might want to insert a pause of .5 - 1 second to allow the
# event to be available.
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
python "example.py"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import events_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = events_api.EventsApi(api_client)
body = EventCreateRequest(
aggregation_key="aggregation_key_example",
alert_type=EventAlertType("info"),
date_happened=1,
device_name="device_name_example",
host="host_example",
id=1,
payload="{}",
priority=EventPriority("normal"),
related_event_id=1,
source_type_name="source_type_name_example",
tags=["environment:test"],
text="Oh boy!",
title="Did you hear the news today?",
url="url_example",
) # EventCreateRequest | Event request object
# example passing only required values which don't have defaults set
try:
# Post an event
api_response = api_instance.create_event(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling EventsApi->create_event: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
python3 "example.py"
require 'rubygems'
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
dog = Dogapi::Client.new(api_key, app_key)
# submitting events doesn 't require an application_key,
# so we don't bother setting it
dog = Dogapi::Client.new(api_key)
dog.emit_event(Dogapi::Event.new('msg_text', :msg_title => 'Title'))
# If you are programmatically adding a comment to this new event
# you might want to insert a pause of.5 - 1 second to allow the
# event to be available.
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
rb "example.rb"
require 'datadog_api_client'
api_instance = DatadogAPIClient::V1::EventsAPI.new
body = DatadogAPIClient::V1::EventCreateRequest.new({text: 'Oh boy!', title: 'Did you hear the news today?'}) # EventCreateRequest | Event request object
begin
# Post an event
result = api_instance.create_event(body)
p result
rescue DatadogAPIClient::V1::APIError => e
puts "Error when calling EventsAPI->create_event: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
rb "example.rb"
GET https://api.datadoghq.eu/api/v1/eventshttps://api.ddog-gov.com/api/v1/eventshttps://api.datadoghq.com/api/v1/eventshttps://api.us3.datadoghq.com/api/v1/events
イベントストリームにクエリを発行して、時間、優先度、ソース、タグなどで絞り込むことができます。
注:
クエリ対象のイベントに何らかのマークダウン形式が含まれている場合は、出力に %
、\
、n
などの文字が表示される場合があります。
このエンドポイントは最新の結果を最大 1000
件返します。さらに多くの結果を返すには、最新の結果の最新のタイムスタンプを特定し、それを end
クエリに設定して結果をページ区切りします。
名前
種類
説明
start [required]
integer
POSIX timestamp.
end [required]
integer
POSIX timestamp.
priority
string
Priority of your events, either low
or normal
.
sources
string
A comma separated string of sources.
tags
string
A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope.
unaggregated
boolean
Set unaggregated to true
to return all events within the specified [start
,end
] timeframe.
Otherwise if an event is aggregated to a parent event with a timestamp outside of the timeframe,
it won’t be available in the output.
OK
An event list response.
フィールド
種類
説明
events
[object]
An array of events.
alert_type
enum
If an alert event is enabled, set its type.
For example, error
, warning
, info
, success
, user_update
,
recommendation
, and snapshot
.
Allowed enum values: error,warning,info,success,user_update,recommendation,snapshot
date_happened
int64
POSIX timestamp of the event. Must be sent as an integer (i.e. no quotes). Limited to events no older than 7 days.
device_name
string
A device name.
host
string
Host name to associate with the event. Any tags associated with the host are also applied to this event.
id
int64
Integer ID of the event.
payload
string
Payload of the event.
priority
enum
The priority of the event. For example, normal
or low
.
Allowed enum values: normal,low
source_type_name
string
The type of event being posted. Option examples include nagios, hudson, jenkins, my_apps, chef, puppet, git, bitbucket, etc. A complete list of source attribute values available here.
tags
[string]
A list of tags to apply to the event.
text
string
The body of the event. Limited to 4000 characters. The text supports markdown.
To use markdown in the event text, start the text block with %%% \n
and end the text block with \n %%%
.
Use msg_text
with the Datadog Ruby library.
title
string
The event title. Limited to 100 characters. Use msg_title
with the Datadog Ruby library.
url
string
URL of the event.
status
string
A status.
{
"events": [
{
"alert_type": "info",
"date_happened": "integer",
"device_name": "string",
"host": "string",
"id": "integer",
"payload": "{}",
"priority": "normal",
"source_type_name": "string",
"tags": [
"environment:test"
],
"text": "Oh boy!",
"title": "Did you hear the news today?",
"url": "string"
}
],
"status": "string"
}
Bad Request
Error response object.
{
"errors": [
"Bad Request"
]
}
Authentication Error
Error response object.
{
"errors": [
"Bad Request"
]
}
# Required query arguments
export start="CHANGE_ME"
export end="CHANGE_ME"
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v1/events?start=${start}&end=${end}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
)
func main() {
ctx := datadog.NewDefaultContext(context.Background())
start := int64(789) // int64 | POSIX timestamp.
end := int64(789) // int64 | POSIX timestamp.
priority := datadog.EventPriority("normal") // EventPriority | Priority of your events, either `low` or `normal`. (optional)
sources := "sources_example" // string | A comma separated string of sources. (optional)
tags := "host:host0" // string | A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope. (optional)
unaggregated := true // bool | Set unaggregated to `true` to return all events within the specified [`start`,`end`] timeframe. Otherwise if an event is aggregated to a parent event with a timestamp outside of the timeframe, it won't be available in the output. (optional)
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
resp, r, err := apiClient.EventsApi.ListEvents(ctx).Start(start).End(end).Priority(priority).Sources(sources).Tags(tags).Unaggregated(unaggregated).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `EventsApi.ListEvents``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListEvents`: EventListResponse
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from EventsApi.ListEvents:\n%s\n", responseContent)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v1.client.ApiClient;
import com.datadog.api.v1.client.ApiException;
import com.datadog.api.v1.client.Configuration;
import com.datadog.api.v1.client.auth.*;
import com.datadog.api.v1.client.model.*;
import com.datadog.api.v1.client.api.EventsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
EventsApi apiInstance = new EventsApi(defaultClient);
Long start = 56L; // Long | POSIX timestamp.
Long end = 56L; // Long | POSIX timestamp.
EventPriority priority = EventPriority.fromValue("normal"); // EventPriority | Priority of your events, either `low` or `normal`.
String sources = "sources_example"; // String | A comma separated string of sources.
String tags = "host:host0"; // String | A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope.
Boolean unaggregated = true; // Boolean | Set unaggregated to `true` to return all events within the specified [`start`,`end`] timeframe. Otherwise if an event is aggregated to a parent event with a timestamp outside of the timeframe, it won't be available in the output.
try {
EventListResponse result = apiInstance.listEvents(start, end, new EventsApi.ListEventsOptionalParameters()
.priority(priority)
.sources(sources)
.tags(tags)
.unaggregated(unaggregated));
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EventsApi#listEvents");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
java "Example.java"
from datadog import initialize, api
import time
options = {
'api_key': '<DATADOG_API_KEY>',
'app_key': '<DATADOG_APPLICATION_KEY>'
}
initialize(**options)
end_time = time.time()
start_time = end_time - 100
api.Event.query(
start=start_time,
end=end_time,
priority="normal",
tags=["-env:dev,application:web"],
unaggregated=True
)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
python "example.py"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import events_api
from datadog_api_client.v1.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = events_api.EventsApi(api_client)
start = 1 # int | POSIX timestamp.
end = 1 # int | POSIX timestamp.
priority = EventPriority("normal") # EventPriority | Priority of your events, either `low` or `normal`. (optional)
sources = "sources_example" # str | A comma separated string of sources. (optional)
tags = "host:host0" # str | A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope. (optional)
unaggregated = True # bool | Set unaggregated to `true` to return all events within the specified [`start`,`end`] timeframe. Otherwise if an event is aggregated to a parent event with a timestamp outside of the timeframe, it won't be available in the output. (optional)
# example passing only required values which don't have defaults set
try:
# Query the event stream
api_response = api_instance.list_events(start, end)
pprint(api_response)
except ApiException as e:
print("Exception when calling EventsApi->list_events: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Query the event stream
api_response = api_instance.list_events(start, end, priority=priority, sources=sources, tags=tags, unaggregated=unaggregated)
pprint(api_response)
except ApiException as e:
print("Exception when calling EventsApi->list_events: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
python3 "example.py"
require 'rubygems'
require 'dogapi'
api_key = '<DATADOG_API_KEY>'
app_key = '<DATADOG_APPLICATION_KEY>'
dog = Dogapi::Client.new(api_key, app_key)
end_time = Time.now.to_i
start_time = end_time - 100
dog.stream(start_time, end_time, :priority => "normal", :tags => ["-env:dev,application:web"], :unaggregated => true)
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
rb "example.rb"
require 'datadog_api_client'
api_instance = DatadogAPIClient::V1::EventsAPI.new
start = 789 # Integer | POSIX timestamp.
_end = 789 # Integer | POSIX timestamp.
opts = {
priority: DatadogAPIClient::V1::EventPriority::NORMAL, # EventPriority | Priority of your events, either `low` or `normal`.
sources: 'sources_example', # String | A comma separated string of sources.
tags: 'host:host0', # String | A comma separated list indicating what tags, if any, should be used to filter the list of monitors by scope.
unaggregated: true # Boolean | Set unaggregated to `true` to return all events within the specified [`start`,`end`] timeframe. Otherwise if an event is aggregated to a parent event with a timestamp outside of the timeframe, it won't be available in the output.
}
begin
# Query the event stream
result = api_instance.list_events(start, _end, opts)
p result
rescue DatadogAPIClient::V1::APIError => e
puts "Error when calling EventsAPI->list_events: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>"
rb "example.rb"