volcengine.vmp.AlertingRule
Explore with Pulumi AI
Provides a resource to manage vmp alerting rule
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@volcengine/pulumi";
const fooWorkspace = new volcengine.vmp.Workspace("fooWorkspace", {
instanceTypeId: "vmp.standard.15d",
deleteProtectionEnabled: false,
description: "acc-test-1",
username: "admin123",
password: "Pass123456",
});
const fooContact = new volcengine.vmp.Contact("fooContact", {
email: "acctest1@tftest.com",
webhook: {
address: "https://www.acctest1.com",
},
larkBotWebhook: {
address: "https://www.acctest1.com",
},
dingTalkBotWebhook: {
address: "https://www.dingacctest1.com",
atMobiles: ["18046891812"],
},
phoneNumber: {
countryCode: "+86",
number: "18310101010",
},
});
const foo1Contact = new volcengine.vmp.Contact("foo1Contact", {
email: "acctest2@tftest.com",
webhook: {
address: "https://www.acctest2.com",
},
larkBotWebhook: {
address: "https://www.acctest2.com",
},
dingTalkBotWebhook: {
address: "https://www.dingacctest2.com",
atMobiles: ["18046891813"],
},
phoneNumber: {
countryCode: "+86",
number: "18310101011",
},
});
const fooContactGroup = new volcengine.vmp.ContactGroup("fooContactGroup", {contactIds: [fooContact.id]});
const foo1ContactGroup = new volcengine.vmp.ContactGroup("foo1ContactGroup", {contactIds: [foo1Contact.id]});
const fooNotifyPolicy = new volcengine.vmp.NotifyPolicy("fooNotifyPolicy", {
description: "acc-test-1",
levels: [
{
level: "P1",
contactGroupIds: [fooContactGroup.id],
channels: [
"Email",
"Webhook",
],
},
{
level: "P0",
contactGroupIds: [foo1ContactGroup.id],
channels: ["LarkBotWebhook"],
},
],
});
const fooNotifyGroupPolicy = new volcengine.vmp.NotifyGroupPolicy("fooNotifyGroupPolicy", {
description: "acc-test-1",
levels: [
{
level: "P2",
groupBies: ["__rule__"],
groupWait: "35",
groupInterval: "60",
repeatInterval: "70",
},
{
level: "P0",
groupBies: ["__rule__"],
groupWait: "30",
groupInterval: "60",
repeatInterval: "70",
},
{
level: "P1",
groupBies: ["__rule__"],
groupWait: "40",
groupInterval: "75",
repeatInterval: "75",
},
],
});
const fooAlertingRule = new volcengine.vmp.AlertingRule("fooAlertingRule", {
description: "acc-test-1",
notifyPolicyId: fooNotifyPolicy.id,
notifyGroupPolicyId: fooNotifyGroupPolicy.id,
query: {
workspaceId: fooWorkspace.id,
promQl: "sum(up)",
},
levels: [
{
level: "P0",
"for": "0s",
comparator: ">=",
threshold: 2,
},
{
level: "P1",
"for": "0s",
comparator: ">=",
threshold: 1,
},
{
level: "P2",
"for": "0s",
comparator: ">=",
threshold: 0.5,
},
],
annotations: [{
name: "annotation",
value: "acc-test",
}],
labels: [{
name: "label",
value: "acc-test",
}],
});
import pulumi
import pulumi_volcengine as volcengine
foo_workspace = volcengine.vmp.Workspace("fooWorkspace",
instance_type_id="vmp.standard.15d",
delete_protection_enabled=False,
description="acc-test-1",
username="admin123",
password="Pass123456")
foo_contact = volcengine.vmp.Contact("fooContact",
email="acctest1@tftest.com",
webhook=volcengine.vmp.ContactWebhookArgs(
address="https://www.acctest1.com",
),
lark_bot_webhook=volcengine.vmp.ContactLarkBotWebhookArgs(
address="https://www.acctest1.com",
),
ding_talk_bot_webhook=volcengine.vmp.ContactDingTalkBotWebhookArgs(
address="https://www.dingacctest1.com",
at_mobiles=["18046891812"],
),
phone_number=volcengine.vmp.ContactPhoneNumberArgs(
country_code="+86",
number="18310101010",
))
foo1_contact = volcengine.vmp.Contact("foo1Contact",
email="acctest2@tftest.com",
webhook=volcengine.vmp.ContactWebhookArgs(
address="https://www.acctest2.com",
),
lark_bot_webhook=volcengine.vmp.ContactLarkBotWebhookArgs(
address="https://www.acctest2.com",
),
ding_talk_bot_webhook=volcengine.vmp.ContactDingTalkBotWebhookArgs(
address="https://www.dingacctest2.com",
at_mobiles=["18046891813"],
),
phone_number=volcengine.vmp.ContactPhoneNumberArgs(
country_code="+86",
number="18310101011",
))
foo_contact_group = volcengine.vmp.ContactGroup("fooContactGroup", contact_ids=[foo_contact.id])
foo1_contact_group = volcengine.vmp.ContactGroup("foo1ContactGroup", contact_ids=[foo1_contact.id])
foo_notify_policy = volcengine.vmp.NotifyPolicy("fooNotifyPolicy",
description="acc-test-1",
levels=[
volcengine.vmp.NotifyPolicyLevelArgs(
level="P1",
contact_group_ids=[foo_contact_group.id],
channels=[
"Email",
"Webhook",
],
),
volcengine.vmp.NotifyPolicyLevelArgs(
level="P0",
contact_group_ids=[foo1_contact_group.id],
channels=["LarkBotWebhook"],
),
])
foo_notify_group_policy = volcengine.vmp.NotifyGroupPolicy("fooNotifyGroupPolicy",
description="acc-test-1",
levels=[
volcengine.vmp.NotifyGroupPolicyLevelArgs(
level="P2",
group_bies=["__rule__"],
group_wait="35",
group_interval="60",
repeat_interval="70",
),
volcengine.vmp.NotifyGroupPolicyLevelArgs(
level="P0",
group_bies=["__rule__"],
group_wait="30",
group_interval="60",
repeat_interval="70",
),
volcengine.vmp.NotifyGroupPolicyLevelArgs(
level="P1",
group_bies=["__rule__"],
group_wait="40",
group_interval="75",
repeat_interval="75",
),
])
foo_alerting_rule = volcengine.vmp.AlertingRule("fooAlertingRule",
description="acc-test-1",
notify_policy_id=foo_notify_policy.id,
notify_group_policy_id=foo_notify_group_policy.id,
query=volcengine.vmp.AlertingRuleQueryArgs(
workspace_id=foo_workspace.id,
prom_ql="sum(up)",
),
levels=[
volcengine.vmp.AlertingRuleLevelArgs(
level="P0",
for_="0s",
comparator=">=",
threshold=2,
),
volcengine.vmp.AlertingRuleLevelArgs(
level="P1",
for_="0s",
comparator=">=",
threshold=1,
),
volcengine.vmp.AlertingRuleLevelArgs(
level="P2",
for_="0s",
comparator=">=",
threshold=0.5,
),
],
annotations=[volcengine.vmp.AlertingRuleAnnotationArgs(
name="annotation",
value="acc-test",
)],
labels=[volcengine.vmp.AlertingRuleLabelArgs(
name="label",
value="acc-test",
)])
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vmp"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
fooWorkspace, err := vmp.NewWorkspace(ctx, "fooWorkspace", &vmp.WorkspaceArgs{
InstanceTypeId: pulumi.String("vmp.standard.15d"),
DeleteProtectionEnabled: pulumi.Bool(false),
Description: pulumi.String("acc-test-1"),
Username: pulumi.String("admin123"),
Password: pulumi.String("Pass123456"),
})
if err != nil {
return err
}
fooContact, err := vmp.NewContact(ctx, "fooContact", &vmp.ContactArgs{
Email: pulumi.String("acctest1@tftest.com"),
Webhook: &vmp.ContactWebhookArgs{
Address: pulumi.String("https://www.acctest1.com"),
},
LarkBotWebhook: &vmp.ContactLarkBotWebhookArgs{
Address: pulumi.String("https://www.acctest1.com"),
},
DingTalkBotWebhook: &vmp.ContactDingTalkBotWebhookArgs{
Address: pulumi.String("https://www.dingacctest1.com"),
AtMobiles: pulumi.StringArray{
pulumi.String("18046891812"),
},
},
PhoneNumber: &vmp.ContactPhoneNumberArgs{
CountryCode: pulumi.String("+86"),
Number: pulumi.String("18310101010"),
},
})
if err != nil {
return err
}
foo1Contact, err := vmp.NewContact(ctx, "foo1Contact", &vmp.ContactArgs{
Email: pulumi.String("acctest2@tftest.com"),
Webhook: &vmp.ContactWebhookArgs{
Address: pulumi.String("https://www.acctest2.com"),
},
LarkBotWebhook: &vmp.ContactLarkBotWebhookArgs{
Address: pulumi.String("https://www.acctest2.com"),
},
DingTalkBotWebhook: &vmp.ContactDingTalkBotWebhookArgs{
Address: pulumi.String("https://www.dingacctest2.com"),
AtMobiles: pulumi.StringArray{
pulumi.String("18046891813"),
},
},
PhoneNumber: &vmp.ContactPhoneNumberArgs{
CountryCode: pulumi.String("+86"),
Number: pulumi.String("18310101011"),
},
})
if err != nil {
return err
}
fooContactGroup, err := vmp.NewContactGroup(ctx, "fooContactGroup", &vmp.ContactGroupArgs{
ContactIds: pulumi.StringArray{
fooContact.ID(),
},
})
if err != nil {
return err
}
foo1ContactGroup, err := vmp.NewContactGroup(ctx, "foo1ContactGroup", &vmp.ContactGroupArgs{
ContactIds: pulumi.StringArray{
foo1Contact.ID(),
},
})
if err != nil {
return err
}
fooNotifyPolicy, err := vmp.NewNotifyPolicy(ctx, "fooNotifyPolicy", &vmp.NotifyPolicyArgs{
Description: pulumi.String("acc-test-1"),
Levels: vmp.NotifyPolicyLevelArray{
&vmp.NotifyPolicyLevelArgs{
Level: pulumi.String("P1"),
ContactGroupIds: pulumi.StringArray{
fooContactGroup.ID(),
},
Channels: pulumi.StringArray{
pulumi.String("Email"),
pulumi.String("Webhook"),
},
},
&vmp.NotifyPolicyLevelArgs{
Level: pulumi.String("P0"),
ContactGroupIds: pulumi.StringArray{
foo1ContactGroup.ID(),
},
Channels: pulumi.StringArray{
pulumi.String("LarkBotWebhook"),
},
},
},
})
if err != nil {
return err
}
fooNotifyGroupPolicy, err := vmp.NewNotifyGroupPolicy(ctx, "fooNotifyGroupPolicy", &vmp.NotifyGroupPolicyArgs{
Description: pulumi.String("acc-test-1"),
Levels: vmp.NotifyGroupPolicyLevelArray{
&vmp.NotifyGroupPolicyLevelArgs{
Level: pulumi.String("P2"),
GroupBies: pulumi.StringArray{
pulumi.String("__rule__"),
},
GroupWait: pulumi.String("35"),
GroupInterval: pulumi.String("60"),
RepeatInterval: pulumi.String("70"),
},
&vmp.NotifyGroupPolicyLevelArgs{
Level: pulumi.String("P0"),
GroupBies: pulumi.StringArray{
pulumi.String("__rule__"),
},
GroupWait: pulumi.String("30"),
GroupInterval: pulumi.String("60"),
RepeatInterval: pulumi.String("70"),
},
&vmp.NotifyGroupPolicyLevelArgs{
Level: pulumi.String("P1"),
GroupBies: pulumi.StringArray{
pulumi.String("__rule__"),
},
GroupWait: pulumi.String("40"),
GroupInterval: pulumi.String("75"),
RepeatInterval: pulumi.String("75"),
},
},
})
if err != nil {
return err
}
_, err = vmp.NewAlertingRule(ctx, "fooAlertingRule", &vmp.AlertingRuleArgs{
Description: pulumi.String("acc-test-1"),
NotifyPolicyId: fooNotifyPolicy.ID(),
NotifyGroupPolicyId: fooNotifyGroupPolicy.ID(),
Query: &vmp.AlertingRuleQueryArgs{
WorkspaceId: fooWorkspace.ID(),
PromQl: pulumi.String("sum(up)"),
},
Levels: vmp.AlertingRuleLevelArray{
&vmp.AlertingRuleLevelArgs{
Level: pulumi.String("P0"),
For: pulumi.String("0s"),
Comparator: pulumi.String(">="),
Threshold: pulumi.Float64(2),
},
&vmp.AlertingRuleLevelArgs{
Level: pulumi.String("P1"),
For: pulumi.String("0s"),
Comparator: pulumi.String(">="),
Threshold: pulumi.Float64(1),
},
&vmp.AlertingRuleLevelArgs{
Level: pulumi.String("P2"),
For: pulumi.String("0s"),
Comparator: pulumi.String(">="),
Threshold: pulumi.Float64(0.5),
},
},
Annotations: vmp.AlertingRuleAnnotationArray{
&vmp.AlertingRuleAnnotationArgs{
Name: pulumi.String("annotation"),
Value: pulumi.String("acc-test"),
},
},
Labels: vmp.AlertingRuleLabelArray{
&vmp.AlertingRuleLabelArgs{
Name: pulumi.String("label"),
Value: pulumi.String("acc-test"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() =>
{
var fooWorkspace = new Volcengine.Vmp.Workspace("fooWorkspace", new()
{
InstanceTypeId = "vmp.standard.15d",
DeleteProtectionEnabled = false,
Description = "acc-test-1",
Username = "admin123",
Password = "Pass123456",
});
var fooContact = new Volcengine.Vmp.Contact("fooContact", new()
{
Email = "acctest1@tftest.com",
Webhook = new Volcengine.Vmp.Inputs.ContactWebhookArgs
{
Address = "https://www.acctest1.com",
},
LarkBotWebhook = new Volcengine.Vmp.Inputs.ContactLarkBotWebhookArgs
{
Address = "https://www.acctest1.com",
},
DingTalkBotWebhook = new Volcengine.Vmp.Inputs.ContactDingTalkBotWebhookArgs
{
Address = "https://www.dingacctest1.com",
AtMobiles = new[]
{
"18046891812",
},
},
PhoneNumber = new Volcengine.Vmp.Inputs.ContactPhoneNumberArgs
{
CountryCode = "+86",
Number = "18310101010",
},
});
var foo1Contact = new Volcengine.Vmp.Contact("foo1Contact", new()
{
Email = "acctest2@tftest.com",
Webhook = new Volcengine.Vmp.Inputs.ContactWebhookArgs
{
Address = "https://www.acctest2.com",
},
LarkBotWebhook = new Volcengine.Vmp.Inputs.ContactLarkBotWebhookArgs
{
Address = "https://www.acctest2.com",
},
DingTalkBotWebhook = new Volcengine.Vmp.Inputs.ContactDingTalkBotWebhookArgs
{
Address = "https://www.dingacctest2.com",
AtMobiles = new[]
{
"18046891813",
},
},
PhoneNumber = new Volcengine.Vmp.Inputs.ContactPhoneNumberArgs
{
CountryCode = "+86",
Number = "18310101011",
},
});
var fooContactGroup = new Volcengine.Vmp.ContactGroup("fooContactGroup", new()
{
ContactIds = new[]
{
fooContact.Id,
},
});
var foo1ContactGroup = new Volcengine.Vmp.ContactGroup("foo1ContactGroup", new()
{
ContactIds = new[]
{
foo1Contact.Id,
},
});
var fooNotifyPolicy = new Volcengine.Vmp.NotifyPolicy("fooNotifyPolicy", new()
{
Description = "acc-test-1",
Levels = new[]
{
new Volcengine.Vmp.Inputs.NotifyPolicyLevelArgs
{
Level = "P1",
ContactGroupIds = new[]
{
fooContactGroup.Id,
},
Channels = new[]
{
"Email",
"Webhook",
},
},
new Volcengine.Vmp.Inputs.NotifyPolicyLevelArgs
{
Level = "P0",
ContactGroupIds = new[]
{
foo1ContactGroup.Id,
},
Channels = new[]
{
"LarkBotWebhook",
},
},
},
});
var fooNotifyGroupPolicy = new Volcengine.Vmp.NotifyGroupPolicy("fooNotifyGroupPolicy", new()
{
Description = "acc-test-1",
Levels = new[]
{
new Volcengine.Vmp.Inputs.NotifyGroupPolicyLevelArgs
{
Level = "P2",
GroupBies = new[]
{
"__rule__",
},
GroupWait = "35",
GroupInterval = "60",
RepeatInterval = "70",
},
new Volcengine.Vmp.Inputs.NotifyGroupPolicyLevelArgs
{
Level = "P0",
GroupBies = new[]
{
"__rule__",
},
GroupWait = "30",
GroupInterval = "60",
RepeatInterval = "70",
},
new Volcengine.Vmp.Inputs.NotifyGroupPolicyLevelArgs
{
Level = "P1",
GroupBies = new[]
{
"__rule__",
},
GroupWait = "40",
GroupInterval = "75",
RepeatInterval = "75",
},
},
});
var fooAlertingRule = new Volcengine.Vmp.AlertingRule("fooAlertingRule", new()
{
Description = "acc-test-1",
NotifyPolicyId = fooNotifyPolicy.Id,
NotifyGroupPolicyId = fooNotifyGroupPolicy.Id,
Query = new Volcengine.Vmp.Inputs.AlertingRuleQueryArgs
{
WorkspaceId = fooWorkspace.Id,
PromQl = "sum(up)",
},
Levels = new[]
{
new Volcengine.Vmp.Inputs.AlertingRuleLevelArgs
{
Level = "P0",
For = "0s",
Comparator = ">=",
Threshold = 2,
},
new Volcengine.Vmp.Inputs.AlertingRuleLevelArgs
{
Level = "P1",
For = "0s",
Comparator = ">=",
Threshold = 1,
},
new Volcengine.Vmp.Inputs.AlertingRuleLevelArgs
{
Level = "P2",
For = "0s",
Comparator = ">=",
Threshold = 0.5,
},
},
Annotations = new[]
{
new Volcengine.Vmp.Inputs.AlertingRuleAnnotationArgs
{
Name = "annotation",
Value = "acc-test",
},
},
Labels = new[]
{
new Volcengine.Vmp.Inputs.AlertingRuleLabelArgs
{
Name = "label",
Value = "acc-test",
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.vmp.Workspace;
import com.pulumi.volcengine.vmp.WorkspaceArgs;
import com.pulumi.volcengine.vmp.Contact;
import com.pulumi.volcengine.vmp.ContactArgs;
import com.pulumi.volcengine.vmp.inputs.ContactWebhookArgs;
import com.pulumi.volcengine.vmp.inputs.ContactLarkBotWebhookArgs;
import com.pulumi.volcengine.vmp.inputs.ContactDingTalkBotWebhookArgs;
import com.pulumi.volcengine.vmp.inputs.ContactPhoneNumberArgs;
import com.pulumi.volcengine.vmp.ContactGroup;
import com.pulumi.volcengine.vmp.ContactGroupArgs;
import com.pulumi.volcengine.vmp.NotifyPolicy;
import com.pulumi.volcengine.vmp.NotifyPolicyArgs;
import com.pulumi.volcengine.vmp.inputs.NotifyPolicyLevelArgs;
import com.pulumi.volcengine.vmp.NotifyGroupPolicy;
import com.pulumi.volcengine.vmp.NotifyGroupPolicyArgs;
import com.pulumi.volcengine.vmp.inputs.NotifyGroupPolicyLevelArgs;
import com.pulumi.volcengine.vmp.AlertingRule;
import com.pulumi.volcengine.vmp.AlertingRuleArgs;
import com.pulumi.volcengine.vmp.inputs.AlertingRuleQueryArgs;
import com.pulumi.volcengine.vmp.inputs.AlertingRuleLevelArgs;
import com.pulumi.volcengine.vmp.inputs.AlertingRuleAnnotationArgs;
import com.pulumi.volcengine.vmp.inputs.AlertingRuleLabelArgs;
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 fooWorkspace = new Workspace("fooWorkspace", WorkspaceArgs.builder()
.instanceTypeId("vmp.standard.15d")
.deleteProtectionEnabled(false)
.description("acc-test-1")
.username("admin123")
.password("Pass123456")
.build());
var fooContact = new Contact("fooContact", ContactArgs.builder()
.email("acctest1@tftest.com")
.webhook(ContactWebhookArgs.builder()
.address("https://www.acctest1.com")
.build())
.larkBotWebhook(ContactLarkBotWebhookArgs.builder()
.address("https://www.acctest1.com")
.build())
.dingTalkBotWebhook(ContactDingTalkBotWebhookArgs.builder()
.address("https://www.dingacctest1.com")
.atMobiles("18046891812")
.build())
.phoneNumber(ContactPhoneNumberArgs.builder()
.countryCode("+86")
.number("18310101010")
.build())
.build());
var foo1Contact = new Contact("foo1Contact", ContactArgs.builder()
.email("acctest2@tftest.com")
.webhook(ContactWebhookArgs.builder()
.address("https://www.acctest2.com")
.build())
.larkBotWebhook(ContactLarkBotWebhookArgs.builder()
.address("https://www.acctest2.com")
.build())
.dingTalkBotWebhook(ContactDingTalkBotWebhookArgs.builder()
.address("https://www.dingacctest2.com")
.atMobiles("18046891813")
.build())
.phoneNumber(ContactPhoneNumberArgs.builder()
.countryCode("+86")
.number("18310101011")
.build())
.build());
var fooContactGroup = new ContactGroup("fooContactGroup", ContactGroupArgs.builder()
.contactIds(fooContact.id())
.build());
var foo1ContactGroup = new ContactGroup("foo1ContactGroup", ContactGroupArgs.builder()
.contactIds(foo1Contact.id())
.build());
var fooNotifyPolicy = new NotifyPolicy("fooNotifyPolicy", NotifyPolicyArgs.builder()
.description("acc-test-1")
.levels(
NotifyPolicyLevelArgs.builder()
.level("P1")
.contactGroupIds(fooContactGroup.id())
.channels(
"Email",
"Webhook")
.build(),
NotifyPolicyLevelArgs.builder()
.level("P0")
.contactGroupIds(foo1ContactGroup.id())
.channels("LarkBotWebhook")
.build())
.build());
var fooNotifyGroupPolicy = new NotifyGroupPolicy("fooNotifyGroupPolicy", NotifyGroupPolicyArgs.builder()
.description("acc-test-1")
.levels(
NotifyGroupPolicyLevelArgs.builder()
.level("P2")
.groupBies("__rule__")
.groupWait("35")
.groupInterval("60")
.repeatInterval("70")
.build(),
NotifyGroupPolicyLevelArgs.builder()
.level("P0")
.groupBies("__rule__")
.groupWait("30")
.groupInterval("60")
.repeatInterval("70")
.build(),
NotifyGroupPolicyLevelArgs.builder()
.level("P1")
.groupBies("__rule__")
.groupWait("40")
.groupInterval("75")
.repeatInterval("75")
.build())
.build());
var fooAlertingRule = new AlertingRule("fooAlertingRule", AlertingRuleArgs.builder()
.description("acc-test-1")
.notifyPolicyId(fooNotifyPolicy.id())
.notifyGroupPolicyId(fooNotifyGroupPolicy.id())
.query(AlertingRuleQueryArgs.builder()
.workspaceId(fooWorkspace.id())
.promQl("sum(up)")
.build())
.levels(
AlertingRuleLevelArgs.builder()
.level("P0")
.for_("0s")
.comparator(">=")
.threshold(2)
.build(),
AlertingRuleLevelArgs.builder()
.level("P1")
.for_("0s")
.comparator(">=")
.threshold(1)
.build(),
AlertingRuleLevelArgs.builder()
.level("P2")
.for_("0s")
.comparator(">=")
.threshold(0.5)
.build())
.annotations(AlertingRuleAnnotationArgs.builder()
.name("annotation")
.value("acc-test")
.build())
.labels(AlertingRuleLabelArgs.builder()
.name("label")
.value("acc-test")
.build())
.build());
}
}
resources:
fooWorkspace:
type: volcengine:vmp:Workspace
properties:
instanceTypeId: vmp.standard.15d
deleteProtectionEnabled: false
description: acc-test-1
username: admin123
password: Pass123456
fooContact:
type: volcengine:vmp:Contact
properties:
email: acctest1@tftest.com
webhook:
address: https://www.acctest1.com
larkBotWebhook:
address: https://www.acctest1.com
dingTalkBotWebhook:
address: https://www.dingacctest1.com
atMobiles:
- '18046891812'
phoneNumber:
countryCode: '+86'
number: '18310101010'
foo1Contact:
type: volcengine:vmp:Contact
properties:
email: acctest2@tftest.com
webhook:
address: https://www.acctest2.com
larkBotWebhook:
address: https://www.acctest2.com
dingTalkBotWebhook:
address: https://www.dingacctest2.com
atMobiles:
- '18046891813'
phoneNumber:
countryCode: '+86'
number: '18310101011'
fooContactGroup:
type: volcengine:vmp:ContactGroup
properties:
contactIds:
- ${fooContact.id}
foo1ContactGroup:
type: volcengine:vmp:ContactGroup
properties:
contactIds:
- ${foo1Contact.id}
fooNotifyPolicy:
type: volcengine:vmp:NotifyPolicy
properties:
description: acc-test-1
levels:
- level: P1
contactGroupIds:
- ${fooContactGroup.id}
channels:
- Email
- Webhook
- level: P0
contactGroupIds:
- ${foo1ContactGroup.id}
channels:
- LarkBotWebhook
fooNotifyGroupPolicy:
type: volcengine:vmp:NotifyGroupPolicy
properties:
description: acc-test-1
levels:
- level: P2
groupBies:
- __rule__
groupWait: '35'
groupInterval: '60'
repeatInterval: '70'
- level: P0
groupBies:
- __rule__
groupWait: '30'
groupInterval: '60'
repeatInterval: '70'
- level: P1
groupBies:
- __rule__
groupWait: '40'
groupInterval: '75'
repeatInterval: '75'
fooAlertingRule:
type: volcengine:vmp:AlertingRule
properties:
description: acc-test-1
notifyPolicyId: ${fooNotifyPolicy.id}
notifyGroupPolicyId: ${fooNotifyGroupPolicy.id}
query:
workspaceId: ${fooWorkspace.id}
promQl: sum(up)
levels:
- level: P0
for: 0s
comparator: '>='
threshold: 2
- level: P1
for: 0s
comparator: '>='
threshold: 1
- level: P2
for: 0s
comparator: '>='
threshold: 0.5
annotations:
- name: annotation
value: acc-test
labels:
- name: label
value: acc-test
Create AlertingRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new AlertingRule(name: string, args: AlertingRuleArgs, opts?: CustomResourceOptions);
@overload
def AlertingRule(resource_name: str,
args: AlertingRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def AlertingRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
levels: Optional[Sequence[AlertingRuleLevelArgs]] = None,
notify_group_policy_id: Optional[str] = None,
query: Optional[AlertingRuleQueryArgs] = None,
annotations: Optional[Sequence[AlertingRuleAnnotationArgs]] = None,
description: Optional[str] = None,
labels: Optional[Sequence[AlertingRuleLabelArgs]] = None,
name: Optional[str] = None,
notify_policy_id: Optional[str] = None)
func NewAlertingRule(ctx *Context, name string, args AlertingRuleArgs, opts ...ResourceOption) (*AlertingRule, error)
public AlertingRule(string name, AlertingRuleArgs args, CustomResourceOptions? opts = null)
public AlertingRule(String name, AlertingRuleArgs args)
public AlertingRule(String name, AlertingRuleArgs args, CustomResourceOptions options)
type: volcengine:vmp:AlertingRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args AlertingRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args AlertingRuleArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args AlertingRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AlertingRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AlertingRuleArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var alertingRuleResource = new Volcengine.Vmp.AlertingRule("alertingRuleResource", new()
{
Levels = new[]
{
new Volcengine.Vmp.Inputs.AlertingRuleLevelArgs
{
Comparator = "string",
For = "string",
Level = "string",
Threshold = 0,
},
},
NotifyGroupPolicyId = "string",
Query = new Volcengine.Vmp.Inputs.AlertingRuleQueryArgs
{
PromQl = "string",
WorkspaceId = "string",
},
Annotations = new[]
{
new Volcengine.Vmp.Inputs.AlertingRuleAnnotationArgs
{
Name = "string",
Value = "string",
},
},
Description = "string",
Labels = new[]
{
new Volcengine.Vmp.Inputs.AlertingRuleLabelArgs
{
Name = "string",
Value = "string",
},
},
Name = "string",
NotifyPolicyId = "string",
});
example, err := vmp.NewAlertingRule(ctx, "alertingRuleResource", &vmp.AlertingRuleArgs{
Levels: vmp.AlertingRuleLevelArray{
&vmp.AlertingRuleLevelArgs{
Comparator: pulumi.String("string"),
For: pulumi.String("string"),
Level: pulumi.String("string"),
Threshold: pulumi.Float64(0),
},
},
NotifyGroupPolicyId: pulumi.String("string"),
Query: &vmp.AlertingRuleQueryArgs{
PromQl: pulumi.String("string"),
WorkspaceId: pulumi.String("string"),
},
Annotations: vmp.AlertingRuleAnnotationArray{
&vmp.AlertingRuleAnnotationArgs{
Name: pulumi.String("string"),
Value: pulumi.String("string"),
},
},
Description: pulumi.String("string"),
Labels: vmp.AlertingRuleLabelArray{
&vmp.AlertingRuleLabelArgs{
Name: pulumi.String("string"),
Value: pulumi.String("string"),
},
},
Name: pulumi.String("string"),
NotifyPolicyId: pulumi.String("string"),
})
var alertingRuleResource = new AlertingRule("alertingRuleResource", AlertingRuleArgs.builder()
.levels(AlertingRuleLevelArgs.builder()
.comparator("string")
.for_("string")
.level("string")
.threshold(0.0)
.build())
.notifyGroupPolicyId("string")
.query(AlertingRuleQueryArgs.builder()
.promQl("string")
.workspaceId("string")
.build())
.annotations(AlertingRuleAnnotationArgs.builder()
.name("string")
.value("string")
.build())
.description("string")
.labels(AlertingRuleLabelArgs.builder()
.name("string")
.value("string")
.build())
.name("string")
.notifyPolicyId("string")
.build());
alerting_rule_resource = volcengine.vmp.AlertingRule("alertingRuleResource",
levels=[{
"comparator": "string",
"for_": "string",
"level": "string",
"threshold": 0,
}],
notify_group_policy_id="string",
query={
"prom_ql": "string",
"workspace_id": "string",
},
annotations=[{
"name": "string",
"value": "string",
}],
description="string",
labels=[{
"name": "string",
"value": "string",
}],
name="string",
notify_policy_id="string")
const alertingRuleResource = new volcengine.vmp.AlertingRule("alertingRuleResource", {
levels: [{
comparator: "string",
"for": "string",
level: "string",
threshold: 0,
}],
notifyGroupPolicyId: "string",
query: {
promQl: "string",
workspaceId: "string",
},
annotations: [{
name: "string",
value: "string",
}],
description: "string",
labels: [{
name: "string",
value: "string",
}],
name: "string",
notifyPolicyId: "string",
});
type: volcengine:vmp:AlertingRule
properties:
annotations:
- name: string
value: string
description: string
labels:
- name: string
value: string
levels:
- comparator: string
for: string
level: string
threshold: 0
name: string
notifyGroupPolicyId: string
notifyPolicyId: string
query:
promQl: string
workspaceId: string
AlertingRule Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The AlertingRule resource accepts the following input properties:
- Levels
List<Alerting
Rule Level> - The alerting levels of the vmp alerting rule.
- Notify
Group stringPolicy Id - The id of the notify group policy.
- Query
Alerting
Rule Query - The alerting query of the vmp alerting rule.
- Annotations
List<Alerting
Rule Annotation> - The annotations of the vmp alerting rule.
- Description string
- The description of the vmp alerting rule.
- Labels
List<Alerting
Rule Label> - The labels of the vmp alerting rule.
- Name string
- The name of the vmp alerting rule.
- Notify
Policy stringId - The id of the notify policy.
- Levels
[]Alerting
Rule Level Args - The alerting levels of the vmp alerting rule.
- Notify
Group stringPolicy Id - The id of the notify group policy.
- Query
Alerting
Rule Query Args - The alerting query of the vmp alerting rule.
- Annotations
[]Alerting
Rule Annotation Args - The annotations of the vmp alerting rule.
- Description string
- The description of the vmp alerting rule.
- Labels
[]Alerting
Rule Label Args - The labels of the vmp alerting rule.
- Name string
- The name of the vmp alerting rule.
- Notify
Policy stringId - The id of the notify policy.
- levels
List<Alerting
Rule Level> - The alerting levels of the vmp alerting rule.
- notify
Group StringPolicy Id - The id of the notify group policy.
- query
Alerting
Rule Query - The alerting query of the vmp alerting rule.
- annotations
List<Alerting
Rule Annotation> - The annotations of the vmp alerting rule.
- description String
- The description of the vmp alerting rule.
- labels
List<Alerting
Rule Label> - The labels of the vmp alerting rule.
- name String
- The name of the vmp alerting rule.
- notify
Policy StringId - The id of the notify policy.
- levels
Alerting
Rule Level[] - The alerting levels of the vmp alerting rule.
- notify
Group stringPolicy Id - The id of the notify group policy.
- query
Alerting
Rule Query - The alerting query of the vmp alerting rule.
- annotations
Alerting
Rule Annotation[] - The annotations of the vmp alerting rule.
- description string
- The description of the vmp alerting rule.
- labels
Alerting
Rule Label[] - The labels of the vmp alerting rule.
- name string
- The name of the vmp alerting rule.
- notify
Policy stringId - The id of the notify policy.
- levels
Sequence[Alerting
Rule Level Args] - The alerting levels of the vmp alerting rule.
- notify_
group_ strpolicy_ id - The id of the notify group policy.
- query
Alerting
Rule Query Args - The alerting query of the vmp alerting rule.
- annotations
Sequence[Alerting
Rule Annotation Args] - The annotations of the vmp alerting rule.
- description str
- The description of the vmp alerting rule.
- labels
Sequence[Alerting
Rule Label Args] - The labels of the vmp alerting rule.
- name str
- The name of the vmp alerting rule.
- notify_
policy_ strid - The id of the notify policy.
- levels List<Property Map>
- The alerting levels of the vmp alerting rule.
- notify
Group StringPolicy Id - The id of the notify group policy.
- query Property Map
- The alerting query of the vmp alerting rule.
- annotations List<Property Map>
- The annotations of the vmp alerting rule.
- description String
- The description of the vmp alerting rule.
- labels List<Property Map>
- The labels of the vmp alerting rule.
- name String
- The name of the vmp alerting rule.
- notify
Policy StringId - The id of the notify policy.
Outputs
All input properties are implicitly available as output properties. Additionally, the AlertingRule resource produces the following output properties:
- Create
Time string - The create time of the vmp alerting rule.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the vmp alerting rule.
- Update
Time string - The update time of the vmp alerting rule.
- Create
Time string - The create time of the vmp alerting rule.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the vmp alerting rule.
- Update
Time string - The update time of the vmp alerting rule.
- create
Time String - The create time of the vmp alerting rule.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the vmp alerting rule.
- update
Time String - The update time of the vmp alerting rule.
- create
Time string - The create time of the vmp alerting rule.
- id string
- The provider-assigned unique ID for this managed resource.
- status string
- The status of the vmp alerting rule.
- update
Time string - The update time of the vmp alerting rule.
- create_
time str - The create time of the vmp alerting rule.
- id str
- The provider-assigned unique ID for this managed resource.
- status str
- The status of the vmp alerting rule.
- update_
time str - The update time of the vmp alerting rule.
- create
Time String - The create time of the vmp alerting rule.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the vmp alerting rule.
- update
Time String - The update time of the vmp alerting rule.
Look up Existing AlertingRule Resource
Get an existing AlertingRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: AlertingRuleState, opts?: CustomResourceOptions): AlertingRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
annotations: Optional[Sequence[AlertingRuleAnnotationArgs]] = None,
create_time: Optional[str] = None,
description: Optional[str] = None,
labels: Optional[Sequence[AlertingRuleLabelArgs]] = None,
levels: Optional[Sequence[AlertingRuleLevelArgs]] = None,
name: Optional[str] = None,
notify_group_policy_id: Optional[str] = None,
notify_policy_id: Optional[str] = None,
query: Optional[AlertingRuleQueryArgs] = None,
status: Optional[str] = None,
update_time: Optional[str] = None) -> AlertingRule
func GetAlertingRule(ctx *Context, name string, id IDInput, state *AlertingRuleState, opts ...ResourceOption) (*AlertingRule, error)
public static AlertingRule Get(string name, Input<string> id, AlertingRuleState? state, CustomResourceOptions? opts = null)
public static AlertingRule get(String name, Output<String> id, AlertingRuleState state, CustomResourceOptions options)
resources: _: type: volcengine:vmp:AlertingRule get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Annotations
List<Alerting
Rule Annotation> - The annotations of the vmp alerting rule.
- Create
Time string - The create time of the vmp alerting rule.
- Description string
- The description of the vmp alerting rule.
- Labels
List<Alerting
Rule Label> - The labels of the vmp alerting rule.
- Levels
List<Alerting
Rule Level> - The alerting levels of the vmp alerting rule.
- Name string
- The name of the vmp alerting rule.
- Notify
Group stringPolicy Id - The id of the notify group policy.
- Notify
Policy stringId - The id of the notify policy.
- Query
Alerting
Rule Query - The alerting query of the vmp alerting rule.
- Status string
- The status of the vmp alerting rule.
- Update
Time string - The update time of the vmp alerting rule.
- Annotations
[]Alerting
Rule Annotation Args - The annotations of the vmp alerting rule.
- Create
Time string - The create time of the vmp alerting rule.
- Description string
- The description of the vmp alerting rule.
- Labels
[]Alerting
Rule Label Args - The labels of the vmp alerting rule.
- Levels
[]Alerting
Rule Level Args - The alerting levels of the vmp alerting rule.
- Name string
- The name of the vmp alerting rule.
- Notify
Group stringPolicy Id - The id of the notify group policy.
- Notify
Policy stringId - The id of the notify policy.
- Query
Alerting
Rule Query Args - The alerting query of the vmp alerting rule.
- Status string
- The status of the vmp alerting rule.
- Update
Time string - The update time of the vmp alerting rule.
- annotations
List<Alerting
Rule Annotation> - The annotations of the vmp alerting rule.
- create
Time String - The create time of the vmp alerting rule.
- description String
- The description of the vmp alerting rule.
- labels
List<Alerting
Rule Label> - The labels of the vmp alerting rule.
- levels
List<Alerting
Rule Level> - The alerting levels of the vmp alerting rule.
- name String
- The name of the vmp alerting rule.
- notify
Group StringPolicy Id - The id of the notify group policy.
- notify
Policy StringId - The id of the notify policy.
- query
Alerting
Rule Query - The alerting query of the vmp alerting rule.
- status String
- The status of the vmp alerting rule.
- update
Time String - The update time of the vmp alerting rule.
- annotations
Alerting
Rule Annotation[] - The annotations of the vmp alerting rule.
- create
Time string - The create time of the vmp alerting rule.
- description string
- The description of the vmp alerting rule.
- labels
Alerting
Rule Label[] - The labels of the vmp alerting rule.
- levels
Alerting
Rule Level[] - The alerting levels of the vmp alerting rule.
- name string
- The name of the vmp alerting rule.
- notify
Group stringPolicy Id - The id of the notify group policy.
- notify
Policy stringId - The id of the notify policy.
- query
Alerting
Rule Query - The alerting query of the vmp alerting rule.
- status string
- The status of the vmp alerting rule.
- update
Time string - The update time of the vmp alerting rule.
- annotations
Sequence[Alerting
Rule Annotation Args] - The annotations of the vmp alerting rule.
- create_
time str - The create time of the vmp alerting rule.
- description str
- The description of the vmp alerting rule.
- labels
Sequence[Alerting
Rule Label Args] - The labels of the vmp alerting rule.
- levels
Sequence[Alerting
Rule Level Args] - The alerting levels of the vmp alerting rule.
- name str
- The name of the vmp alerting rule.
- notify_
group_ strpolicy_ id - The id of the notify group policy.
- notify_
policy_ strid - The id of the notify policy.
- query
Alerting
Rule Query Args - The alerting query of the vmp alerting rule.
- status str
- The status of the vmp alerting rule.
- update_
time str - The update time of the vmp alerting rule.
- annotations List<Property Map>
- The annotations of the vmp alerting rule.
- create
Time String - The create time of the vmp alerting rule.
- description String
- The description of the vmp alerting rule.
- labels List<Property Map>
- The labels of the vmp alerting rule.
- levels List<Property Map>
- The alerting levels of the vmp alerting rule.
- name String
- The name of the vmp alerting rule.
- notify
Group StringPolicy Id - The id of the notify group policy.
- notify
Policy StringId - The id of the notify policy.
- query Property Map
- The alerting query of the vmp alerting rule.
- status String
- The status of the vmp alerting rule.
- update
Time String - The update time of the vmp alerting rule.
Supporting Types
AlertingRuleAnnotation, AlertingRuleAnnotationArgs
AlertingRuleLabel, AlertingRuleLabelArgs
AlertingRuleLevel, AlertingRuleLevelArgs
- Comparator string
- The comparator of the vmp alerting rule. Valid values:
>
,>=
,<
,<=
,==
,!=
. - For string
- The duration of the alerting rule. Valid values:
0s
,1m
,2m
,5m
,10m
. - Level string
- The level of the vmp alerting rule. Valid values:
P0
,P1
,P2
. The value of this field cannot be duplicate. - Threshold double
- The threshold of the vmp alerting rule.
- Comparator string
- The comparator of the vmp alerting rule. Valid values:
>
,>=
,<
,<=
,==
,!=
. - For string
- The duration of the alerting rule. Valid values:
0s
,1m
,2m
,5m
,10m
. - Level string
- The level of the vmp alerting rule. Valid values:
P0
,P1
,P2
. The value of this field cannot be duplicate. - Threshold float64
- The threshold of the vmp alerting rule.
- comparator String
- The comparator of the vmp alerting rule. Valid values:
>
,>=
,<
,<=
,==
,!=
. - for_ String
- The duration of the alerting rule. Valid values:
0s
,1m
,2m
,5m
,10m
. - level String
- The level of the vmp alerting rule. Valid values:
P0
,P1
,P2
. The value of this field cannot be duplicate. - threshold Double
- The threshold of the vmp alerting rule.
- comparator string
- The comparator of the vmp alerting rule. Valid values:
>
,>=
,<
,<=
,==
,!=
. - for string
- The duration of the alerting rule. Valid values:
0s
,1m
,2m
,5m
,10m
. - level string
- The level of the vmp alerting rule. Valid values:
P0
,P1
,P2
. The value of this field cannot be duplicate. - threshold number
- The threshold of the vmp alerting rule.
- comparator str
- The comparator of the vmp alerting rule. Valid values:
>
,>=
,<
,<=
,==
,!=
. - for_ str
- The duration of the alerting rule. Valid values:
0s
,1m
,2m
,5m
,10m
. - level str
- The level of the vmp alerting rule. Valid values:
P0
,P1
,P2
. The value of this field cannot be duplicate. - threshold float
- The threshold of the vmp alerting rule.
- comparator String
- The comparator of the vmp alerting rule. Valid values:
>
,>=
,<
,<=
,==
,!=
. - for String
- The duration of the alerting rule. Valid values:
0s
,1m
,2m
,5m
,10m
. - level String
- The level of the vmp alerting rule. Valid values:
P0
,P1
,P2
. The value of this field cannot be duplicate. - threshold Number
- The threshold of the vmp alerting rule.
AlertingRuleQuery, AlertingRuleQueryArgs
- Prom
Ql string - The prom ql of query.
- Workspace
Id string - The id of the workspace.
- Prom
Ql string - The prom ql of query.
- Workspace
Id string - The id of the workspace.
- prom
Ql String - The prom ql of query.
- workspace
Id String - The id of the workspace.
- prom
Ql string - The prom ql of query.
- workspace
Id string - The id of the workspace.
- prom_
ql str - The prom ql of query.
- workspace_
id str - The id of the workspace.
- prom
Ql String - The prom ql of query.
- workspace
Id String - The id of the workspace.
Import
VmpAlertingRule can be imported using the id, e.g.
$ pulumi import volcengine:vmp/alertingRule:AlertingRule default 5bd29e81-2717-4ac8-a1a6-d76da2b1****
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- volcengine volcengine/pulumi-volcengine
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
volcengine
Terraform Provider.