Show / Hide Table of Contents

Namespace Pulumi.NewRelic

Classes

AlertChannel

Use this resource to create and manage New Relic alert policies.

Example Usage

Email

using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            IncludeJsonAttachment = "1",
            Recipients = "foo@example.com",
        },
        Type = "email",
    });
}

}

Additional Examples

Slack
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Channel = "example-alerts-channel",
            Url = "https://<YourOrganization>.slack.com",
        },
        Type = "slack",
    });
}

}
OpsGenie
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            ApiKey = "abc123",
            Recipients = "user1@domain.com, user2@domain.com",
            Tags = "tag1, tag2",
            Teams = "team1, team2",
        },
        Type = "opsgenie",
    });
}

}
PagerDuty
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            ServiceKey = "abc123",
        },
        Type = "pagerduty",
    });
}

}
VictorOps
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Key = "abc123",
            RouteKey = "/example",
        },
        Type = "victorops",
    });
}

}
Webhook
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Type = "webhook",
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            BaseUrl = "http://www.test.com",
            PayloadType = "application/json",
            Payload = 
            {
                { "condition_name", "$CONDITION_NAME" },
                { "policy_name", "$POLICY_NAME" },
            },
            Headers = 
            {
                { "header1", value1 },
                { "header2", value2 },
            },
        },
    });
}

}
Webhook with complex payload
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertChannel("foo", new NewRelic.AlertChannelArgs
    {
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            BaseUrl = "http://www.test.com",
            PayloadString = @"{
""my_custom_values"": {
""condition_name"": ""$$CONDITION_NAME"",
""policy_name"": ""$$POLICY_NAME""
}
}

",
            PayloadType = "application/json",
        },
        Type = "webhook",
    });
}

}

AlertChannelArgs

AlertChannelState

AlertCondition

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

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.

AlertConditionArgs

AlertConditionState

AlertPolicy

Use this resource to create and manage New Relic alert policies.

Additional Examples

Provision multiple notification channels and add those channels to a policy
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    // Provision a Slack notification channel.
    var slackChannel = new NewRelic.AlertChannel("slackChannel", new NewRelic.AlertChannelArgs
    {
        Type = "slack",
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Url = "https://hooks.slack.com/services/<*****>/<*****>",
            Channel = "example-alerts-channel",
        },
    });
    // Provision an email notification channel.
    var emailChannel = new NewRelic.AlertChannel("emailChannel", new NewRelic.AlertChannelArgs
    {
        Type = "email",
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Recipients = "example@testing.com",
            IncludeJsonAttachment = "1",
        },
    });
    // Provision the alert policy.
    var policyWithChannels = new NewRelic.AlertPolicy("policyWithChannels", new NewRelic.AlertPolicyArgs
    {
        IncidentPreference = "PER_CONDITION",
        ChannelIds = 
        {
            slackChannel.Id,
            emailChannel.Id,
        },
    });
}

}

<br>

Reference existing notification channels and add those channel to a policy
using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var slackChannel = Output.Create(NewRelic.GetAlertChannel.InvokeAsync(new NewRelic.GetAlertChannelArgs
    {
        Name = &quot;slack-channel-notification&quot;,
    }));
    var emailChannel = Output.Create(NewRelic.GetAlertChannel.InvokeAsync(new NewRelic.GetAlertChannelArgs
    {
        Name = &quot;test@example.com&quot;,
    }));
    // Provision the alert policy.
    var policyWithChannels = new NewRelic.AlertPolicy(&quot;policyWithChannels&quot;, new NewRelic.AlertPolicyArgs
    {
        IncidentPreference = &quot;PER_CONDITION&quot;,
        ChannelIds = 
        {
            slackChannel.Apply(slackChannel => slackChannel.Id),
            emailChannel.Apply(emailChannel => emailChannel.Id),
        },
    });
}

}

AlertPolicyArgs

AlertPolicyChannel

Use this resource to map alert policies to alert channels in New Relic.

Example Usage

using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var examplePolicy = Output.Create(NewRelic.GetAlertPolicy.InvokeAsync(new NewRelic.GetAlertPolicyArgs
    {
        Name = &quot;my-alert-policy&quot;,
    }));
    // Creates an email alert channel.
    var emailChannel = new NewRelic.AlertChannel(&quot;emailChannel&quot;, new NewRelic.AlertChannelArgs
    {
        Type = &quot;email&quot;,
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Recipients = &quot;foo@example.com&quot;,
            IncludeJsonAttachment = &quot;1&quot;,
        },
    });
    // Creates a Slack alert channel.
    var slackChannel = new NewRelic.AlertChannel(&quot;slackChannel&quot;, new NewRelic.AlertChannelArgs
    {
        Type = &quot;slack&quot;,
        Config = new NewRelic.Inputs.AlertChannelConfigArgs
        {
            Channel = &quot;#example-channel&quot;,
            Url = &quot;http://example-org.slack.com&quot;,
        },
    });
    // Applies the created channels above to the alert policy
    // referenced at the top of the config.
    var foo = new NewRelic.AlertPolicyChannel(&quot;foo&quot;, new NewRelic.AlertPolicyChannelArgs
    {
        PolicyId = newrelic_alert_policy.Example_policy.Id,
        ChannelIds = 
        {
            emailChannel.Id,
            slackChannel.Id,
        },
    });
}

}

AlertPolicyChannelArgs

AlertPolicyChannelState

AlertPolicyState

Config

Dashboard

Use this resource to create and manage New Relic dashboards.

Attribute Refence

In addition to all arguments above, the following attributes are exported:

  • dashboard_url - The URL for viewing the dashboard.

Nested widget blocks

All nested widget blocks support the following common arguments:

  • title - (Required) A title for the widget.
  • visualization - (Required) How the widget visualizes data. Valid values are billboard, gauge, billboard_comparison, facet_bar_chart, faceted_line_chart, facet_pie_chart, facet_table, faceted_area_chart, heatmap, attribute_sheet, single_event, histogram, funnel, raw_json, event_feed, event_table, uniques_list, line_chart, comparison_line_chart, markdown, and metric_line_chart.
  • row - (Required) Row position of widget from top left, starting at 1.
  • column - (Required) Column position of widget from top left, starting at 1.
  • width - (Optional) Width of the widget. Valid values are 1 to 3 inclusive. Defaults to 1.
  • height - (Optional) Height of the widget. Valid values are 1 to 3 inclusive. Defaults to 1.
  • notes - (Optional) Description of the widget.

Each visualization type supports an additional set of arguments:

  • billboard, billboard_comparison:
  • nrql - (Required) Valid NRQL query string. See Writing NRQL Queries for help.
  • threshold_red - (Optional) Threshold above which the displayed value will be styled with a red color.
  • threshold_yellow - (Optional) Threshold above which the displayed value will be styled with a yellow color.
  • gauge:
  • nrql - (Required) Valid NRQL query string. See Writing NRQL Queries for help.
  • threshold_red - (Required) Threshold above which the displayed value will be styled with a red color.
  • threshold_yellow - (Optional) Threshold above which the displayed value will be styled with a yellow color.
  • facet_bar_chart, facet_pie_chart, facet_table, faceted_area_chart, faceted_line_chart, or heatmap:
  • nrql - (Required) Valid NRQL query string. See Writing NRQL Queries for help.
  • drilldown_dashboard_id - (Optional) The ID of a dashboard to link to from the widget's facets.
  • attribute_sheet, comparison_line_chart, event_feed, event_table, funnel, histogram, line_chart, raw_json, single_event, or uniques_list:
  • nrql - (Required) Valid NRQL query string. See Writing NRQL Queries for help.
  • markdown:
  • source - (Required) The markdown source to be rendered in the widget.
  • metric_line_chart:
  • entity_ids - (Required) A collection of entity ids to display data for. These are typically application IDs.
  • metric - (Required) A nested block that describes a metric. Nested metric blocks support the following arguments:
    • name - (Required) The metric name to display.
    • values - (Required) The metric values to display.
  • duration - (Required) The duration, in ms, of the time window represented in the chart.
  • end_time - (Optional) The end time of the time window represented in the chart in epoch time. When not set, the time window will end at the current time.
  • facet - (Optional) Can be set to "host" to facet the metric data by host.
  • limit - (Optional) The limit of distinct data series to display.
  • application_breakdown:
  • entity_ids - (Required) A collection of entity IDs to display data. These are typically application IDs.

Nested filter block

The optional filter block supports the following arguments:

  • event_types - (Optional) A list of event types to enable filtering for.
  • attributes - (Optional) A list of attributes belonging to the specified event types to enable filtering for.

DashboardArgs

DashboardState

GetAlertChannel

GetAlertChannelArgs

GetAlertChannelResult

GetAlertPolicy

GetAlertPolicyArgs

GetAlertPolicyResult

GetApplication

GetApplicationArgs

GetApplicationResult

GetKeyTransaction

GetKeyTransactionArgs

GetKeyTransactionResult

InfraAlertCondition

Use this resource to create and manage Infrastructure alert conditions in New Relic.

Example Usage

using Pulumi;
using NewRelic = Pulumi.NewRelic;

class MyStack : Stack
{
public MyStack()
{
    var foo = new NewRelic.AlertPolicy(&quot;foo&quot;, new NewRelic.AlertPolicyArgs
    {
    });
    var highDiskUsage = new NewRelic.InfraAlertCondition(&quot;highDiskUsage&quot;, new NewRelic.InfraAlertConditionArgs
    {
        PolicyId = foo.Id,
        Type = &quot;infra_metric&quot;,
        Event = &quot;StorageSample&quot;,
        Select = &quot;diskUsedPercent&quot;,
        Comparison = &quot;above&quot;,
        Where = &quot;(`hostname` LIKE &apos;%frontend%&apos;)&quot;,
        Critical = new NewRelic.Inputs.InfraAlertConditionCriticalArgs
        {
            Duration = 25,
            Value = 90,
            TimeFunction = &quot;all&quot;,
        },
        Warning = new NewRelic.Inputs.InfraAlertConditionWarningArgs
        {
            Duration = 10,
            Value = 90,
            TimeFunction = &quot;all&quot;,
        },
    });
    var highDbConnCount = new NewRelic.InfraAlertCondition(&quot;highDbConnCount&quot;, new NewRelic.InfraAlertConditionArgs
    {
        PolicyId = foo.Id,
        Type = &quot;infra_metric&quot;,
        Event = &quot;DatastoreSample&quot;,
        Select = &quot;provider.databaseConnections.Average&quot;,
        Comparison = &quot;above&quot;,
        Where = &quot;(`hostname` LIKE &apos;%db%&apos;)&quot;,
        IntegrationProvider = &quot;RdsDbInstance&quot;,
        Critical = new NewRelic.Inputs.InfraAlertConditionCriticalArgs
        {
            Duration = 25,
            Value = 90,
            TimeFunction = &quot;all&quot;,
        },
    });
    var processNotRunning = new NewRelic.InfraAlertCondition(&quot;processNotRunning&quot;, new NewRelic.InfraAlertConditionArgs
    {
        PolicyId = foo.Id,
        Type = &quot;infra_process_running&quot;,
        Comparison = &quot;equal&quot;,
        ProcessWhere = &quot;`commandName` = &apos;/usr/bin/ruby&apos;&quot;,
        Critical = new NewRelic.Inputs.InfraAlertConditionCriticalArgs
        {
            Duration = 5,
            Value = 0,
        },
    });
    var hostNotReporting = new NewRelic.InfraAlertCondition(&quot;hostNotReporting&quot;, new NewRelic.InfraAlertConditionArgs
    {
        PolicyId = foo.Id,
        Type = &quot;infra_host_not_reporting&quot;,
        Event = &quot;StorageSample&quot;,
        Select = &quot;diskUsedPercent&quot;,
        Where = &quot;(`hostname` LIKE &apos;%frontend%&apos;)&quot;,
        Critical = new NewRelic.Inputs.InfraAlertConditionCriticalArgs
        {
            Duration = 5,
        },
    });
}

}

Thresholds

The critical and warning threshold mapping supports the following arguments:

  • duration - (Required) Identifies the number of minutes the threshold must be passed or met for the alert to trigger. Threshold durations must be between 1 and 60 minutes (inclusive).
  • value - (Optional) Threshold value, computed against the comparison operator. Supported by infra_metric and infra_process_running alert condition types.
  • time_function - (Optional) Indicates if the condition needs to be sustained or to just break the threshold once; all or any. Supported by the infra_metric alert condition type.

InfraAlertConditionArgs

InfraAlertConditionState

NrqlAlertCondition

Use this resource to create and manage NRQL alert conditions in New Relic.

Terms

The term mapping supports the following arguments:

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

NRQL

The nrql attribute supports the following arguments:

  • query - (Required) The NRQL query to execute for the condition.
  • since_value - (Required) The value to be used in the SINCE &lt;X> MINUTES AGO clause for the NRQL query. Must be between 1 and 20.

NrqlAlertConditionArgs

NrqlAlertConditionState

Provider

The provider type for the newrelic package. By default, resources use package-wide configuration settings, however an explicit Provider instance may be created and passed during resource construction to achieve fine-grained programmatic control over provider settings. See the documentation for more information.

ProviderArgs

Back to top Copyright 2016-2020, Pulumi Corporation.