Namespace Pulumi.NewRelic
Classes
AlertChannel
Use this resource to create and manage New Relic alert policies.
Example Usage
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 of5to120, inclusive.operator- (Optional)above,below, orequal. Defaults toequal.priority- (Optional)criticalorwarning. Defaults tocritical. Terms must include at least onecriticalpriority termthreshold- (Required) Must be 0 or greater.time_function- (Required)allorany.
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 = "slack-channel-notification",
}));
var emailChannel = Output.Create(NewRelic.GetAlertChannel.InvokeAsync(new NewRelic.GetAlertChannelArgs
{
Name = "test@example.com",
}));
// Provision the alert policy.
var policyWithChannels = new NewRelic.AlertPolicy("policyWithChannels", new NewRelic.AlertPolicyArgs
{
IncidentPreference = "PER_CONDITION",
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 = "my-alert-policy",
}));
// Creates an email alert channel.
var emailChannel = new NewRelic.AlertChannel("emailChannel", new NewRelic.AlertChannelArgs
{
Type = "email",
Config = new NewRelic.Inputs.AlertChannelConfigArgs
{
Recipients = "foo@example.com",
IncludeJsonAttachment = "1",
},
});
// Creates a Slack alert channel.
var slackChannel = new NewRelic.AlertChannel("slackChannel", new NewRelic.AlertChannelArgs
{
Type = "slack",
Config = new NewRelic.Inputs.AlertChannelConfigArgs
{
Channel = "#example-channel",
Url = "http://example-org.slack.com",
},
});
// Applies the created channels above to the alert policy
// referenced at the top of the config.
var foo = new NewRelic.AlertPolicyChannel("foo", 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 arebillboard,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, andmetric_line_chart.row- (Required) Row position of widget from top left, starting at1.column- (Required) Column position of widget from top left, starting at1.width- (Optional) Width of the widget. Valid values are1to3inclusive. Defaults to1.height- (Optional) Height of the widget. Valid values are1to3inclusive. Defaults to1.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, orheatmap: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, oruniques_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. Nestedmetricblocks 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("foo", new NewRelic.AlertPolicyArgs
{
});
var highDiskUsage = new NewRelic.InfraAlertCondition("highDiskUsage", new NewRelic.InfraAlertConditionArgs
{
PolicyId = foo.Id,
Type = "infra_metric",
Event = "StorageSample",
Select = "diskUsedPercent",
Comparison = "above",
Where = "(`hostname` LIKE '%frontend%')",
Critical = new NewRelic.Inputs.InfraAlertConditionCriticalArgs
{
Duration = 25,
Value = 90,
TimeFunction = "all",
},
Warning = new NewRelic.Inputs.InfraAlertConditionWarningArgs
{
Duration = 10,
Value = 90,
TimeFunction = "all",
},
});
var highDbConnCount = new NewRelic.InfraAlertCondition("highDbConnCount", new NewRelic.InfraAlertConditionArgs
{
PolicyId = foo.Id,
Type = "infra_metric",
Event = "DatastoreSample",
Select = "provider.databaseConnections.Average",
Comparison = "above",
Where = "(`hostname` LIKE '%db%')",
IntegrationProvider = "RdsDbInstance",
Critical = new NewRelic.Inputs.InfraAlertConditionCriticalArgs
{
Duration = 25,
Value = 90,
TimeFunction = "all",
},
});
var processNotRunning = new NewRelic.InfraAlertCondition("processNotRunning", new NewRelic.InfraAlertConditionArgs
{
PolicyId = foo.Id,
Type = "infra_process_running",
Comparison = "equal",
ProcessWhere = "`commandName` = '/usr/bin/ruby'",
Critical = new NewRelic.Inputs.InfraAlertConditionCriticalArgs
{
Duration = 5,
Value = 0,
},
});
var hostNotReporting = new NewRelic.InfraAlertCondition("hostNotReporting", new NewRelic.InfraAlertConditionArgs
{
PolicyId = foo.Id,
Type = "infra_host_not_reporting",
Event = "StorageSample",
Select = "diskUsedPercent",
Where = "(`hostname` LIKE '%frontend%')",
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 thecomparisonoperator. Supported byinfra_metricandinfra_process_runningalert condition types.time_function- (Optional) Indicates if the condition needs to be sustained or to just break the threshold once;allorany. Supported by theinfra_metricalert 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 of1to120, inclusive.operator- (Optional)above,below, orequal. Defaults toequal.priority- (Optional)criticalorwarning. Defaults tocritical.threshold- (Required) Must be 0 or greater.time_function- (Required)allorany.
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 theSINCE <X> MINUTES AGOclause for the NRQL query. Must be between1and20.
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.