datadog.MonitorJson
Explore with Pulumi AI
Provides a Datadog monitor JSON resource. This can be used to create and manage Datadog monitors using the JSON definition.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";
const monitorJson = new datadog.MonitorJson("monitor_json", {monitor: `{
"name": "Example monitor - service check",
"type": "service check",
"query": "\\"ntp.in_sync\\".by(\\"*\\").last(2).count_by_status()",
"message": "Change the message triggers if any host's clock goes out of sync with the time given by NTP. The offset threshold is configured in the Agent's 'ntp.yaml' file.\\n\\nSee [Troubleshooting NTP Offset issues](https://docs.datadoghq.com/agent/troubleshooting/ntp for more details on cause and resolution.",
"tags": [],
"multi": true,
\x09"restricted_roles": null,
"options": {
"include_tags": true,
"new_host_delay": 150,
"notify_audit": false,
"notify_no_data": false,
"thresholds": {
"warning": 1,
"ok": 1,
"critical": 1
}
},
"priority": null,
"classification": "custom"
}
`});
import pulumi
import pulumi_datadog as datadog
monitor_json = datadog.MonitorJson("monitor_json", monitor="""{
"name": "Example monitor - service check",
"type": "service check",
"query": "\"ntp.in_sync\".by(\"*\").last(2).count_by_status()",
"message": "Change the message triggers if any host's clock goes out of sync with the time given by NTP. The offset threshold is configured in the Agent's 'ntp.yaml' file.\n\nSee [Troubleshooting NTP Offset issues](https://docs.datadoghq.com/agent/troubleshooting/ntp for more details on cause and resolution.",
"tags": [],
"multi": true,
\x09"restricted_roles": null,
"options": {
"include_tags": true,
"new_host_delay": 150,
"notify_audit": false,
"notify_no_data": false,
"thresholds": {
"warning": 1,
"ok": 1,
"critical": 1
}
},
"priority": null,
"classification": "custom"
}
""")
package main
import (
"github.com/pulumi/pulumi-datadog/sdk/v4/go/datadog"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := datadog.NewMonitorJson(ctx, "monitor_json", &datadog.MonitorJsonArgs{
Monitor: pulumi.String(`{
"name": "Example monitor - service check",
"type": "service check",
"query": "\"ntp.in_sync\".by(\"*\").last(2).count_by_status()",
"message": "Change the message triggers if any host's clock goes out of sync with the time given by NTP. The offset threshold is configured in the Agent's 'ntp.yaml' file.\n\nSee [Troubleshooting NTP Offset issues](https://docs.datadoghq.com/agent/troubleshooting/ntp for more details on cause and resolution.",
"tags": [],
"multi": true,
"restricted_roles": null,
"options": {
"include_tags": true,
"new_host_delay": 150,
"notify_audit": false,
"notify_no_data": false,
"thresholds": {
"warning": 1,
"ok": 1,
"critical": 1
}
},
"priority": null,
"classification": "custom"
}
`),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Datadog = Pulumi.Datadog;
return await Deployment.RunAsync(() =>
{
var monitorJson = new Datadog.MonitorJson("monitor_json", new()
{
Monitor = @"{
""name"": ""Example monitor - service check"",
""type"": ""service check"",
""query"": ""\""ntp.in_sync\"".by(\""*\"").last(2).count_by_status()"",
""message"": ""Change the message triggers if any host's clock goes out of sync with the time given by NTP. The offset threshold is configured in the Agent's 'ntp.yaml' file.\n\nSee [Troubleshooting NTP Offset issues](https://docs.datadoghq.com/agent/troubleshooting/ntp for more details on cause and resolution."",
""tags"": [],
""multi"": true,
""restricted_roles"": null,
""options"": {
""include_tags"": true,
""new_host_delay"": 150,
""notify_audit"": false,
""notify_no_data"": false,
""thresholds"": {
""warning"": 1,
""ok"": 1,
""critical"": 1
}
},
""priority"": null,
""classification"": ""custom""
}
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.datadog.MonitorJson;
import com.pulumi.datadog.MonitorJsonArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var monitorJson = new MonitorJson("monitorJson", MonitorJsonArgs.builder()
.monitor("""
{
"name": "Example monitor - service check",
"type": "service check",
"query": "\"ntp.in_sync\".by(\"*\").last(2).count_by_status()",
"message": "Change the message triggers if any host's clock goes out of sync with the time given by NTP. The offset threshold is configured in the Agent's 'ntp.yaml' file.\n\nSee [Troubleshooting NTP Offset issues](https://docs.datadoghq.com/agent/troubleshooting/ntp for more details on cause and resolution.",
"tags": [],
"multi": true,
"restricted_roles": null,
"options": {
"include_tags": true,
"new_host_delay": 150,
"notify_audit": false,
"notify_no_data": false,
"thresholds": {
"warning": 1,
"ok": 1,
"critical": 1
}
},
"priority": null,
"classification": "custom"
}
""")
.build());
}
}
resources:
monitorJson:
type: datadog:MonitorJson
name: monitor_json
properties:
monitor: |
{
"name": "Example monitor - service check",
"type": "service check",
"query": "\"ntp.in_sync\".by(\"*\").last(2).count_by_status()",
"message": "Change the message triggers if any host's clock goes out of sync with the time given by NTP. The offset threshold is configured in the Agent's 'ntp.yaml' file.\n\nSee [Troubleshooting NTP Offset issues](https://docs.datadoghq.com/agent/troubleshooting/ntp for more details on cause and resolution.",
"tags": [],
"multi": true,
"restricted_roles": null,
"options": {
"include_tags": true,
"new_host_delay": 150,
"notify_audit": false,
"notify_no_data": false,
"thresholds": {
"warning": 1,
"ok": 1,
"critical": 1
}
},
"priority": null,
"classification": "custom"
}
Create MonitorJson Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new MonitorJson(name: string, args: MonitorJsonArgs, opts?: CustomResourceOptions);
@overload
def MonitorJson(resource_name: str,
args: MonitorJsonArgs,
opts: Optional[ResourceOptions] = None)
@overload
def MonitorJson(resource_name: str,
opts: Optional[ResourceOptions] = None,
monitor: Optional[str] = None,
url: Optional[str] = None)
func NewMonitorJson(ctx *Context, name string, args MonitorJsonArgs, opts ...ResourceOption) (*MonitorJson, error)
public MonitorJson(string name, MonitorJsonArgs args, CustomResourceOptions? opts = null)
public MonitorJson(String name, MonitorJsonArgs args)
public MonitorJson(String name, MonitorJsonArgs args, CustomResourceOptions options)
type: datadog:MonitorJson
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args MonitorJsonArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args MonitorJsonArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args MonitorJsonArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MonitorJsonArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MonitorJsonArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var monitorJsonResource = new Datadog.MonitorJson("monitorJsonResource", new()
{
Monitor = "string",
Url = "string",
});
example, err := datadog.NewMonitorJson(ctx, "monitorJsonResource", &datadog.MonitorJsonArgs{
Monitor: pulumi.String("string"),
Url: pulumi.String("string"),
})
var monitorJsonResource = new MonitorJson("monitorJsonResource", MonitorJsonArgs.builder()
.monitor("string")
.url("string")
.build());
monitor_json_resource = datadog.MonitorJson("monitorJsonResource",
monitor="string",
url="string")
const monitorJsonResource = new datadog.MonitorJson("monitorJsonResource", {
monitor: "string",
url: "string",
});
type: datadog:MonitorJson
properties:
monitor: string
url: string
MonitorJson Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The MonitorJson resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the MonitorJson resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing MonitorJson Resource
Get an existing MonitorJson resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: MonitorJsonState, opts?: CustomResourceOptions): MonitorJson
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
monitor: Optional[str] = None,
url: Optional[str] = None) -> MonitorJson
func GetMonitorJson(ctx *Context, name string, id IDInput, state *MonitorJsonState, opts ...ResourceOption) (*MonitorJson, error)
public static MonitorJson Get(string name, Input<string> id, MonitorJsonState? state, CustomResourceOptions? opts = null)
public static MonitorJson get(String name, Output<String> id, MonitorJsonState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
Import
$ pulumi import datadog:index/monitorJson:MonitorJson monitor_json 123456
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Datadog pulumi/pulumi-datadog
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
datadog
Terraform Provider.