PrometheusRuleGroupArgs

data class PrometheusRuleGroupArgs(val clusterName: Output<String>? = null, val description: Output<String>? = null, val enabled: Output<Boolean>? = null, val interval: Output<String>? = null, val location: Output<String>? = null, val resourceGroupName: Output<String>? = null, val ruleGroupName: Output<String>? = null, val rules: Output<List<PrometheusRuleArgs>>? = null, val scopes: Output<List<String>>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<PrometheusRuleGroupArgs>

The Prometheus rule group resource. Uses Azure REST API version 2023-03-01. In version 2.x of the Azure Native provider, it used API version 2023-03-01. Other available API versions: 2021-07-22-preview. These can be accessed by generating a local SDK package using the CLI command pulumi package add azure-native alertsmanagement [ApiVersion]. See the ../../../version-guide/#accessing-any-api-version-via-local-packages for details.

Example Usage

Create or Update a PrometheusRuleGroup

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var prometheusRuleGroup = new AzureNative.AlertsManagement.PrometheusRuleGroup("prometheusRuleGroup", new()
{
ClusterName = "myClusterName",
Description = "This is the description of the following rule group",
Enabled = true,
Interval = "PT10M",
Location = "East US",
ResourceGroupName = "promResourceGroup",
RuleGroupName = "myPrometheusRuleGroup",
Rules = new[]
{
new AzureNative.AlertsManagement.Inputs.PrometheusRuleArgs
{
Expression = "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))",
Labels =
{
{ "team", "prod" },
},
Record = "job_type:billing_jobs_duration_seconds:99p5m",
},
new AzureNative.AlertsManagement.Inputs.PrometheusRuleArgs
{
Actions = new[]
{
new AzureNative.AlertsManagement.Inputs.PrometheusRuleGroupActionArgs
{
ActionGroupId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup",
ActionProperties =
{
{ "key11", "value11" },
{ "key12", "value12" },
},
},
new AzureNative.AlertsManagement.Inputs.PrometheusRuleGroupActionArgs
{
ActionGroupId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup",
ActionProperties =
{
{ "key21", "value21" },
{ "key22", "value22" },
},
},
},
Alert = "Billing_Processing_Very_Slow",
Annotations =
{
{ "annotationName1", "annotationValue1" },
},
Enabled = true,
Expression = "job_type:billing_jobs_duration_seconds:99p5m 30",
For = "PT5M",
Labels =
{
{ "team", "prod" },
},
ResolveConfiguration = new AzureNative.AlertsManagement.Inputs.PrometheusRuleResolveConfigurationArgs
{
AutoResolved = true,
TimeToResolve = "PT10M",
},
Severity = 2,
},
},
Scopes = new[]
{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace",
},
});
});
package main
import (
alertsmanagement "github.com/pulumi/pulumi-azure-native-sdk/alertsmanagement/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := alertsmanagement.NewPrometheusRuleGroup(ctx, "prometheusRuleGroup", &alertsmanagement.PrometheusRuleGroupArgs{
ClusterName: pulumi.String("myClusterName"),
Description: pulumi.String("This is the description of the following rule group"),
Enabled: pulumi.Bool(true),
Interval: pulumi.String("PT10M"),
Location: pulumi.String("East US"),
ResourceGroupName: pulumi.String("promResourceGroup"),
RuleGroupName: pulumi.String("myPrometheusRuleGroup"),
Rules: alertsmanagement.PrometheusRuleArray{
&alertsmanagement.PrometheusRuleArgs{
Expression: pulumi.String("histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))"),
Labels: pulumi.StringMap{
"team": pulumi.String("prod"),
},
Record: pulumi.String("job_type:billing_jobs_duration_seconds:99p5m"),
},
&alertsmanagement.PrometheusRuleArgs{
Actions: alertsmanagement.PrometheusRuleGroupActionArray{
&alertsmanagement.PrometheusRuleGroupActionArgs{
ActionGroupId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup"),
ActionProperties: pulumi.StringMap{
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
&alertsmanagement.PrometheusRuleGroupActionArgs{
ActionGroupId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup"),
ActionProperties: pulumi.StringMap{
"key21": pulumi.String("value21"),
"key22": pulumi.String("value22"),
},
},
},
Alert: pulumi.String("Billing_Processing_Very_Slow"),
Annotations: pulumi.StringMap{
"annotationName1": pulumi.String("annotationValue1"),
},
Enabled: pulumi.Bool(true),
Expression: pulumi.String("job_type:billing_jobs_duration_seconds:99p5m 30"),
For: pulumi.String("PT5M"),
Labels: pulumi.StringMap{
"team": pulumi.String("prod"),
},
ResolveConfiguration: &alertsmanagement.PrometheusRuleResolveConfigurationArgs{
AutoResolved: pulumi.Bool(true),
TimeToResolve: pulumi.String("PT10M"),
},
Severity: pulumi.Int(2),
},
},
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.alertsmanagement.PrometheusRuleGroup;
import com.pulumi.azurenative.alertsmanagement.PrometheusRuleGroupArgs;
import com.pulumi.azurenative.alertsmanagement.inputs.PrometheusRuleArgs;
import com.pulumi.azurenative.alertsmanagement.inputs.PrometheusRuleResolveConfigurationArgs;
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) {
var prometheusRuleGroup = new PrometheusRuleGroup("prometheusRuleGroup", PrometheusRuleGroupArgs.builder()
.clusterName("myClusterName")
.description("This is the description of the following rule group")
.enabled(true)
.interval("PT10M")
.location("East US")
.resourceGroupName("promResourceGroup")
.ruleGroupName("myPrometheusRuleGroup")
.rules(
PrometheusRuleArgs.builder()
.expression("histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))")
.labels(Map.of("team", "prod"))
.record("job_type:billing_jobs_duration_seconds:99p5m")
.build(),
PrometheusRuleArgs.builder()
.actions(
PrometheusRuleGroupActionArgs.builder()
.actionGroupId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup")
.actionProperties(Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
.build(),
PrometheusRuleGroupActionArgs.builder()
.actionGroupId("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup")
.actionProperties(Map.ofEntries(
Map.entry("key21", "value21"),
Map.entry("key22", "value22")
))
.build())
.alert("Billing_Processing_Very_Slow")
.annotations(Map.of("annotationName1", "annotationValue1"))
.enabled(true)
.expression("job_type:billing_jobs_duration_seconds:99p5m 30")
.for_("PT5M")
.labels(Map.of("team", "prod"))
.resolveConfiguration(PrometheusRuleResolveConfigurationArgs.builder()
.autoResolved(true)
.timeToResolve("PT10M")
.build())
.severity(2)
.build())
.scopes("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace")
.build());
}
}

Create or Update a cluster centric PrometheusRuleGroup

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var prometheusRuleGroup = new AzureNative.AlertsManagement.PrometheusRuleGroup("prometheusRuleGroup", new()
{
ClusterName = "myClusterName",
Description = "This is a rule group with culster centric configuration",
Interval = "PT10M",
Location = "East US",
ResourceGroupName = "promResourceGroup",
RuleGroupName = "myPrometheusRuleGroup",
Rules = new[]
{
new AzureNative.AlertsManagement.Inputs.PrometheusRuleArgs
{
Actions = new() { },
Alert = "Billing_Processing_Very_Slow",
Annotations =
{
{ "annotationName1", "annotationValue1" },
},
Enabled = true,
Expression = "job_type:billing_jobs_duration_seconds:99p5m 30",
For = "PT5M",
Labels =
{
{ "team", "prod" },
},
ResolveConfiguration = new AzureNative.AlertsManagement.Inputs.PrometheusRuleResolveConfigurationArgs
{
AutoResolved = true,
TimeToResolve = "PT10M",
},
Severity = 2,
},
},
Scopes = new[]
{
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace",
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myClusterName",
},
});
});
package main
import (
alertsmanagement "github.com/pulumi/pulumi-azure-native-sdk/alertsmanagement/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := alertsmanagement.NewPrometheusRuleGroup(ctx, "prometheusRuleGroup", &alertsmanagement.PrometheusRuleGroupArgs{
ClusterName: pulumi.String("myClusterName"),
Description: pulumi.String("This is a rule group with culster centric configuration"),
Interval: pulumi.String("PT10M"),
Location: pulumi.String("East US"),
ResourceGroupName: pulumi.String("promResourceGroup"),
RuleGroupName: pulumi.String("myPrometheusRuleGroup"),
Rules: alertsmanagement.PrometheusRuleArray{
&alertsmanagement.PrometheusRuleArgs{
Actions: alertsmanagement.PrometheusRuleGroupActionArray{},
Alert: pulumi.String("Billing_Processing_Very_Slow"),
Annotations: pulumi.StringMap{
"annotationName1": pulumi.String("annotationValue1"),
},
Enabled: pulumi.Bool(true),
Expression: pulumi.String("job_type:billing_jobs_duration_seconds:99p5m 30"),
For: pulumi.String("PT5M"),
Labels: pulumi.StringMap{
"team": pulumi.String("prod"),
},
ResolveConfiguration: &alertsmanagement.PrometheusRuleResolveConfigurationArgs{
AutoResolved: pulumi.Bool(true),
TimeToResolve: pulumi.String("PT10M"),
},
Severity: pulumi.Int(2),
},
},
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace"),
pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myClusterName"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.alertsmanagement.PrometheusRuleGroup;
import com.pulumi.azurenative.alertsmanagement.PrometheusRuleGroupArgs;
import com.pulumi.azurenative.alertsmanagement.inputs.PrometheusRuleArgs;
import com.pulumi.azurenative.alertsmanagement.inputs.PrometheusRuleResolveConfigurationArgs;
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) {
var prometheusRuleGroup = new PrometheusRuleGroup("prometheusRuleGroup", PrometheusRuleGroupArgs.builder()
.clusterName("myClusterName")
.description("This is a rule group with culster centric configuration")
.interval("PT10M")
.location("East US")
.resourceGroupName("promResourceGroup")
.ruleGroupName("myPrometheusRuleGroup")
.rules(PrometheusRuleArgs.builder()
.actions()
.alert("Billing_Processing_Very_Slow")
.annotations(Map.of("annotationName1", "annotationValue1"))
.enabled(true)
.expression("job_type:billing_jobs_duration_seconds:99p5m 30")
.for_("PT5M")
.labels(Map.of("team", "prod"))
.resolveConfiguration(PrometheusRuleResolveConfigurationArgs.builder()
.autoResolved(true)
.timeToResolve("PT10M")
.build())
.severity(2)
.build())
.scopes(
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace",
"/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myClusterName")
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:alertsmanagement:PrometheusRuleGroup myresource1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AlertsManagement/prometheusRuleGroups/{ruleGroupName}

Constructors

Link copied to clipboard
constructor(clusterName: Output<String>? = null, description: Output<String>? = null, enabled: Output<Boolean>? = null, interval: Output<String>? = null, location: Output<String>? = null, resourceGroupName: Output<String>? = null, ruleGroupName: Output<String>? = null, rules: Output<List<PrometheusRuleArgs>>? = null, scopes: Output<List<String>>? = null, tags: Output<Map<String, String>>? = null)

Properties

Link copied to clipboard
val clusterName: Output<String>? = null

Apply rule to data from a specific cluster.

Link copied to clipboard
val description: Output<String>? = null

Rule group description.

Link copied to clipboard
val enabled: Output<Boolean>? = null

Enable/disable rule group.

Link copied to clipboard
val interval: Output<String>? = null

The interval in which to run the Prometheus rule group represented in ISO 8601 duration format. Should be between 1 and 15 minutes

Link copied to clipboard
val location: Output<String>? = null

The geo-location where the resource lives

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group. The name is case insensitive.

Link copied to clipboard
val ruleGroupName: Output<String>? = null

The name of the rule group.

Link copied to clipboard
val rules: Output<List<PrometheusRuleArgs>>? = null

Defines the rules in the Prometheus rule group.

Link copied to clipboard
val scopes: Output<List<String>>? = null

Target Azure Monitor workspaces resource ids. This api-version is currently limited to creating with one scope. This may change in future.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Resource tags.

Functions

Link copied to clipboard
open override fun toJava(): PrometheusRuleGroupArgs