Class 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.
Inherited Members
Namespace: Pulumi.NewRelic
Assembly: Pulumi.NewRelic.dll
Syntax
public class InfraAlertCondition : CustomResource
Constructors
View SourceInfraAlertCondition(String, InfraAlertConditionArgs, CustomResourceOptions)
Create a InfraAlertCondition resource with the given unique name, arguments, and options.
Declaration
public InfraAlertCondition(string name, InfraAlertConditionArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| InfraAlertConditionArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceComparison
The operator used to evaluate the threshold value. Valid values are above, below, and equal. Supported by the infra_metric and infra_process_running condition types.
Declaration
public Output<string> Comparison { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
CreatedAt
The timestamp the alert condition was created.
Declaration
public Output<int> CreatedAt { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
Critical
Identifies the threshold parameters for opening a critical alert violation. See Thresholds below for details.
Declaration
public Output<InfraAlertConditionCritical> Critical { get; }
Property Value
| Type | Description |
|---|---|
| Output<InfraAlertConditionCritical> |
Enabled
Whether the condition is turned on or off. Valid values are true and false. Defaults to true.
Declaration
public Output<bool?> Enabled { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
Event
The metric event; for example, SystemSample or StorageSample. Supported by the infra_metric condition type.
Declaration
public Output<string> Event { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
IntegrationProvider
For alerts on integrations, use this instead of event. Supported by the infra_metric condition type.
Declaration
public Output<string> IntegrationProvider { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
The Infrastructure alert condition's name.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PolicyId
The ID of the alert policy where this condition should be used.
Declaration
public Output<int> PolicyId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
ProcessWhere
Any filters applied to processes; for example: commandName = 'java'. Supported by the infra_process_running condition type.
Declaration
public Output<string> ProcessWhere { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
RunbookUrl
Runbook URL to display in notifications.
Declaration
public Output<string> RunbookUrl { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Select
The attribute name to identify the metric being targeted; for example, cpuPercent, diskFreePercent, or memoryResidentSizeBytes. The underlying API will automatically populate this value for Infrastructure integrations (for example diskFreePercent), so make sure to explicitly include this value to avoid diff issues. Supported by the infra_metric condition type.
Declaration
public Output<string> Select { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Type
The type of Infrastructure alert condition. Valid values are infra_process_running, infra_metric, and infra_host_not_reporting.
Declaration
public Output<string> Type { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
UpdatedAt
The timestamp the alert condition was last updated.
Declaration
public Output<int> UpdatedAt { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Int32> |
ViolationCloseTimer
Determines how much time will pass before a violation is automatically closed. Setting the time limit to 0 prevents a violation from being force-closed.
Declaration
public Output<int?> ViolationCloseTimer { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
Warning
Identifies the threshold parameters for opening a warning alert violation. See Thresholds below for details.
Declaration
public Output<InfraAlertConditionWarning> Warning { get; }
Property Value
| Type | Description |
|---|---|
| Output<InfraAlertConditionWarning> |
Where
If applicable, this identifies any Infrastructure host filters used; for example: hostname LIKE '%cassandra%'.
Declaration
public Output<string> Where { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, InfraAlertConditionState, CustomResourceOptions)
Get an existing InfraAlertCondition resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static InfraAlertCondition Get(string name, Input<string> id, InfraAlertConditionState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| InfraAlertConditionState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| InfraAlertCondition |