Prometheus Rule Group Args
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. Azure REST API version: 2023-03-01.
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",
},
});
});
Content copied to clipboard
package main
import (
"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.PrometheusRuleArgs{
{
Expression: pulumi.String("histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))"),
Labels: {
"team": pulumi.String("prod"),
},
Record: pulumi.String("job_type:billing_jobs_duration_seconds:99p5m"),
},
{
Actions: alertsmanagement.PrometheusRuleGroupActionArray{
{
ActionGroupId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup"),
ActionProperties: {
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
{
ActionGroupId: pulumi.String("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup"),
ActionProperties: {
"key21": pulumi.String("value21"),
"key22": pulumi.String("value22"),
},
},
},
Alert: pulumi.String("Billing_Processing_Very_Slow"),
Annotations: {
"annotationName1": pulumi.String("annotationValue1"),
},
Enabled: pulumi.Bool(true),
Expression: pulumi.String("job_type:billing_jobs_duration_seconds:99p5m 30"),
For: pulumi.String("PT5M"),
Labels: {
"team": pulumi.String("prod"),
},
ResolveConfiguration: {
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
})
}
Content copied to clipboard
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 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(
Map.ofEntries(
Map.entry("expression", "histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service=\"billing-processing\"}[5m])) by (job_type))"),
Map.entry("labels", Map.of("team", "prod")),
Map.entry("record", "job_type:billing_jobs_duration_seconds:99p5m")
),
Map.ofEntries(
Map.entry("actions",
Map.ofEntries(
Map.entry("actionGroupId", "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myactiongroup"),
Map.entry("actionProperties", Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
),
Map.ofEntries(
Map.entry("actionGroupId", "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/myrg/providers/microsoft.insights/actiongroups/myotheractiongroup"),
Map.entry("actionProperties", Map.ofEntries(
Map.entry("key21", "value21"),
Map.entry("key22", "value22")
))
)),
Map.entry("alert", "Billing_Processing_Very_Slow"),
Map.entry("annotations", Map.of("annotationName1", "annotationValue1")),
Map.entry("enabled", true),
Map.entry("expression", "job_type:billing_jobs_duration_seconds:99p5m 30"),
Map.entry("for", "PT5M"),
Map.entry("labels", Map.of("team", "prod")),
Map.entry("resolveConfiguration", Map.ofEntries(
Map.entry("autoResolved", true),
Map.entry("timeToResolve", "PT10M")
)),
Map.entry("severity", 2)
))
.scopes("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace")
.build());
}
}
Content copied to clipboard
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",
},
});
});
Content copied to clipboard
package main
import (
"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.PrometheusRuleArgs{
{
Actions: alertsmanagement.PrometheusRuleGroupActionArray{},
Alert: pulumi.String("Billing_Processing_Very_Slow"),
Annotations: {
"annotationName1": pulumi.String("annotationValue1"),
},
Enabled: pulumi.Bool(true),
Expression: pulumi.String("job_type:billing_jobs_duration_seconds:99p5m 30"),
For: pulumi.String("PT5M"),
Labels: {
"team": pulumi.String("prod"),
},
ResolveConfiguration: {
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
})
}
Content copied to clipboard
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 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(Map.ofEntries(
Map.entry("actions", ),
Map.entry("alert", "Billing_Processing_Very_Slow"),
Map.entry("annotations", Map.of("annotationName1", "annotationValue1")),
Map.entry("enabled", true),
Map.entry("expression", "job_type:billing_jobs_duration_seconds:99p5m 30"),
Map.entry("for", "PT5M"),
Map.entry("labels", Map.of("team", "prod")),
Map.entry("resolveConfiguration", Map.ofEntries(
Map.entry("autoResolved", true),
Map.entry("timeToResolve", "PT10M")
)),
Map.entry("severity", 2)
))
.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());
}
}
Content copied to clipboard
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}
Content copied to clipboard
Constructors
Link copied to clipboard
fun PrometheusRuleGroupArgs(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)