AlertPrometheusRuleGroupArgs

data class AlertPrometheusRuleGroupArgs(val clusterName: Output<String>? = null, val description: Output<String>? = null, val interval: Output<String>? = null, val location: Output<String>? = null, val name: Output<String>? = null, val resourceGroupName: Output<String>? = null, val ruleGroupEnabled: Output<Boolean>? = null, val rules: Output<List<AlertPrometheusRuleGroupRuleArgs>>? = null, val scopes: Output<List<String>>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<AlertPrometheusRuleGroupArgs>

Manages an Alert Management Prometheus Rule Group.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.monitoring.ActionGroup;
import com.pulumi.azure.monitoring.ActionGroupArgs;
import com.pulumi.azure.monitoring.Workspace;
import com.pulumi.azure.monitoring.WorkspaceArgs;
import com.pulumi.azure.containerservice.KubernetesCluster;
import com.pulumi.azure.containerservice.KubernetesClusterArgs;
import com.pulumi.azure.containerservice.inputs.KubernetesClusterDefaultNodePoolArgs;
import com.pulumi.azure.containerservice.inputs.KubernetesClusterIdentityArgs;
import com.pulumi.azure.monitoring.AlertPrometheusRuleGroup;
import com.pulumi.azure.monitoring.AlertPrometheusRuleGroupArgs;
import com.pulumi.azure.monitoring.inputs.AlertPrometheusRuleGroupRuleArgs;
import com.pulumi.azure.monitoring.inputs.AlertPrometheusRuleGroupRuleAlertResolutionArgs;
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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("example-resources")
.location("West Europe")
.build());
var exampleActionGroup = new ActionGroup("exampleActionGroup", ActionGroupArgs.builder()
.name("example-mag")
.resourceGroupName(example.name())
.shortName("testag")
.build());
var exampleWorkspace = new Workspace("exampleWorkspace", WorkspaceArgs.builder()
.name("example-amw")
.resourceGroupName(example.name())
.location(example.location())
.build());
var exampleKubernetesCluster = new KubernetesCluster("exampleKubernetesCluster", KubernetesClusterArgs.builder()
.name("example-cluster")
.location(example.location())
.resourceGroupName(example.name())
.dnsPrefix("example-aks")
.defaultNodePool(KubernetesClusterDefaultNodePoolArgs.builder()
.name("default")
.nodeCount(1)
.vmSize("Standard_DS2_v2")
.enableHostEncryption(true)
.build())
.identity(KubernetesClusterIdentityArgs.builder()
.type("SystemAssigned")
.build())
.build());
var exampleAlertPrometheusRuleGroup = new AlertPrometheusRuleGroup("exampleAlertPrometheusRuleGroup", AlertPrometheusRuleGroupArgs.builder()
.name("example-amprg")
.location("West Europe")
.resourceGroupName(example.name())
.clusterName(exampleKubernetesCluster.name())
.description("This is the description of the following rule group")
.ruleGroupEnabled(false)
.interval("PT1M")
.scopes(exampleWorkspace.id())
.rules(
AlertPrometheusRuleGroupRuleArgs.builder()
.enabled(false)
.expression("""
histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service="billing-processing"}[5m])) by (job_type))
""")
.record("job_type:billing_jobs_duration_seconds:99p5m")
.labels(Map.of("team", "prod"))
.build(),
AlertPrometheusRuleGroupRuleArgs.builder()
.alert("Billing_Processing_Very_Slow")
.enabled(true)
.expression("""
histogram_quantile(0.99, sum(rate(jobs_duration_seconds_bucket{service="billing-processing"}[5m])) by (job_type))
""")
.for_("PT5M")
.severity(2)
.actions(AlertPrometheusRuleGroupRuleActionArgs.builder()
.actionGroupId(exampleActionGroup.id())
.build())
.alertResolution(AlertPrometheusRuleGroupRuleAlertResolutionArgs.builder()
.autoResolved(true)
.timeToResolve("PT10M")
.build())
.annotations(Map.of("annotationName", "annotationValue"))
.labels(Map.of("team", "prod"))
.build())
.tags(Map.of("key", "value"))
.build());
}
}

Import

Alert Management Prometheus Rule Group can be imported using the resource id, e.g.

$ pulumi import azure:monitoring/alertPrometheusRuleGroup:AlertPrometheusRuleGroup example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.AlertsManagement/prometheusRuleGroups/ruleGroup1

Constructors

Link copied to clipboard
fun AlertPrometheusRuleGroupArgs(clusterName: Output<String>? = null, description: Output<String>? = null, interval: Output<String>? = null, location: Output<String>? = null, name: Output<String>? = null, resourceGroupName: Output<String>? = null, ruleGroupEnabled: Output<Boolean>? = null, rules: Output<List<AlertPrometheusRuleGroupRuleArgs>>? = null, scopes: Output<List<String>>? = null, tags: Output<Map<String, String>>? = null)

Functions

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

Properties

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

Specifies the name of the Managed Kubernetes Cluster.

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

The description of the Alert Management Prometheus Rule Group.

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

Specifies the interval in which to run the Alert Management Prometheus Rule Group represented in ISO 8601 duration format. Possible values are between PT1M and PT15M.

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

Specifies the Azure Region where the Alert Management Prometheus Rule Group should exist. Changing this forces a new resource to be created.

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

Specifies the name which should be used for this Alert Management Prometheus Rule Group. Changing this forces a new resource to be created.

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

Specifies the name of the Resource Group where the Alert Management Prometheus Rule Group should exist. Changing this forces a new resource to be created.

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

Is this Alert Management Prometheus Rule Group enabled? Possible values are true and false.

Link copied to clipboard

A rule block as defined below.

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

Specifies the resource ID of the Azure Monitor Workspace.

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

A mapping of tags to assign to the Alert Management Prometheus Rule Group.