1. Packages
  2. Newrelic Provider
  3. API Docs
  4. getServiceLevelAlertHelper
New Relic v5.44.1 published on Tuesday, Apr 15, 2025 by Pulumi

newrelic.getServiceLevelAlertHelper

Explore with Pulumi AI

New Relic v5.44.1 published on Tuesday, Apr 15, 2025 by Pulumi

Use this data source to obtain the necessary fields to set up alerts on your service levels. It can be used for a custom alert_type in order to set up an alert with custom tolerated budget consumption and custom evaluation period or for recommended ones like fast_burn or slow_burn. For more information check the documentation.

Example Usage

Firstly set up your service level objective, we recommend using local variables for the target and time_window.rolling.count, as they are also necessary for the helper.

import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";

const fooTarget = 99.9;
const fooPeriod = 28;
const foo = new newrelic.ServiceLevel("foo", {
    guid: "MXxBUE18QVBQTElDQVRJT058MQ",
    name: "Latency",
    description: "Proportion of requests that are served faster than a threshold.",
    events: {
        accountId: "12345678",
        validEvents: {
            from: "Transaction",
            where: "appName = 'Example application' AND (transactionType='Web')",
        },
        badEvents: {
            from: "Transaction",
            where: "appName = 'Example application' AND (transactionType= 'Web') AND duration > 0.1",
        },
    },
    objective: {
        target: fooTarget,
        timeWindow: {
            rolling: {
                count: fooPeriod,
                unit: "DAY",
            },
        },
    },
});
Copy
import pulumi
import pulumi_newrelic as newrelic

foo_target = 99.9
foo_period = 28
foo = newrelic.ServiceLevel("foo",
    guid="MXxBUE18QVBQTElDQVRJT058MQ",
    name="Latency",
    description="Proportion of requests that are served faster than a threshold.",
    events={
        "account_id": "12345678",
        "valid_events": {
            "from_": "Transaction",
            "where": "appName = 'Example application' AND (transactionType='Web')",
        },
        "bad_events": {
            "from_": "Transaction",
            "where": "appName = 'Example application' AND (transactionType= 'Web') AND duration > 0.1",
        },
    },
    objective={
        "target": foo_target,
        "time_window": {
            "rolling": {
                "count": foo_period,
                "unit": "DAY",
            },
        },
    })
Copy
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 {
		fooTarget := 99.9
		fooPeriod := 28
		_, err := newrelic.NewServiceLevel(ctx, "foo", &newrelic.ServiceLevelArgs{
			Guid:        pulumi.String("MXxBUE18QVBQTElDQVRJT058MQ"),
			Name:        pulumi.String("Latency"),
			Description: pulumi.String("Proportion of requests that are served faster than a threshold."),
			Events: &newrelic.ServiceLevelEventsArgs{
				AccountId: pulumi.String("12345678"),
				ValidEvents: &newrelic.ServiceLevelEventsValidEventsArgs{
					From:  pulumi.String("Transaction"),
					Where: pulumi.String("appName = 'Example application' AND (transactionType='Web')"),
				},
				BadEvents: &newrelic.ServiceLevelEventsBadEventsArgs{
					From:  pulumi.String("Transaction"),
					Where: pulumi.String("appName = 'Example application' AND (transactionType= 'Web') AND duration > 0.1"),
				},
			},
			Objective: &newrelic.ServiceLevelObjectiveArgs{
				Target: pulumi.Float64(fooTarget),
				TimeWindow: &newrelic.ServiceLevelObjectiveTimeWindowArgs{
					Rolling: &newrelic.ServiceLevelObjectiveTimeWindowRollingArgs{
						Count: pulumi.Float64(fooPeriod),
						Unit:  pulumi.String("DAY"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using NewRelic = Pulumi.NewRelic;

return await Deployment.RunAsync(() => 
{
    var fooTarget = 99.9;

    var fooPeriod = 28;

    var foo = new NewRelic.ServiceLevel("foo", new()
    {
        Guid = "MXxBUE18QVBQTElDQVRJT058MQ",
        Name = "Latency",
        Description = "Proportion of requests that are served faster than a threshold.",
        Events = new NewRelic.Inputs.ServiceLevelEventsArgs
        {
            AccountId = "12345678",
            ValidEvents = new NewRelic.Inputs.ServiceLevelEventsValidEventsArgs
            {
                From = "Transaction",
                Where = "appName = 'Example application' AND (transactionType='Web')",
            },
            BadEvents = new NewRelic.Inputs.ServiceLevelEventsBadEventsArgs
            {
                From = "Transaction",
                Where = "appName = 'Example application' AND (transactionType= 'Web') AND duration > 0.1",
            },
        },
        Objective = new NewRelic.Inputs.ServiceLevelObjectiveArgs
        {
            Target = fooTarget,
            TimeWindow = new NewRelic.Inputs.ServiceLevelObjectiveTimeWindowArgs
            {
                Rolling = new NewRelic.Inputs.ServiceLevelObjectiveTimeWindowRollingArgs
                {
                    Count = fooPeriod,
                    Unit = "DAY",
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.newrelic.ServiceLevel;
import com.pulumi.newrelic.ServiceLevelArgs;
import com.pulumi.newrelic.inputs.ServiceLevelEventsArgs;
import com.pulumi.newrelic.inputs.ServiceLevelEventsValidEventsArgs;
import com.pulumi.newrelic.inputs.ServiceLevelEventsBadEventsArgs;
import com.pulumi.newrelic.inputs.ServiceLevelObjectiveArgs;
import com.pulumi.newrelic.inputs.ServiceLevelObjectiveTimeWindowArgs;
import com.pulumi.newrelic.inputs.ServiceLevelObjectiveTimeWindowRollingArgs;
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 fooTarget = 99.9;

        final var fooPeriod = 28;

        var foo = new ServiceLevel("foo", ServiceLevelArgs.builder()
            .guid("MXxBUE18QVBQTElDQVRJT058MQ")
            .name("Latency")
            .description("Proportion of requests that are served faster than a threshold.")
            .events(ServiceLevelEventsArgs.builder()
                .accountId("12345678")
                .validEvents(ServiceLevelEventsValidEventsArgs.builder()
                    .from("Transaction")
                    .where("appName = 'Example application' AND (transactionType='Web')")
                    .build())
                .badEvents(ServiceLevelEventsBadEventsArgs.builder()
                    .from("Transaction")
                    .where("appName = 'Example application' AND (transactionType= 'Web') AND duration > 0.1")
                    .build())
                .build())
            .objective(ServiceLevelObjectiveArgs.builder()
                .target(fooTarget)
                .timeWindow(ServiceLevelObjectiveTimeWindowArgs.builder()
                    .rolling(ServiceLevelObjectiveTimeWindowRollingArgs.builder()
                        .count(fooPeriod)
                        .unit("DAY")
                        .build())
                    .build())
                .build())
            .build());

    }
}
Copy
resources:
  foo:
    type: newrelic:ServiceLevel
    properties:
      guid: MXxBUE18QVBQTElDQVRJT058MQ
      name: Latency
      description: Proportion of requests that are served faster than a threshold.
      events:
        accountId: 1.2345678e+07
        validEvents:
          from: Transaction
          where: appName = 'Example application' AND (transactionType='Web')
        badEvents:
          from: Transaction
          where: appName = 'Example application' AND (transactionType= 'Web') AND duration > 0.1
      objective:
        target: ${fooTarget}
        timeWindow:
          rolling:
            count: ${fooPeriod}
            unit: DAY
variables:
  fooTarget: 99.9
  fooPeriod: 28
Copy

Then use the helper to obtain the necessary fields to set up an alert on that Service Level. Note that the Service Level was set up using bad events, that’s why is_bad_events is set to true. If the Service Level was configured with good events that would be unnecessary as the field defaults to false.

Here is an example of a slow_burn alert.

import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";

const fooSlowBurn = newrelic.getServiceLevelAlertHelper({
    alertType: "slow_burn",
    sliGuid: foo.sliGuid,
    sloTarget: fooTarget,
    sloPeriod: fooPeriod,
    isBadEvents: true,
});
const yourCondition = new newrelic.NrqlAlertCondition("your_condition", {
    accountId: "12345678",
    policyId: "67890",
    type: "static",
    name: "Slow burn alert",
    enabled: true,
    violationTimeLimitSeconds: 259200,
    nrql: {
        query: fooSlowBurn.then(fooSlowBurn => fooSlowBurn.nrql),
    },
    critical: {
        operator: "above_or_equals",
        threshold: fooSlowBurn.then(fooSlowBurn => fooSlowBurn.threshold),
        thresholdDuration: 900,
        thresholdOccurrences: "at_least_once",
    },
    fillOption: "none",
    aggregationWindow: fooSlowBurn.then(fooSlowBurn => fooSlowBurn.evaluationPeriod),
    aggregationMethod: "event_flow",
    aggregationDelay: "120",
    slideBy: 900,
});
Copy
import pulumi
import pulumi_newrelic as newrelic

foo_slow_burn = newrelic.get_service_level_alert_helper(alert_type="slow_burn",
    sli_guid=foo["sliGuid"],
    slo_target=foo_target,
    slo_period=foo_period,
    is_bad_events=True)
your_condition = newrelic.NrqlAlertCondition("your_condition",
    account_id="12345678",
    policy_id="67890",
    type="static",
    name="Slow burn alert",
    enabled=True,
    violation_time_limit_seconds=259200,
    nrql={
        "query": foo_slow_burn.nrql,
    },
    critical={
        "operator": "above_or_equals",
        "threshold": foo_slow_burn.threshold,
        "threshold_duration": 900,
        "threshold_occurrences": "at_least_once",
    },
    fill_option="none",
    aggregation_window=foo_slow_burn.evaluation_period,
    aggregation_method="event_flow",
    aggregation_delay="120",
    slide_by=900)
Copy
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 {
		fooSlowBurn, err := newrelic.GetServiceLevelAlertHelper(ctx, &newrelic.GetServiceLevelAlertHelperArgs{
			AlertType:   "slow_burn",
			SliGuid:     foo.SliGuid,
			SloTarget:   fooTarget,
			SloPeriod:   fooPeriod,
			IsBadEvents: pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		_, err = newrelic.NewNrqlAlertCondition(ctx, "your_condition", &newrelic.NrqlAlertConditionArgs{
			AccountId:                 pulumi.String("12345678"),
			PolicyId:                  pulumi.String("67890"),
			Type:                      pulumi.String("static"),
			Name:                      pulumi.String("Slow burn alert"),
			Enabled:                   pulumi.Bool(true),
			ViolationTimeLimitSeconds: pulumi.Int(259200),
			Nrql: &newrelic.NrqlAlertConditionNrqlArgs{
				Query: pulumi.String(fooSlowBurn.Nrql),
			},
			Critical: &newrelic.NrqlAlertConditionCriticalArgs{
				Operator:             pulumi.String("above_or_equals"),
				Threshold:            pulumi.Float64(fooSlowBurn.Threshold),
				ThresholdDuration:    pulumi.Int(900),
				ThresholdOccurrences: pulumi.String("at_least_once"),
			},
			FillOption:        pulumi.String("none"),
			AggregationWindow: pulumi.Int(fooSlowBurn.EvaluationPeriod),
			AggregationMethod: pulumi.String("event_flow"),
			AggregationDelay:  pulumi.String("120"),
			SlideBy:           pulumi.Int(900),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using NewRelic = Pulumi.NewRelic;

return await Deployment.RunAsync(() => 
{
    var fooSlowBurn = NewRelic.GetServiceLevelAlertHelper.Invoke(new()
    {
        AlertType = "slow_burn",
        SliGuid = foo.SliGuid,
        SloTarget = fooTarget,
        SloPeriod = fooPeriod,
        IsBadEvents = true,
    });

    var yourCondition = new NewRelic.NrqlAlertCondition("your_condition", new()
    {
        AccountId = "12345678",
        PolicyId = "67890",
        Type = "static",
        Name = "Slow burn alert",
        Enabled = true,
        ViolationTimeLimitSeconds = 259200,
        Nrql = new NewRelic.Inputs.NrqlAlertConditionNrqlArgs
        {
            Query = fooSlowBurn.Apply(getServiceLevelAlertHelperResult => getServiceLevelAlertHelperResult.Nrql),
        },
        Critical = new NewRelic.Inputs.NrqlAlertConditionCriticalArgs
        {
            Operator = "above_or_equals",
            Threshold = fooSlowBurn.Apply(getServiceLevelAlertHelperResult => getServiceLevelAlertHelperResult.Threshold),
            ThresholdDuration = 900,
            ThresholdOccurrences = "at_least_once",
        },
        FillOption = "none",
        AggregationWindow = fooSlowBurn.Apply(getServiceLevelAlertHelperResult => getServiceLevelAlertHelperResult.EvaluationPeriod),
        AggregationMethod = "event_flow",
        AggregationDelay = "120",
        SlideBy = 900,
    });

});
Copy
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.GetServiceLevelAlertHelperArgs;
import com.pulumi.newrelic.NrqlAlertCondition;
import com.pulumi.newrelic.NrqlAlertConditionArgs;
import com.pulumi.newrelic.inputs.NrqlAlertConditionNrqlArgs;
import com.pulumi.newrelic.inputs.NrqlAlertConditionCriticalArgs;
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 fooSlowBurn = NewrelicFunctions.getServiceLevelAlertHelper(GetServiceLevelAlertHelperArgs.builder()
            .alertType("slow_burn")
            .sliGuid(foo.sliGuid())
            .sloTarget(fooTarget)
            .sloPeriod(fooPeriod)
            .isBadEvents(true)
            .build());

        var yourCondition = new NrqlAlertCondition("yourCondition", NrqlAlertConditionArgs.builder()
            .accountId("12345678")
            .policyId("67890")
            .type("static")
            .name("Slow burn alert")
            .enabled(true)
            .violationTimeLimitSeconds(259200)
            .nrql(NrqlAlertConditionNrqlArgs.builder()
                .query(fooSlowBurn.nrql())
                .build())
            .critical(NrqlAlertConditionCriticalArgs.builder()
                .operator("above_or_equals")
                .threshold(fooSlowBurn.threshold())
                .thresholdDuration(900)
                .thresholdOccurrences("at_least_once")
                .build())
            .fillOption("none")
            .aggregationWindow(fooSlowBurn.evaluationPeriod())
            .aggregationMethod("event_flow")
            .aggregationDelay("120")
            .slideBy(900)
            .build());

    }
}
Copy
resources:
  yourCondition:
    type: newrelic:NrqlAlertCondition
    name: your_condition
    properties:
      accountId: 1.2345678e+07
      policyId: 67890
      type: static
      name: Slow burn alert
      enabled: true
      violationTimeLimitSeconds: 259200
      nrql:
        query: ${fooSlowBurn.nrql}
      critical:
        operator: above_or_equals
        threshold: ${fooSlowBurn.threshold}
        thresholdDuration: 900
        thresholdOccurrences: at_least_once
      fillOption: none
      aggregationWindow: ${fooSlowBurn.evaluationPeriod}
      aggregationMethod: event_flow
      aggregationDelay: 120
      slideBy: 900
variables:
  fooSlowBurn:
    fn::invoke:
      function: newrelic:getServiceLevelAlertHelper
      arguments:
        alertType: slow_burn
        sliGuid: ${foo.sliGuid}
        sloTarget: ${fooTarget}
        sloPeriod: ${fooPeriod}
        isBadEvents: true
Copy

Here is an example of a custom alert:

import * as pulumi from "@pulumi/pulumi";
import * as newrelic from "@pulumi/newrelic";

const fooCustom = newrelic.getServiceLevelAlertHelper({
    alertType: "custom",
    sliGuid: foo.sliGuid,
    sloTarget: fooTarget,
    sloPeriod: fooPeriod,
    customToleratedBudgetConsumption: 4,
    customEvaluationPeriod: 5400,
    isBadEvents: true,
});
const yourCondition = new newrelic.NrqlAlertCondition("your_condition", {
    accountId: "12345678",
    policyId: "67890",
    type: "static",
    name: "Custom burn alert",
    enabled: true,
    violationTimeLimitSeconds: 259200,
    nrql: {
        query: fooCustom.then(fooCustom => fooCustom.nrql),
    },
    critical: {
        operator: "above_or_equals",
        threshold: fooCustom.then(fooCustom => fooCustom.threshold),
        thresholdDuration: 900,
        thresholdOccurrences: "at_least_once",
    },
    fillOption: "none",
    aggregationWindow: fooCustom.then(fooCustom => fooCustom.evaluationPeriod),
    aggregationMethod: "event_flow",
    aggregationDelay: "120",
    slideBy: 60,
});
Copy
import pulumi
import pulumi_newrelic as newrelic

foo_custom = newrelic.get_service_level_alert_helper(alert_type="custom",
    sli_guid=foo["sliGuid"],
    slo_target=foo_target,
    slo_period=foo_period,
    custom_tolerated_budget_consumption=4,
    custom_evaluation_period=5400,
    is_bad_events=True)
your_condition = newrelic.NrqlAlertCondition("your_condition",
    account_id="12345678",
    policy_id="67890",
    type="static",
    name="Custom burn alert",
    enabled=True,
    violation_time_limit_seconds=259200,
    nrql={
        "query": foo_custom.nrql,
    },
    critical={
        "operator": "above_or_equals",
        "threshold": foo_custom.threshold,
        "threshold_duration": 900,
        "threshold_occurrences": "at_least_once",
    },
    fill_option="none",
    aggregation_window=foo_custom.evaluation_period,
    aggregation_method="event_flow",
    aggregation_delay="120",
    slide_by=60)
Copy
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 {
		fooCustom, err := newrelic.GetServiceLevelAlertHelper(ctx, &newrelic.GetServiceLevelAlertHelperArgs{
			AlertType:                        "custom",
			SliGuid:                          foo.SliGuid,
			SloTarget:                        fooTarget,
			SloPeriod:                        fooPeriod,
			CustomToleratedBudgetConsumption: pulumi.Float64Ref(4),
			CustomEvaluationPeriod:           pulumi.IntRef(5400),
			IsBadEvents:                      pulumi.BoolRef(true),
		}, nil)
		if err != nil {
			return err
		}
		_, err = newrelic.NewNrqlAlertCondition(ctx, "your_condition", &newrelic.NrqlAlertConditionArgs{
			AccountId:                 pulumi.String("12345678"),
			PolicyId:                  pulumi.String("67890"),
			Type:                      pulumi.String("static"),
			Name:                      pulumi.String("Custom burn alert"),
			Enabled:                   pulumi.Bool(true),
			ViolationTimeLimitSeconds: pulumi.Int(259200),
			Nrql: &newrelic.NrqlAlertConditionNrqlArgs{
				Query: pulumi.String(fooCustom.Nrql),
			},
			Critical: &newrelic.NrqlAlertConditionCriticalArgs{
				Operator:             pulumi.String("above_or_equals"),
				Threshold:            pulumi.Float64(fooCustom.Threshold),
				ThresholdDuration:    pulumi.Int(900),
				ThresholdOccurrences: pulumi.String("at_least_once"),
			},
			FillOption:        pulumi.String("none"),
			AggregationWindow: pulumi.Int(fooCustom.EvaluationPeriod),
			AggregationMethod: pulumi.String("event_flow"),
			AggregationDelay:  pulumi.String("120"),
			SlideBy:           pulumi.Int(60),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using NewRelic = Pulumi.NewRelic;

return await Deployment.RunAsync(() => 
{
    var fooCustom = NewRelic.GetServiceLevelAlertHelper.Invoke(new()
    {
        AlertType = "custom",
        SliGuid = foo.SliGuid,
        SloTarget = fooTarget,
        SloPeriod = fooPeriod,
        CustomToleratedBudgetConsumption = 4,
        CustomEvaluationPeriod = 5400,
        IsBadEvents = true,
    });

    var yourCondition = new NewRelic.NrqlAlertCondition("your_condition", new()
    {
        AccountId = "12345678",
        PolicyId = "67890",
        Type = "static",
        Name = "Custom burn alert",
        Enabled = true,
        ViolationTimeLimitSeconds = 259200,
        Nrql = new NewRelic.Inputs.NrqlAlertConditionNrqlArgs
        {
            Query = fooCustom.Apply(getServiceLevelAlertHelperResult => getServiceLevelAlertHelperResult.Nrql),
        },
        Critical = new NewRelic.Inputs.NrqlAlertConditionCriticalArgs
        {
            Operator = "above_or_equals",
            Threshold = fooCustom.Apply(getServiceLevelAlertHelperResult => getServiceLevelAlertHelperResult.Threshold),
            ThresholdDuration = 900,
            ThresholdOccurrences = "at_least_once",
        },
        FillOption = "none",
        AggregationWindow = fooCustom.Apply(getServiceLevelAlertHelperResult => getServiceLevelAlertHelperResult.EvaluationPeriod),
        AggregationMethod = "event_flow",
        AggregationDelay = "120",
        SlideBy = 60,
    });

});
Copy
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.GetServiceLevelAlertHelperArgs;
import com.pulumi.newrelic.NrqlAlertCondition;
import com.pulumi.newrelic.NrqlAlertConditionArgs;
import com.pulumi.newrelic.inputs.NrqlAlertConditionNrqlArgs;
import com.pulumi.newrelic.inputs.NrqlAlertConditionCriticalArgs;
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 fooCustom = NewrelicFunctions.getServiceLevelAlertHelper(GetServiceLevelAlertHelperArgs.builder()
            .alertType("custom")
            .sliGuid(foo.sliGuid())
            .sloTarget(fooTarget)
            .sloPeriod(fooPeriod)
            .customToleratedBudgetConsumption(4)
            .customEvaluationPeriod(5400)
            .isBadEvents(true)
            .build());

        var yourCondition = new NrqlAlertCondition("yourCondition", NrqlAlertConditionArgs.builder()
            .accountId("12345678")
            .policyId("67890")
            .type("static")
            .name("Custom burn alert")
            .enabled(true)
            .violationTimeLimitSeconds(259200)
            .nrql(NrqlAlertConditionNrqlArgs.builder()
                .query(fooCustom.nrql())
                .build())
            .critical(NrqlAlertConditionCriticalArgs.builder()
                .operator("above_or_equals")
                .threshold(fooCustom.threshold())
                .thresholdDuration(900)
                .thresholdOccurrences("at_least_once")
                .build())
            .fillOption("none")
            .aggregationWindow(fooCustom.evaluationPeriod())
            .aggregationMethod("event_flow")
            .aggregationDelay("120")
            .slideBy(60)
            .build());

    }
}
Copy
resources:
  yourCondition:
    type: newrelic:NrqlAlertCondition
    name: your_condition
    properties:
      accountId: 1.2345678e+07
      policyId: 67890
      type: static
      name: Custom burn alert
      enabled: true
      violationTimeLimitSeconds: 259200
      nrql:
        query: ${fooCustom.nrql}
      critical:
        operator: above_or_equals
        threshold: ${fooCustom.threshold}
        thresholdDuration: 900
        thresholdOccurrences: at_least_once
      fillOption: none
      aggregationWindow: ${fooCustom.evaluationPeriod}
      aggregationMethod: event_flow
      aggregationDelay: 120
      slideBy: 60
variables:
  fooCustom:
    fn::invoke:
      function: newrelic:getServiceLevelAlertHelper
      arguments:
        alertType: custom
        sliGuid: ${foo.sliGuid}
        sloTarget: ${fooTarget}
        sloPeriod: ${fooPeriod}
        customToleratedBudgetConsumption: 4
        customEvaluationPeriod: 5400
        isBadEvents: true
Copy

Using getServiceLevelAlertHelper

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getServiceLevelAlertHelper(args: GetServiceLevelAlertHelperArgs, opts?: InvokeOptions): Promise<GetServiceLevelAlertHelperResult>
function getServiceLevelAlertHelperOutput(args: GetServiceLevelAlertHelperOutputArgs, opts?: InvokeOptions): Output<GetServiceLevelAlertHelperResult>
Copy
def get_service_level_alert_helper(alert_type: Optional[str] = None,
                                   custom_evaluation_period: Optional[int] = None,
                                   custom_tolerated_budget_consumption: Optional[float] = None,
                                   is_bad_events: Optional[bool] = None,
                                   sli_guid: Optional[str] = None,
                                   slo_period: Optional[int] = None,
                                   slo_target: Optional[float] = None,
                                   opts: Optional[InvokeOptions] = None) -> GetServiceLevelAlertHelperResult
def get_service_level_alert_helper_output(alert_type: Optional[pulumi.Input[str]] = None,
                                   custom_evaluation_period: Optional[pulumi.Input[int]] = None,
                                   custom_tolerated_budget_consumption: Optional[pulumi.Input[float]] = None,
                                   is_bad_events: Optional[pulumi.Input[bool]] = None,
                                   sli_guid: Optional[pulumi.Input[str]] = None,
                                   slo_period: Optional[pulumi.Input[int]] = None,
                                   slo_target: Optional[pulumi.Input[float]] = None,
                                   opts: Optional[InvokeOptions] = None) -> Output[GetServiceLevelAlertHelperResult]
Copy
func GetServiceLevelAlertHelper(ctx *Context, args *GetServiceLevelAlertHelperArgs, opts ...InvokeOption) (*GetServiceLevelAlertHelperResult, error)
func GetServiceLevelAlertHelperOutput(ctx *Context, args *GetServiceLevelAlertHelperOutputArgs, opts ...InvokeOption) GetServiceLevelAlertHelperResultOutput
Copy

> Note: This function is named GetServiceLevelAlertHelper in the Go SDK.

public static class GetServiceLevelAlertHelper 
{
    public static Task<GetServiceLevelAlertHelperResult> InvokeAsync(GetServiceLevelAlertHelperArgs args, InvokeOptions? opts = null)
    public static Output<GetServiceLevelAlertHelperResult> Invoke(GetServiceLevelAlertHelperInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetServiceLevelAlertHelperResult> getServiceLevelAlertHelper(GetServiceLevelAlertHelperArgs args, InvokeOptions options)
public static Output<GetServiceLevelAlertHelperResult> getServiceLevelAlertHelper(GetServiceLevelAlertHelperArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: newrelic:index/getServiceLevelAlertHelper:getServiceLevelAlertHelper
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

AlertType This property is required. string
The type of alert we want to set. Valid values are:
SliGuid This property is required. string
The guid of the sli we want to set the alert on.
SloPeriod This property is required. int
The time window of the Service Level Objective in days. Valid values are 1, 7 and 28.
SloTarget This property is required. double
The target of the Service Level Objective, valid values between 0 and 100.
CustomEvaluationPeriod int
Aggregation window taken into consideration in seconds. Mandatory if alert_type is custom.
CustomToleratedBudgetConsumption double
How much budget you tolerate to consume during the custom evaluation period, valid values between 0 and 100. Mandatory if alert_type is custom.
IsBadEvents bool
If the SLI is defined using bad events. Defaults to false
AlertType This property is required. string
The type of alert we want to set. Valid values are:
SliGuid This property is required. string
The guid of the sli we want to set the alert on.
SloPeriod This property is required. int
The time window of the Service Level Objective in days. Valid values are 1, 7 and 28.
SloTarget This property is required. float64
The target of the Service Level Objective, valid values between 0 and 100.
CustomEvaluationPeriod int
Aggregation window taken into consideration in seconds. Mandatory if alert_type is custom.
CustomToleratedBudgetConsumption float64
How much budget you tolerate to consume during the custom evaluation period, valid values between 0 and 100. Mandatory if alert_type is custom.
IsBadEvents bool
If the SLI is defined using bad events. Defaults to false
alertType This property is required. String
The type of alert we want to set. Valid values are:
sliGuid This property is required. String
The guid of the sli we want to set the alert on.
sloPeriod This property is required. Integer
The time window of the Service Level Objective in days. Valid values are 1, 7 and 28.
sloTarget This property is required. Double
The target of the Service Level Objective, valid values between 0 and 100.
customEvaluationPeriod Integer
Aggregation window taken into consideration in seconds. Mandatory if alert_type is custom.
customToleratedBudgetConsumption Double
How much budget you tolerate to consume during the custom evaluation period, valid values between 0 and 100. Mandatory if alert_type is custom.
isBadEvents Boolean
If the SLI is defined using bad events. Defaults to false
alertType This property is required. string
The type of alert we want to set. Valid values are:
sliGuid This property is required. string
The guid of the sli we want to set the alert on.
sloPeriod This property is required. number
The time window of the Service Level Objective in days. Valid values are 1, 7 and 28.
sloTarget This property is required. number
The target of the Service Level Objective, valid values between 0 and 100.
customEvaluationPeriod number
Aggregation window taken into consideration in seconds. Mandatory if alert_type is custom.
customToleratedBudgetConsumption number
How much budget you tolerate to consume during the custom evaluation period, valid values between 0 and 100. Mandatory if alert_type is custom.
isBadEvents boolean
If the SLI is defined using bad events. Defaults to false
alert_type This property is required. str
The type of alert we want to set. Valid values are:
sli_guid This property is required. str
The guid of the sli we want to set the alert on.
slo_period This property is required. int
The time window of the Service Level Objective in days. Valid values are 1, 7 and 28.
slo_target This property is required. float
The target of the Service Level Objective, valid values between 0 and 100.
custom_evaluation_period int
Aggregation window taken into consideration in seconds. Mandatory if alert_type is custom.
custom_tolerated_budget_consumption float
How much budget you tolerate to consume during the custom evaluation period, valid values between 0 and 100. Mandatory if alert_type is custom.
is_bad_events bool
If the SLI is defined using bad events. Defaults to false
alertType This property is required. String
The type of alert we want to set. Valid values are:
sliGuid This property is required. String
The guid of the sli we want to set the alert on.
sloPeriod This property is required. Number
The time window of the Service Level Objective in days. Valid values are 1, 7 and 28.
sloTarget This property is required. Number
The target of the Service Level Objective, valid values between 0 and 100.
customEvaluationPeriod Number
Aggregation window taken into consideration in seconds. Mandatory if alert_type is custom.
customToleratedBudgetConsumption Number
How much budget you tolerate to consume during the custom evaluation period, valid values between 0 and 100. Mandatory if alert_type is custom.
isBadEvents Boolean
If the SLI is defined using bad events. Defaults to false

getServiceLevelAlertHelper Result

The following output properties are available:

AlertType string
EvaluationPeriod int
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_evaluation_period.
Id string
The provider-assigned unique ID for this managed resource.
Nrql string
(Computed) The nrql query for the selected type of alert.
SliGuid string
SloPeriod int
SloTarget double
Threshold double
(Computed) The computed threshold given the provided arguments.
ToleratedBudgetConsumption double
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_tolerated_budget_consumption.
CustomEvaluationPeriod int
CustomToleratedBudgetConsumption double
IsBadEvents bool
AlertType string
EvaluationPeriod int
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_evaluation_period.
Id string
The provider-assigned unique ID for this managed resource.
Nrql string
(Computed) The nrql query for the selected type of alert.
SliGuid string
SloPeriod int
SloTarget float64
Threshold float64
(Computed) The computed threshold given the provided arguments.
ToleratedBudgetConsumption float64
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_tolerated_budget_consumption.
CustomEvaluationPeriod int
CustomToleratedBudgetConsumption float64
IsBadEvents bool
alertType String
evaluationPeriod Integer
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_evaluation_period.
id String
The provider-assigned unique ID for this managed resource.
nrql String
(Computed) The nrql query for the selected type of alert.
sliGuid String
sloPeriod Integer
sloTarget Double
threshold Double
(Computed) The computed threshold given the provided arguments.
toleratedBudgetConsumption Double
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_tolerated_budget_consumption.
customEvaluationPeriod Integer
customToleratedBudgetConsumption Double
isBadEvents Boolean
alertType string
evaluationPeriod number
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_evaluation_period.
id string
The provider-assigned unique ID for this managed resource.
nrql string
(Computed) The nrql query for the selected type of alert.
sliGuid string
sloPeriod number
sloTarget number
threshold number
(Computed) The computed threshold given the provided arguments.
toleratedBudgetConsumption number
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_tolerated_budget_consumption.
customEvaluationPeriod number
customToleratedBudgetConsumption number
isBadEvents boolean
alert_type str
evaluation_period int
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_evaluation_period.
id str
The provider-assigned unique ID for this managed resource.
nrql str
(Computed) The nrql query for the selected type of alert.
sli_guid str
slo_period int
slo_target float
threshold float
(Computed) The computed threshold given the provided arguments.
tolerated_budget_consumption float
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_tolerated_budget_consumption.
custom_evaluation_period int
custom_tolerated_budget_consumption float
is_bad_events bool
alertType String
evaluationPeriod Number
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_evaluation_period.
id String
The provider-assigned unique ID for this managed resource.
nrql String
(Computed) The nrql query for the selected type of alert.
sliGuid String
sloPeriod Number
sloTarget Number
threshold Number
(Computed) The computed threshold given the provided arguments.
toleratedBudgetConsumption Number
(Computed) For non custom alert_type, this is the recommended for that type of alert. For custom alert_type it has the same value as custom_tolerated_budget_consumption.
customEvaluationPeriod Number
customToleratedBudgetConsumption Number
isBadEvents Boolean

Package Details

Repository
New Relic pulumi/pulumi-newrelic
License
Apache-2.0
Notes
This Pulumi package is based on the newrelic Terraform Provider.
New Relic v5.44.1 published on Tuesday, Apr 15, 2025 by Pulumi