Data object for creating or editing a Network Path test.
attributes [required]
object
Object containing details about a Network Path test.
config [required]
object
Configuration object for a Network Path test.
assertions
[ <oneOf>]
Array of assertions used for the test.
default:
Option 1
object
Network latency assertion for a Network Path test.
operator [required]
enum
Assertion operator to apply.
Allowed enum values: is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual
property [required]
enum
The associated assertion property.
Allowed enum values: avg,max,min
target [required]
double
Target value in milliseconds.
type [required]
enum
Type of the latency assertion.
Allowed enum values: latency
default: latency
Option 2
object
Multi-network hop assertion for a Network Path test.
operator [required]
enum
Assertion operator to apply.
Allowed enum values: is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual
property [required]
enum
The associated assertion property.
Allowed enum values: avg,max,min
target [required]
double
Target value in number of hops.
type [required]
enum
Type of the multi-network hop assertion.
Allowed enum values: multiNetworkHop
default: multiNetworkHop
Option 3
object
Packet loss percentage assertion for a Network Path test.
operator [required]
enum
Assertion operator to apply.
Allowed enum values: is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual
target [required]
double
Target value as a percentage (0 to 1).
type [required]
enum
Type of the packet loss percentage assertion.
Allowed enum values: packetLossPercentage
default: packetLossPercentage
Option 4
object
Jitter assertion for a Network Path test.
operator [required]
enum
Assertion operator to apply.
Allowed enum values: is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual
target [required]
double
Target value in milliseconds.
type [required]
enum
Type of the jitter assertion.
Allowed enum values: jitter
default: jitter
request
object
Object describing the request for a Network Path test.
destination_service
string
An optional label displayed for the destination host in the Network Path visualization.
e2e_queries [required]
int64
The number of packets sent to probe the destination to measure packet loss, latency and jitter.
host [required]
string
Host name to query.
max_ttl [required]
int64
The maximum time-to-live (max number of hops) used in outgoing probe packets.
port
int64
For TCP or UDP tests, the port to use when performing the test.
If not set on a UDP test, a random port is assigned, which may affect the results.
source_service
string
An optional label displayed for the source host in the Network Path visualization.
tcp_method
enum
For TCP tests, the TCP traceroute strategy.
Allowed enum values: prefer_sack,syn,sack
timeout
int64
Timeout in seconds.
traceroute_queries [required]
int64
The number of traceroute path tracings.
locations [required]
[string]
Array of locations used to run the test. Network Path tests can be run from managed locations to test public endpoints,
or from a Datadog Agent to test private environments.
message [required]
string
Notification message associated with the test.
monitor_id
int64
The associated monitor ID.
name [required]
string
Name of the test.
options [required]
object
Object describing the extra options for a Synthetic test.
min_failure_duration
int64
Minimum amount of time in failure required to trigger an alert.
min_location_failed
int64
Minimum number of locations in failure required to trigger
an alert.
monitor_name
string
The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.
monitor_options
object
Object containing the options for a Synthetic test as a monitor
(for example, renotification).
escalation_message
string
Message to include in the escalation notification.
notification_preset_name
enum
The name of the preset for the notification for the monitor.
Allowed enum values: show_all,hide_all,hide_query,hide_handles,hide_query_and_handles,show_only_snapshot,hide_handles_and_footer
renotify_interval
int64
Time interval before renotifying if the test is still failing
(in minutes).
renotify_occurrences
int64
The number of times to renotify if the test is still failing.
monitor_priority
int32
Integer from 1 (high) to 5 (low) indicating alert severity.
restricted_roles
[string]
DEPRECATED: A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. This field is deprecated. Use the restriction policies API to manage permissions.
retry
object
Object describing the retry strategy to apply to a Synthetic test.
count
int64
Number of times a test needs to be retried before marking a
location as failed. Defaults to 0.
interval
double
Time interval between retries (in milliseconds). Defaults to
300ms.
scheduling
object
Object containing timeframes and timezone used for advanced scheduling.
timeframes [required]
[object]
Array containing objects describing the scheduling pattern to apply to each day.
day [required]
int32
Number representing the day of the week.
from [required]
string
The hour of the day on which scheduling starts.
to [required]
string
The hour of the day on which scheduling ends.
timezone [required]
string
Timezone in which the timeframe is based.
tick_every
int64
The frequency at which to run the Synthetic test (in seconds).
public_id
string
The public ID for the test.
status
enum
Define whether you want to start (live) or pause (paused) a
Synthetic test.
Allowed enum values: live,paused
subtype
enum
Subtype of the Synthetic Network Path test: tcp, udp, or icmp.
Allowed enum values: tcp,udp,icmp
tags
[string]
Array of tags attached to the test.
type [required]
enum
Type of the Synthetic test, network.
Allowed enum values: network
default: network
type [required]
enum
Type of the Synthetic test, network.
Allowed enum values: network
default: network
{"data":{"attributes":{"config":{"assertions":[{"operator":"lessThan","property":"avg","target":500,"type":"latency"}],"request":{"host":"example.com","port":443,"tcp_method":"prefer_sack","max_ttl":30,"e2e_queries":50,"traceroute_queries":3}},"locations":["aws:us-east-1","agent:my-agent-name"],"message":"Network Path test notification","name":"Example Network Path test","options":{"tick_every":60},"status":"live","subtype":"tcp","tags":["env:production"],"type":"network"},"type":"network"}}
Object containing details about a Network Path test.
config [required]
object
Configuration object for a Network Path test.
assertions
[ <oneOf>]
Array of assertions used for the test.
default:
Option 1
object
Network latency assertion for a Network Path test.
operator [required]
enum
Assertion operator to apply.
Allowed enum values: is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual
property [required]
enum
The associated assertion property.
Allowed enum values: avg,max,min
target [required]
double
Target value in milliseconds.
type [required]
enum
Type of the latency assertion.
Allowed enum values: latency
default: latency
Option 2
object
Multi-network hop assertion for a Network Path test.
operator [required]
enum
Assertion operator to apply.
Allowed enum values: is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual
property [required]
enum
The associated assertion property.
Allowed enum values: avg,max,min
target [required]
double
Target value in number of hops.
type [required]
enum
Type of the multi-network hop assertion.
Allowed enum values: multiNetworkHop
default: multiNetworkHop
Option 3
object
Packet loss percentage assertion for a Network Path test.
operator [required]
enum
Assertion operator to apply.
Allowed enum values: is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual
target [required]
double
Target value as a percentage (0 to 1).
type [required]
enum
Type of the packet loss percentage assertion.
Allowed enum values: packetLossPercentage
default: packetLossPercentage
Option 4
object
Jitter assertion for a Network Path test.
operator [required]
enum
Assertion operator to apply.
Allowed enum values: is,isNot,lessThan,lessThanOrEqual,moreThan,moreThanOrEqual
target [required]
double
Target value in milliseconds.
type [required]
enum
Type of the jitter assertion.
Allowed enum values: jitter
default: jitter
request
object
Object describing the request for a Network Path test.
destination_service
string
An optional label displayed for the destination host in the Network Path visualization.
e2e_queries [required]
int64
The number of packets sent to probe the destination to measure packet loss, latency and jitter.
host [required]
string
Host name to query.
max_ttl [required]
int64
The maximum time-to-live (max number of hops) used in outgoing probe packets.
port
int64
For TCP or UDP tests, the port to use when performing the test.
If not set on a UDP test, a random port is assigned, which may affect the results.
source_service
string
An optional label displayed for the source host in the Network Path visualization.
tcp_method
enum
For TCP tests, the TCP traceroute strategy.
Allowed enum values: prefer_sack,syn,sack
timeout
int64
Timeout in seconds.
traceroute_queries [required]
int64
The number of traceroute path tracings.
locations [required]
[string]
Array of locations used to run the test. Network Path tests can be run from managed locations to test public endpoints,
or from a Datadog Agent to test private environments.
message [required]
string
Notification message associated with the test.
monitor_id
int64
The associated monitor ID.
name [required]
string
Name of the test.
options [required]
object
Object describing the extra options for a Synthetic test.
min_failure_duration
int64
Minimum amount of time in failure required to trigger an alert.
min_location_failed
int64
Minimum number of locations in failure required to trigger
an alert.
monitor_name
string
The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.
monitor_options
object
Object containing the options for a Synthetic test as a monitor
(for example, renotification).
escalation_message
string
Message to include in the escalation notification.
notification_preset_name
enum
The name of the preset for the notification for the monitor.
Allowed enum values: show_all,hide_all,hide_query,hide_handles,hide_query_and_handles,show_only_snapshot,hide_handles_and_footer
renotify_interval
int64
Time interval before renotifying if the test is still failing
(in minutes).
renotify_occurrences
int64
The number of times to renotify if the test is still failing.
monitor_priority
int32
Integer from 1 (high) to 5 (low) indicating alert severity.
restricted_roles
[string]
DEPRECATED: A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. This field is deprecated. Use the restriction policies API to manage permissions.
retry
object
Object describing the retry strategy to apply to a Synthetic test.
count
int64
Number of times a test needs to be retried before marking a
location as failed. Defaults to 0.
interval
double
Time interval between retries (in milliseconds). Defaults to
300ms.
scheduling
object
Object containing timeframes and timezone used for advanced scheduling.
timeframes [required]
[object]
Array containing objects describing the scheduling pattern to apply to each day.
day [required]
int32
Number representing the day of the week.
from [required]
string
The hour of the day on which scheduling starts.
to [required]
string
The hour of the day on which scheduling ends.
timezone [required]
string
Timezone in which the timeframe is based.
tick_every
int64
The frequency at which to run the Synthetic test (in seconds).
public_id
string
The public ID for the test.
status
enum
Define whether you want to start (live) or pause (paused) a
Synthetic test.
Allowed enum values: live,paused
subtype
enum
Subtype of the Synthetic Network Path test: tcp, udp, or icmp.
Allowed enum values: tcp,udp,icmp
tags
[string]
Array of tags attached to the test.
type [required]
enum
Type of the Synthetic test, network.
Allowed enum values: network
default: network
id
string
The public ID of the Network Path test.
type
enum
Type of response, network_test.
Allowed enum values: network_test
default: network_test
{"data":{"attributes":{"config":{"assertions":[{"operator":"lessThan","property":"avg","target":500,"type":"latency"}],"request":{"destination_service":"string","e2e_queries":50,"host":"","max_ttl":30,"port":443,"source_service":"string","tcp_method":"prefer_sack","timeout":"integer","traceroute_queries":3}},"locations":["aws:us-east-1","agent:my-agent-name"],"message":"Network Path test notification","monitor_id":12345678,"name":"Example Network Path test","options":{"min_failure_duration":"integer","min_location_failed":"integer","monitor_name":"string","monitor_options":{"escalation_message":"string","notification_preset_name":"string","renotify_interval":"integer","renotify_occurrences":"integer"},"monitor_priority":"integer","restricted_roles":["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"],"retry":{"count":"integer","interval":"number"},"scheduling":{"timeframes":[{"day":1,"from":"07:00","to":"16:00"}],"timezone":"America/New_York"},"tick_every":"integer"},"public_id":"abc-def-123","status":"live","subtype":"tcp","tags":["env:production"],"type":"network"},"id":"abc-def-123","type":"network_test"}}
// Create a Network Path test returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.SyntheticsNetworkTestEditRequest{Data:datadogV2.SyntheticsNetworkTestEdit{Attributes:datadogV2.SyntheticsNetworkTest{Config:datadogV2.SyntheticsNetworkTestConfig{Assertions:[]datadogV2.SyntheticsNetworkAssertion{datadogV2.SyntheticsNetworkAssertion{SyntheticsNetworkAssertionLatency:&datadogV2.SyntheticsNetworkAssertionLatency{Operator:datadogV2.SYNTHETICSNETWORKASSERTIONOPERATOR_LESS_THAN,Property:datadogV2.SYNTHETICSNETWORKASSERTIONPROPERTY_AVG,Target:500,Type:datadogV2.SYNTHETICSNETWORKASSERTIONLATENCYTYPE_LATENCY,}},},Request:&datadogV2.SyntheticsNetworkTestRequest{Host:"example.com",Port:datadog.PtrInt64(443),TcpMethod:datadogV2.SYNTHETICSNETWORKTESTREQUESTTCPMETHOD_PREFER_SACK.Ptr(),MaxTtl:30,E2eQueries:50,TracerouteQueries:3,},},Locations:[]string{"aws:us-east-1","agent:my-agent-name",},Message:"Network Path test notification",Name:"Example Network Path test",Options:datadogV2.SyntheticsTestOptions{TickEvery:datadog.PtrInt64(60),},Status:datadogV2.SYNTHETICSTESTPAUSESTATUS_LIVE.Ptr(),Subtype:datadogV2.SYNTHETICSNETWORKTESTSUBTYPE_TCP.Ptr(),Tags:[]string{"env:production",},Type:datadogV2.SYNTHETICSNETWORKTESTTYPE_NETWORK,},Type:datadogV2.SYNTHETICSNETWORKTESTTYPE_NETWORK,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewSyntheticsApi(apiClient)resp,r,err:=api.CreateSyntheticsNetworkTest(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `SyntheticsApi.CreateSyntheticsNetworkTest`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `SyntheticsApi.CreateSyntheticsNetworkTest`:\n%s\n",responseContent)}
# Create a Network Path test returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::SyntheticsAPI.newbody=DatadogAPIClient::V2::SyntheticsNetworkTestEditRequest.new({data:DatadogAPIClient::V2::SyntheticsNetworkTestEdit.new({attributes:DatadogAPIClient::V2::SyntheticsNetworkTest.new({config:DatadogAPIClient::V2::SyntheticsNetworkTestConfig.new({assertions:[DatadogAPIClient::V2::SyntheticsNetworkAssertionLatency.new({operator:DatadogAPIClient::V2::SyntheticsNetworkAssertionOperator::LESS_THAN,property:DatadogAPIClient::V2::SyntheticsNetworkAssertionProperty::AVG,target:500,type:DatadogAPIClient::V2::SyntheticsNetworkAssertionLatencyType::LATENCY,}),],request:DatadogAPIClient::V2::SyntheticsNetworkTestRequest.new({host:"example.com",port:443,tcp_method:DatadogAPIClient::V2::SyntheticsNetworkTestRequestTCPMethod::PREFER_SACK,max_ttl:30,e2e_queries:50,traceroute_queries:3,}),}),locations:["aws:us-east-1","agent:my-agent-name",],message:"Network Path test notification",name:"Example Network Path test",options:DatadogAPIClient::V2::SyntheticsTestOptions.new({tick_every:60,}),status:DatadogAPIClient::V2::SyntheticsTestPauseStatus::LIVE,subtype:DatadogAPIClient::V2::SyntheticsNetworkTestSubType::TCP,tags:["env:production",],type:DatadogAPIClient::V2::SyntheticsNetworkTestType::NETWORK,}),type:DatadogAPIClient::V2::SyntheticsNetworkTestType::NETWORK,}),})papi_instance.create_synthetics_network_test(body)
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Create a Network Path test returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.SyntheticsApi(configuration);constparams: v2.SyntheticsApiCreateSyntheticsNetworkTestRequest={body:{data:{attributes:{config:{assertions:[{operator:"lessThan",property:"avg",target: 500,type:"latency",},],request:{host:"example.com",port: 443,tcpMethod:"prefer_sack",maxTtl: 30,e2eQueries: 50,tracerouteQueries: 3,},},locations:["aws:us-east-1","agent:my-agent-name"],message:"Network Path test notification",name:"Example Network Path test",options:{tickEvery: 60,},status:"live",subtype:"tcp",tags:["env:production"],type:"network",},type:"network",},},};apiInstance.createSyntheticsNetworkTest(params).then((data: v2.SyntheticsNetworkTestResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));