< Back

New-DDMonitor

Sat Jan 18, 2020 8:13 pm

NAME New-DDMonitor



SYNOPSIS

Create a new Datadog monitor by using parameters or by providing a custom object.





SYNTAX

New-DDMonitor -MonitorObject <PSObject> [<CommonParameters>]



New-DDMonitor [-Type] <String> [-Query] <String> [[-Name] <String>] [[-Message] <String>] [-Tags <String[]>]

[-Options <Hashtable>] [<CommonParameters>]





DESCRIPTION





PARAMETERS

-MonitorObject <PSObject>

A Datadog Monitor object. Can be created from scratch or retrieved with Get-DDMonitor, edited and fed to

New-DDMonitor.

If it's the later, the commandlet will make sure that only supported properties are supplied by removing

others.

Incompatible with all other parameters.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-Type <String>

The type of the monitor, chosen from: metric alert, service check, event alert.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Query <String>

The monitor query to notify on with syntax varying depending on what type of monitor you are creating. The

syntax varies depending on the -Type parameter.



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Name <String>

The name of the alert. Default value is dynamic and based on the query.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Message <String>

A message to include with notifications for this monitor.

Email notifications can be sent to specific users by using the same '@username' notation as events.



Required? false

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Tags <String[]>

A list of tags to associate with your monitor, as string or array of strings



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Options <Hashtable>

A hashtable of options for the monitor.

There are options that are common to all types as well as options that are specific to certain monitor types.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\># Use a simple custom object



$obj=[PSCustomObject]@{type='metric alert'; query='avg(last_5m):sum:system.net.bytes_rcvd{*} > 10000'}









-------------------------- EXAMPLE 2 --------------------------



PS C:\\># Create a more comple custom object



$query='avg(last_5m):sum:system.net.bytes_rcvd{*} > 10000'

$name='Created from scratch'

$type='metric alert'

$message = @"

This is a long message

You better read it all!

"@

$tags=@('frontend','webapp')

$options=@{'timeout_h'='12';'locked'='True'}

$obj=[PSCustomObject]@{type=$type;query=$query;name=$name;message=$message;options=$options}

New-DDMonitor -MonitorObject $obj









-------------------------- EXAMPLE 3 --------------------------



PS C:\\># Use parameters to create a monitor



New-DDMonitor -Type 'metric alert' -Query 'avg(last_5m):sum:system.net.bytes_rcvd{*} > 100'











RELATED LINKS

http://docs.datadoghq.com/api/?lang=con ... tor-create