1. Packages
  2. New Relic
  3. API Docs
  4. AlertCondition
New Relic v5.23.0 published on Wednesday, Apr 24, 2024 by Pulumi

newrelic.AlertCondition

Explore with Pulumi AI

newrelic logo
New Relic v5.23.0 published on Wednesday, Apr 24, 2024 by Pulumi

    Use this resource to create and manage alert conditions for APM, Browser, and Mobile in New Relic.

    WARNING: The newrelic.AlertCondition resource is deprecated and will be removed in the next major release. The resource newrelic.NrqlAlertCondition would be a preferred alternative to configure alert conditions - in most cases, feature parity can be achieved with a NRQL query.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const app = newrelic.getEntity({
        name: "my-app",
        type: "APPLICATION",
        domain: "APM",
    });
    const foo = new newrelic.AlertPolicy("foo", {name: "foo"});
    const fooAlertCondition = new newrelic.AlertCondition("foo", {
        policyId: foo.id,
        name: "foo",
        type: "apm_app_metric",
        entities: [app.then(app => app.applicationId)],
        metric: "apdex",
        runbookUrl: "https://www.example.com",
        conditionScope: "application",
        terms: [{
            duration: 5,
            operator: "below",
            priority: "critical",
            threshold: 0.75,
            timeFunction: "all",
        }],
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    app = newrelic.get_entity(name="my-app",
        type="APPLICATION",
        domain="APM")
    foo = newrelic.AlertPolicy("foo", name="foo")
    foo_alert_condition = newrelic.AlertCondition("foo",
        policy_id=foo.id,
        name="foo",
        type="apm_app_metric",
        entities=[app.application_id],
        metric="apdex",
        runbook_url="https://www.example.com",
        condition_scope="application",
        terms=[newrelic.AlertConditionTermArgs(
            duration=5,
            operator="below",
            priority="critical",
            threshold=0.75,
            time_function="all",
        )])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		app, err := newrelic.GetEntity(ctx, &newrelic.GetEntityArgs{
    			Name:   "my-app",
    			Type:   pulumi.StringRef("APPLICATION"),
    			Domain: pulumi.StringRef("APM"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		foo, err := newrelic.NewAlertPolicy(ctx, "foo", &newrelic.AlertPolicyArgs{
    			Name: pulumi.String("foo"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.NewAlertCondition(ctx, "foo", &newrelic.AlertConditionArgs{
    			PolicyId: foo.ID(),
    			Name:     pulumi.String("foo"),
    			Type:     pulumi.String("apm_app_metric"),
    			Entities: pulumi.IntArray{
    				pulumi.Int(app.ApplicationId),
    			},
    			Metric:         pulumi.String("apdex"),
    			RunbookUrl:     pulumi.String("https://www.example.com"),
    			ConditionScope: pulumi.String("application"),
    			Terms: newrelic.AlertConditionTermArray{
    				&newrelic.AlertConditionTermArgs{
    					Duration:     pulumi.Int(5),
    					Operator:     pulumi.String("below"),
    					Priority:     pulumi.String("critical"),
    					Threshold:    pulumi.Float64(0.75),
    					TimeFunction: pulumi.String("all"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var app = NewRelic.GetEntity.Invoke(new()
        {
            Name = "my-app",
            Type = "APPLICATION",
            Domain = "APM",
        });
    
        var foo = new NewRelic.AlertPolicy("foo", new()
        {
            Name = "foo",
        });
    
        var fooAlertCondition = new NewRelic.AlertCondition("foo", new()
        {
            PolicyId = foo.Id,
            Name = "foo",
            Type = "apm_app_metric",
            Entities = new[]
            {
                app.Apply(getEntityResult => getEntityResult.ApplicationId),
            },
            Metric = "apdex",
            RunbookUrl = "https://www.example.com",
            ConditionScope = "application",
            Terms = new[]
            {
                new NewRelic.Inputs.AlertConditionTermArgs
                {
                    Duration = 5,
                    Operator = "below",
                    Priority = "critical",
                    Threshold = 0.75,
                    TimeFunction = "all",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NewrelicFunctions;
    import com.pulumi.newrelic.inputs.GetEntityArgs;
    import com.pulumi.newrelic.AlertPolicy;
    import com.pulumi.newrelic.AlertPolicyArgs;
    import com.pulumi.newrelic.AlertCondition;
    import com.pulumi.newrelic.AlertConditionArgs;
    import com.pulumi.newrelic.inputs.AlertConditionTermArgs;
    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) {
            final var app = NewrelicFunctions.getEntity(GetEntityArgs.builder()
                .name("my-app")
                .type("APPLICATION")
                .domain("APM")
                .build());
    
            var foo = new AlertPolicy("foo", AlertPolicyArgs.builder()        
                .name("foo")
                .build());
    
            var fooAlertCondition = new AlertCondition("fooAlertCondition", AlertConditionArgs.builder()        
                .policyId(foo.id())
                .name("foo")
                .type("apm_app_metric")
                .entities(app.applyValue(getEntityResult -> getEntityResult.applicationId()))
                .metric("apdex")
                .runbookUrl("https://www.example.com")
                .conditionScope("application")
                .terms(AlertConditionTermArgs.builder()
                    .duration(5)
                    .operator("below")
                    .priority("critical")
                    .threshold("0.75")
                    .timeFunction("all")
                    .build())
                .build());
    
        }
    }
    
    resources:
      foo:
        type: newrelic:AlertPolicy
        properties:
          name: foo
      fooAlertCondition:
        type: newrelic:AlertCondition
        name: foo
        properties:
          policyId: ${foo.id}
          name: foo
          type: apm_app_metric
          entities:
            - ${app.applicationId}
          metric: apdex
          runbookUrl: https://www.example.com
          conditionScope: application
          terms:
            - duration: 5
              operator: below
              priority: critical
              threshold: '0.75'
              timeFunction: all
    variables:
      app:
        fn::invoke:
          Function: newrelic:getEntity
          Arguments:
            name: my-app
            type: APPLICATION
            domain: APM
    

    Terms

    The term mapping supports the following arguments:

    • duration - (Required) In minutes, must be in the range of 5 to 120, inclusive.
    • operator - (Optional) above, below, or equal. Defaults to equal.
    • priority - (Optional) critical or warning. Defaults to critical. Terms must include at least one critical priority term
    • threshold - (Required) Must be 0 or greater.
    • time_function - (Required) all or any.

    Tags

    Manage alert condition tags with newrelic.EntityTags. For up-to-date documentation about the tagging resource, please check newrelic.EntityTags

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const foo = newrelic.getEntity({
        name: "foo entitiy",
    });
    const fooAlertPolicy = new newrelic.AlertPolicy("foo", {name: "foo policy"});
    const fooAlertCondition = new newrelic.AlertCondition("foo", {
        policyId: fooAlertPolicy.id,
        name: "foo condition",
        type: "apm_app_metric",
        entities: [foo.then(foo => foo.applicationId)],
        metric: "apdex",
        runbookUrl: "https://www.example.com",
        conditionScope: "application",
        terms: [{
            duration: 5,
            operator: "below",
            priority: "critical",
            threshold: 0.75,
            timeFunction: "all",
        }],
    });
    const myConditionEntityTags = new newrelic.EntityTags("my_condition_entity_tags", {
        guid: fooAlertCondition.entityGuid,
        tags: [
            {
                key: "my-key",
                values: [
                    "my-value",
                    "my-other-value",
                ],
            },
            {
                key: "my-key-2",
                values: ["my-value-2"],
            },
        ],
    });
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    foo = newrelic.get_entity(name="foo entitiy")
    foo_alert_policy = newrelic.AlertPolicy("foo", name="foo policy")
    foo_alert_condition = newrelic.AlertCondition("foo",
        policy_id=foo_alert_policy.id,
        name="foo condition",
        type="apm_app_metric",
        entities=[foo.application_id],
        metric="apdex",
        runbook_url="https://www.example.com",
        condition_scope="application",
        terms=[newrelic.AlertConditionTermArgs(
            duration=5,
            operator="below",
            priority="critical",
            threshold=0.75,
            time_function="all",
        )])
    my_condition_entity_tags = newrelic.EntityTags("my_condition_entity_tags",
        guid=foo_alert_condition.entity_guid,
        tags=[
            newrelic.EntityTagsTagArgs(
                key="my-key",
                values=[
                    "my-value",
                    "my-other-value",
                ],
            ),
            newrelic.EntityTagsTagArgs(
                key="my-key-2",
                values=["my-value-2"],
            ),
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		foo, err := newrelic.GetEntity(ctx, &newrelic.GetEntityArgs{
    			Name: "foo entitiy",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		fooAlertPolicy, err := newrelic.NewAlertPolicy(ctx, "foo", &newrelic.AlertPolicyArgs{
    			Name: pulumi.String("foo policy"),
    		})
    		if err != nil {
    			return err
    		}
    		fooAlertCondition, err := newrelic.NewAlertCondition(ctx, "foo", &newrelic.AlertConditionArgs{
    			PolicyId: fooAlertPolicy.ID(),
    			Name:     pulumi.String("foo condition"),
    			Type:     pulumi.String("apm_app_metric"),
    			Entities: pulumi.IntArray{
    				pulumi.Int(foo.ApplicationId),
    			},
    			Metric:         pulumi.String("apdex"),
    			RunbookUrl:     pulumi.String("https://www.example.com"),
    			ConditionScope: pulumi.String("application"),
    			Terms: newrelic.AlertConditionTermArray{
    				&newrelic.AlertConditionTermArgs{
    					Duration:     pulumi.Int(5),
    					Operator:     pulumi.String("below"),
    					Priority:     pulumi.String("critical"),
    					Threshold:    pulumi.Float64(0.75),
    					TimeFunction: pulumi.String("all"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.NewEntityTags(ctx, "my_condition_entity_tags", &newrelic.EntityTagsArgs{
    			Guid: fooAlertCondition.EntityGuid,
    			Tags: newrelic.EntityTagsTagArray{
    				&newrelic.EntityTagsTagArgs{
    					Key: pulumi.String("my-key"),
    					Values: pulumi.StringArray{
    						pulumi.String("my-value"),
    						pulumi.String("my-other-value"),
    					},
    				},
    				&newrelic.EntityTagsTagArgs{
    					Key: pulumi.String("my-key-2"),
    					Values: pulumi.StringArray{
    						pulumi.String("my-value-2"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = NewRelic.GetEntity.Invoke(new()
        {
            Name = "foo entitiy",
        });
    
        var fooAlertPolicy = new NewRelic.AlertPolicy("foo", new()
        {
            Name = "foo policy",
        });
    
        var fooAlertCondition = new NewRelic.AlertCondition("foo", new()
        {
            PolicyId = fooAlertPolicy.Id,
            Name = "foo condition",
            Type = "apm_app_metric",
            Entities = new[]
            {
                foo.Apply(getEntityResult => getEntityResult.ApplicationId),
            },
            Metric = "apdex",
            RunbookUrl = "https://www.example.com",
            ConditionScope = "application",
            Terms = new[]
            {
                new NewRelic.Inputs.AlertConditionTermArgs
                {
                    Duration = 5,
                    Operator = "below",
                    Priority = "critical",
                    Threshold = 0.75,
                    TimeFunction = "all",
                },
            },
        });
    
        var myConditionEntityTags = new NewRelic.EntityTags("my_condition_entity_tags", new()
        {
            Guid = fooAlertCondition.EntityGuid,
            Tags = new[]
            {
                new NewRelic.Inputs.EntityTagsTagArgs
                {
                    Key = "my-key",
                    Values = new[]
                    {
                        "my-value",
                        "my-other-value",
                    },
                },
                new NewRelic.Inputs.EntityTagsTagArgs
                {
                    Key = "my-key-2",
                    Values = new[]
                    {
                        "my-value-2",
                    },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NewrelicFunctions;
    import com.pulumi.newrelic.inputs.GetEntityArgs;
    import com.pulumi.newrelic.AlertPolicy;
    import com.pulumi.newrelic.AlertPolicyArgs;
    import com.pulumi.newrelic.AlertCondition;
    import com.pulumi.newrelic.AlertConditionArgs;
    import com.pulumi.newrelic.inputs.AlertConditionTermArgs;
    import com.pulumi.newrelic.EntityTags;
    import com.pulumi.newrelic.EntityTagsArgs;
    import com.pulumi.newrelic.inputs.EntityTagsTagArgs;
    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) {
            final var foo = NewrelicFunctions.getEntity(GetEntityArgs.builder()
                .name("foo entitiy")
                .build());
    
            var fooAlertPolicy = new AlertPolicy("fooAlertPolicy", AlertPolicyArgs.builder()        
                .name("foo policy")
                .build());
    
            var fooAlertCondition = new AlertCondition("fooAlertCondition", AlertConditionArgs.builder()        
                .policyId(fooAlertPolicy.id())
                .name("foo condition")
                .type("apm_app_metric")
                .entities(foo.applyValue(getEntityResult -> getEntityResult.applicationId()))
                .metric("apdex")
                .runbookUrl("https://www.example.com")
                .conditionScope("application")
                .terms(AlertConditionTermArgs.builder()
                    .duration(5)
                    .operator("below")
                    .priority("critical")
                    .threshold("0.75")
                    .timeFunction("all")
                    .build())
                .build());
    
            var myConditionEntityTags = new EntityTags("myConditionEntityTags", EntityTagsArgs.builder()        
                .guid(fooAlertCondition.entityGuid())
                .tags(            
                    EntityTagsTagArgs.builder()
                        .key("my-key")
                        .values(                    
                            "my-value",
                            "my-other-value")
                        .build(),
                    EntityTagsTagArgs.builder()
                        .key("my-key-2")
                        .values("my-value-2")
                        .build())
                .build());
    
        }
    }
    
    resources:
      fooAlertPolicy:
        type: newrelic:AlertPolicy
        name: foo
        properties:
          name: foo policy
      fooAlertCondition:
        type: newrelic:AlertCondition
        name: foo
        properties:
          policyId: ${fooAlertPolicy.id}
          name: foo condition
          type: apm_app_metric
          entities:
            - ${foo.applicationId}
          metric: apdex
          runbookUrl: https://www.example.com
          conditionScope: application
          terms:
            - duration: 5
              operator: below
              priority: critical
              threshold: '0.75'
              timeFunction: all
      myConditionEntityTags:
        type: newrelic:EntityTags
        name: my_condition_entity_tags
        properties:
          guid: ${fooAlertCondition.entityGuid}
          tags:
            - key: my-key
              values:
                - my-value
                - my-other-value
            - key: my-key-2
              values:
                - my-value-2
    variables:
      foo:
        fn::invoke:
          Function: newrelic:getEntity
          Arguments:
            name: foo entitiy
    

    Create AlertCondition Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new AlertCondition(name: string, args: AlertConditionArgs, opts?: CustomResourceOptions);
    @overload
    def AlertCondition(resource_name: str,
                       args: AlertConditionArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def AlertCondition(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       type: Optional[str] = None,
                       entities: Optional[Sequence[int]] = None,
                       metric: Optional[str] = None,
                       policy_id: Optional[int] = None,
                       terms: Optional[Sequence[AlertConditionTermArgs]] = None,
                       enabled: Optional[bool] = None,
                       gc_metric: Optional[str] = None,
                       name: Optional[str] = None,
                       runbook_url: Optional[str] = None,
                       condition_scope: Optional[str] = None,
                       user_defined_metric: Optional[str] = None,
                       user_defined_value_function: Optional[str] = None,
                       violation_close_timer: Optional[int] = None)
    func NewAlertCondition(ctx *Context, name string, args AlertConditionArgs, opts ...ResourceOption) (*AlertCondition, error)
    public AlertCondition(string name, AlertConditionArgs args, CustomResourceOptions? opts = null)
    public AlertCondition(String name, AlertConditionArgs args)
    public AlertCondition(String name, AlertConditionArgs args, CustomResourceOptions options)
    
    type: newrelic:AlertCondition
    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 AlertConditionArgs
    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 AlertConditionArgs
    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 AlertConditionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AlertConditionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AlertConditionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var alertConditionResource = new NewRelic.AlertCondition("alertConditionResource", new()
    {
        Type = "string",
        Entities = new[]
        {
            0,
        },
        Metric = "string",
        PolicyId = 0,
        Terms = new[]
        {
            new NewRelic.Inputs.AlertConditionTermArgs
            {
                Duration = 0,
                Threshold = 0,
                TimeFunction = "string",
                Operator = "string",
                Priority = "string",
            },
        },
        Enabled = false,
        GcMetric = "string",
        Name = "string",
        RunbookUrl = "string",
        ConditionScope = "string",
        UserDefinedMetric = "string",
        UserDefinedValueFunction = "string",
        ViolationCloseTimer = 0,
    });
    
    example, err := newrelic.NewAlertCondition(ctx, "alertConditionResource", &newrelic.AlertConditionArgs{
    	Type: pulumi.String("string"),
    	Entities: pulumi.IntArray{
    		pulumi.Int(0),
    	},
    	Metric:   pulumi.String("string"),
    	PolicyId: pulumi.Int(0),
    	Terms: newrelic.AlertConditionTermArray{
    		&newrelic.AlertConditionTermArgs{
    			Duration:     pulumi.Int(0),
    			Threshold:    pulumi.Float64(0),
    			TimeFunction: pulumi.String("string"),
    			Operator:     pulumi.String("string"),
    			Priority:     pulumi.String("string"),
    		},
    	},
    	Enabled:                  pulumi.Bool(false),
    	GcMetric:                 pulumi.String("string"),
    	Name:                     pulumi.String("string"),
    	RunbookUrl:               pulumi.String("string"),
    	ConditionScope:           pulumi.String("string"),
    	UserDefinedMetric:        pulumi.String("string"),
    	UserDefinedValueFunction: pulumi.String("string"),
    	ViolationCloseTimer:      pulumi.Int(0),
    })
    
    var alertConditionResource = new AlertCondition("alertConditionResource", AlertConditionArgs.builder()        
        .type("string")
        .entities(0)
        .metric("string")
        .policyId(0)
        .terms(AlertConditionTermArgs.builder()
            .duration(0)
            .threshold(0)
            .timeFunction("string")
            .operator("string")
            .priority("string")
            .build())
        .enabled(false)
        .gcMetric("string")
        .name("string")
        .runbookUrl("string")
        .conditionScope("string")
        .userDefinedMetric("string")
        .userDefinedValueFunction("string")
        .violationCloseTimer(0)
        .build());
    
    alert_condition_resource = newrelic.AlertCondition("alertConditionResource",
        type="string",
        entities=[0],
        metric="string",
        policy_id=0,
        terms=[newrelic.AlertConditionTermArgs(
            duration=0,
            threshold=0,
            time_function="string",
            operator="string",
            priority="string",
        )],
        enabled=False,
        gc_metric="string",
        name="string",
        runbook_url="string",
        condition_scope="string",
        user_defined_metric="string",
        user_defined_value_function="string",
        violation_close_timer=0)
    
    const alertConditionResource = new newrelic.AlertCondition("alertConditionResource", {
        type: "string",
        entities: [0],
        metric: "string",
        policyId: 0,
        terms: [{
            duration: 0,
            threshold: 0,
            timeFunction: "string",
            operator: "string",
            priority: "string",
        }],
        enabled: false,
        gcMetric: "string",
        name: "string",
        runbookUrl: "string",
        conditionScope: "string",
        userDefinedMetric: "string",
        userDefinedValueFunction: "string",
        violationCloseTimer: 0,
    });
    
    type: newrelic:AlertCondition
    properties:
        conditionScope: string
        enabled: false
        entities:
            - 0
        gcMetric: string
        metric: string
        name: string
        policyId: 0
        runbookUrl: string
        terms:
            - duration: 0
              operator: string
              priority: string
              threshold: 0
              timeFunction: string
        type: string
        userDefinedMetric: string
        userDefinedValueFunction: string
        violationCloseTimer: 0
    

    AlertCondition 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 AlertCondition resource accepts the following input properties:

    Entities List<int>
    The instance IDs associated with this condition.
    Metric string
    The metric field accepts parameters based on the type set.
    PolicyId int
    The ID of the policy where this condition should be used.
    Terms List<Pulumi.NewRelic.Inputs.AlertConditionTerm>
    Type string
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    ConditionScope string
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    Enabled bool
    Whether the condition is enabled.
    GcMetric string
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    Name string
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    RunbookUrl string
    Runbook URL to display in notifications.
    UserDefinedMetric string
    A custom metric to be evaluated.
    UserDefinedValueFunction string
    One of: (average, min, max, total, sample_size, percent, rate).
    ViolationCloseTimer int
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.
    Entities []int
    The instance IDs associated with this condition.
    Metric string
    The metric field accepts parameters based on the type set.
    PolicyId int
    The ID of the policy where this condition should be used.
    Terms []AlertConditionTermArgs
    Type string
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    ConditionScope string
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    Enabled bool
    Whether the condition is enabled.
    GcMetric string
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    Name string
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    RunbookUrl string
    Runbook URL to display in notifications.
    UserDefinedMetric string
    A custom metric to be evaluated.
    UserDefinedValueFunction string
    One of: (average, min, max, total, sample_size, percent, rate).
    ViolationCloseTimer int
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.
    entities List<Integer>
    The instance IDs associated with this condition.
    metric String
    The metric field accepts parameters based on the type set.
    policyId Integer
    The ID of the policy where this condition should be used.
    terms List<AlertConditionTerm>
    type String
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    conditionScope String
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    enabled Boolean
    Whether the condition is enabled.
    gcMetric String
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    name String
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    runbookUrl String
    Runbook URL to display in notifications.
    userDefinedMetric String
    A custom metric to be evaluated.
    userDefinedValueFunction String
    One of: (average, min, max, total, sample_size, percent, rate).
    violationCloseTimer Integer
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.
    entities number[]
    The instance IDs associated with this condition.
    metric string
    The metric field accepts parameters based on the type set.
    policyId number
    The ID of the policy where this condition should be used.
    terms AlertConditionTerm[]
    type string
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    conditionScope string
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    enabled boolean
    Whether the condition is enabled.
    gcMetric string
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    name string
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    runbookUrl string
    Runbook URL to display in notifications.
    userDefinedMetric string
    A custom metric to be evaluated.
    userDefinedValueFunction string
    One of: (average, min, max, total, sample_size, percent, rate).
    violationCloseTimer number
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.
    entities Sequence[int]
    The instance IDs associated with this condition.
    metric str
    The metric field accepts parameters based on the type set.
    policy_id int
    The ID of the policy where this condition should be used.
    terms Sequence[AlertConditionTermArgs]
    type str
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    condition_scope str
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    enabled bool
    Whether the condition is enabled.
    gc_metric str
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    name str
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    runbook_url str
    Runbook URL to display in notifications.
    user_defined_metric str
    A custom metric to be evaluated.
    user_defined_value_function str
    One of: (average, min, max, total, sample_size, percent, rate).
    violation_close_timer int
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.
    entities List<Number>
    The instance IDs associated with this condition.
    metric String
    The metric field accepts parameters based on the type set.
    policyId Number
    The ID of the policy where this condition should be used.
    terms List<Property Map>
    type String
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    conditionScope String
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    enabled Boolean
    Whether the condition is enabled.
    gcMetric String
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    name String
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    runbookUrl String
    Runbook URL to display in notifications.
    userDefinedMetric String
    A custom metric to be evaluated.
    userDefinedValueFunction String
    One of: (average, min, max, total, sample_size, percent, rate).
    violationCloseTimer Number
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AlertCondition resource produces the following output properties:

    EntityGuid string
    The unique entity identifier of the condition in New Relic.
    Id string
    The provider-assigned unique ID for this managed resource.
    EntityGuid string
    The unique entity identifier of the condition in New Relic.
    Id string
    The provider-assigned unique ID for this managed resource.
    entityGuid String
    The unique entity identifier of the condition in New Relic.
    id String
    The provider-assigned unique ID for this managed resource.
    entityGuid string
    The unique entity identifier of the condition in New Relic.
    id string
    The provider-assigned unique ID for this managed resource.
    entity_guid str
    The unique entity identifier of the condition in New Relic.
    id str
    The provider-assigned unique ID for this managed resource.
    entityGuid String
    The unique entity identifier of the condition in New Relic.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing AlertCondition Resource

    Get an existing AlertCondition 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?: AlertConditionState, opts?: CustomResourceOptions): AlertCondition
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            condition_scope: Optional[str] = None,
            enabled: Optional[bool] = None,
            entities: Optional[Sequence[int]] = None,
            entity_guid: Optional[str] = None,
            gc_metric: Optional[str] = None,
            metric: Optional[str] = None,
            name: Optional[str] = None,
            policy_id: Optional[int] = None,
            runbook_url: Optional[str] = None,
            terms: Optional[Sequence[AlertConditionTermArgs]] = None,
            type: Optional[str] = None,
            user_defined_metric: Optional[str] = None,
            user_defined_value_function: Optional[str] = None,
            violation_close_timer: Optional[int] = None) -> AlertCondition
    func GetAlertCondition(ctx *Context, name string, id IDInput, state *AlertConditionState, opts ...ResourceOption) (*AlertCondition, error)
    public static AlertCondition Get(string name, Input<string> id, AlertConditionState? state, CustomResourceOptions? opts = null)
    public static AlertCondition get(String name, Output<String> id, AlertConditionState 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.
    The following state arguments are supported:
    ConditionScope string
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    Enabled bool
    Whether the condition is enabled.
    Entities List<int>
    The instance IDs associated with this condition.
    EntityGuid string
    The unique entity identifier of the condition in New Relic.
    GcMetric string
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    Metric string
    The metric field accepts parameters based on the type set.
    Name string
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    PolicyId int
    The ID of the policy where this condition should be used.
    RunbookUrl string
    Runbook URL to display in notifications.
    Terms List<Pulumi.NewRelic.Inputs.AlertConditionTerm>
    Type string
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    UserDefinedMetric string
    A custom metric to be evaluated.
    UserDefinedValueFunction string
    One of: (average, min, max, total, sample_size, percent, rate).
    ViolationCloseTimer int
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.
    ConditionScope string
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    Enabled bool
    Whether the condition is enabled.
    Entities []int
    The instance IDs associated with this condition.
    EntityGuid string
    The unique entity identifier of the condition in New Relic.
    GcMetric string
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    Metric string
    The metric field accepts parameters based on the type set.
    Name string
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    PolicyId int
    The ID of the policy where this condition should be used.
    RunbookUrl string
    Runbook URL to display in notifications.
    Terms []AlertConditionTermArgs
    Type string
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    UserDefinedMetric string
    A custom metric to be evaluated.
    UserDefinedValueFunction string
    One of: (average, min, max, total, sample_size, percent, rate).
    ViolationCloseTimer int
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.
    conditionScope String
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    enabled Boolean
    Whether the condition is enabled.
    entities List<Integer>
    The instance IDs associated with this condition.
    entityGuid String
    The unique entity identifier of the condition in New Relic.
    gcMetric String
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    metric String
    The metric field accepts parameters based on the type set.
    name String
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    policyId Integer
    The ID of the policy where this condition should be used.
    runbookUrl String
    Runbook URL to display in notifications.
    terms List<AlertConditionTerm>
    type String
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    userDefinedMetric String
    A custom metric to be evaluated.
    userDefinedValueFunction String
    One of: (average, min, max, total, sample_size, percent, rate).
    violationCloseTimer Integer
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.
    conditionScope string
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    enabled boolean
    Whether the condition is enabled.
    entities number[]
    The instance IDs associated with this condition.
    entityGuid string
    The unique entity identifier of the condition in New Relic.
    gcMetric string
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    metric string
    The metric field accepts parameters based on the type set.
    name string
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    policyId number
    The ID of the policy where this condition should be used.
    runbookUrl string
    Runbook URL to display in notifications.
    terms AlertConditionTerm[]
    type string
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    userDefinedMetric string
    A custom metric to be evaluated.
    userDefinedValueFunction string
    One of: (average, min, max, total, sample_size, percent, rate).
    violationCloseTimer number
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.
    condition_scope str
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    enabled bool
    Whether the condition is enabled.
    entities Sequence[int]
    The instance IDs associated with this condition.
    entity_guid str
    The unique entity identifier of the condition in New Relic.
    gc_metric str
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    metric str
    The metric field accepts parameters based on the type set.
    name str
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    policy_id int
    The ID of the policy where this condition should be used.
    runbook_url str
    Runbook URL to display in notifications.
    terms Sequence[AlertConditionTermArgs]
    type str
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    user_defined_metric str
    A custom metric to be evaluated.
    user_defined_value_function str
    One of: (average, min, max, total, sample_size, percent, rate).
    violation_close_timer int
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.
    conditionScope String
    One of (application, instance). Choose application for most scenarios. If you are using the JVM plugin in New Relic, the instance setting allows your condition to trigger for specific app instances.
    enabled Boolean
    Whether the condition is enabled.
    entities List<Number>
    The instance IDs associated with this condition.
    entityGuid String
    The unique entity identifier of the condition in New Relic.
    gcMetric String
    A valid Garbage Collection metric e.g. GC/G1 Young Generation. This is required if you are using apm_jvm_metric with gc_cpu_time condition type.
    metric String
    The metric field accepts parameters based on the type set.
    name String
    The title of the condition. Must be between 1 and 128 characters, inclusive.
    policyId Number
    The ID of the policy where this condition should be used.
    runbookUrl String
    Runbook URL to display in notifications.
    terms List<Property Map>
    type String
    The type of condition. One of: (apm_app_metric, apm_jvm_metric, apm_kt_metric, browser_metric, mobile_metric, servers_metric).
    userDefinedMetric String
    A custom metric to be evaluated.
    userDefinedValueFunction String
    One of: (average, min, max, total, sample_size, percent, rate).
    violationCloseTimer Number
    Automatically close instance-based incidents, including JVM health metric incidents, after the number of hours specified. Must be between 1 and 720 hours.

    Supporting Types

    AlertConditionTerm, AlertConditionTermArgs

    Duration int
    In minutes, must be in the range of 5 to 120, inclusive.
    Threshold double
    Must be 0 or greater.
    TimeFunction string
    One of (all, any).
    Operator string
    One of (above, below, equal). Defaults to equal.
    Priority string
    One of (critical, warning). Defaults to critical.
    Duration int
    In minutes, must be in the range of 5 to 120, inclusive.
    Threshold float64
    Must be 0 or greater.
    TimeFunction string
    One of (all, any).
    Operator string
    One of (above, below, equal). Defaults to equal.
    Priority string
    One of (critical, warning). Defaults to critical.
    duration Integer
    In minutes, must be in the range of 5 to 120, inclusive.
    threshold Double
    Must be 0 or greater.
    timeFunction String
    One of (all, any).
    operator String
    One of (above, below, equal). Defaults to equal.
    priority String
    One of (critical, warning). Defaults to critical.
    duration number
    In minutes, must be in the range of 5 to 120, inclusive.
    threshold number
    Must be 0 or greater.
    timeFunction string
    One of (all, any).
    operator string
    One of (above, below, equal). Defaults to equal.
    priority string
    One of (critical, warning). Defaults to critical.
    duration int
    In minutes, must be in the range of 5 to 120, inclusive.
    threshold float
    Must be 0 or greater.
    time_function str
    One of (all, any).
    operator str
    One of (above, below, equal). Defaults to equal.
    priority str
    One of (critical, warning). Defaults to critical.
    duration Number
    In minutes, must be in the range of 5 to 120, inclusive.
    threshold Number
    Must be 0 or greater.
    timeFunction String
    One of (all, any).
    operator String
    One of (above, below, equal). Defaults to equal.
    priority String
    One of (critical, warning). Defaults to critical.

    Import

    Alert conditions can be imported using notation alert_policy_id:alert_condition_id, e.g.

    $ pulumi import newrelic:index/alertCondition:AlertCondition main 123456:6789012345
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    New Relic pulumi/pulumi-newrelic
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the newrelic Terraform Provider.
    newrelic logo
    New Relic v5.23.0 published on Wednesday, Apr 24, 2024 by Pulumi