1. Packages
  2. Volcengine
  3. API Docs
  4. vmp
  5. getAlertingRules
Volcengine v0.0.34 published on Wednesday, Jul 2, 2025 by Volcengine

volcengine.vmp.getAlertingRules

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.34 published on Wednesday, Jul 2, 2025 by Volcengine

    Use this data source to query detailed information of vmp alerting rules

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@pulumi/volcengine";
    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: "***********",
    });
    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: "30",
                repeatInterval: "30",
            },
            {
                level: "P0",
                groupBies: ["__rule__"],
                groupWait: "30",
                groupInterval: "30",
                repeatInterval: "30",
            },
            {
                level: "P1",
                groupBies: ["__rule__"],
                groupWait: "40",
                groupInterval: "45",
                repeatInterval: "30",
            },
        ],
    });
    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,
            },
        ],
    });
    const fooAlertingRules = volcengine.vmp.getAlertingRulesOutput({
        ids: [fooAlertingRule.id],
    });
    
    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="***********")
    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="30",
                repeat_interval="30",
            ),
            volcengine.vmp.NotifyGroupPolicyLevelArgs(
                level="P0",
                group_bies=["__rule__"],
                group_wait="30",
                group_interval="30",
                repeat_interval="30",
            ),
            volcengine.vmp.NotifyGroupPolicyLevelArgs(
                level="P1",
                group_bies=["__rule__"],
                group_wait="40",
                group_interval="45",
                repeat_interval="30",
            ),
        ])
    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,
            ),
        ])
    foo_alerting_rules = volcengine.vmp.get_alerting_rules_output(ids=[foo_alerting_rule.id])
    
    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("***********"),
    		})
    		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("30"),
    					RepeatInterval: pulumi.String("30"),
    				},
    				&vmp.NotifyGroupPolicyLevelArgs{
    					Level: pulumi.String("P0"),
    					GroupBies: pulumi.StringArray{
    						pulumi.String("__rule__"),
    					},
    					GroupWait:      pulumi.String("30"),
    					GroupInterval:  pulumi.String("30"),
    					RepeatInterval: pulumi.String("30"),
    				},
    				&vmp.NotifyGroupPolicyLevelArgs{
    					Level: pulumi.String("P1"),
    					GroupBies: pulumi.StringArray{
    						pulumi.String("__rule__"),
    					},
    					GroupWait:      pulumi.String("40"),
    					GroupInterval:  pulumi.String("45"),
    					RepeatInterval: pulumi.String("30"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		fooAlertingRule, 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),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_ = vmp.GetAlertingRulesOutput(ctx, vmp.GetAlertingRulesOutputArgs{
    			Ids: pulumi.StringArray{
    				fooAlertingRule.ID(),
    			},
    		}, nil)
    		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 = "***********",
        });
    
        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 = "30",
                    RepeatInterval = "30",
                },
                new Volcengine.Vmp.Inputs.NotifyGroupPolicyLevelArgs
                {
                    Level = "P0",
                    GroupBies = new[]
                    {
                        "__rule__",
                    },
                    GroupWait = "30",
                    GroupInterval = "30",
                    RepeatInterval = "30",
                },
                new Volcengine.Vmp.Inputs.NotifyGroupPolicyLevelArgs
                {
                    Level = "P1",
                    GroupBies = new[]
                    {
                        "__rule__",
                    },
                    GroupWait = "40",
                    GroupInterval = "45",
                    RepeatInterval = "30",
                },
            },
        });
    
        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,
                },
            },
        });
    
        var fooAlertingRules = Volcengine.Vmp.GetAlertingRules.Invoke(new()
        {
            Ids = new[]
            {
                fooAlertingRule.Id,
            },
        });
    
    });
    
    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.VmpFunctions;
    import com.pulumi.volcengine.vmp.inputs.GetAlertingRulesArgs;
    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("***********")
                .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("30")
                        .repeatInterval("30")
                        .build(),
                    NotifyGroupPolicyLevelArgs.builder()
                        .level("P0")
                        .groupBies("__rule__")
                        .groupWait("30")
                        .groupInterval("30")
                        .repeatInterval("30")
                        .build(),
                    NotifyGroupPolicyLevelArgs.builder()
                        .level("P1")
                        .groupBies("__rule__")
                        .groupWait("40")
                        .groupInterval("45")
                        .repeatInterval("30")
                        .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())
                .build());
    
            final var fooAlertingRules = VmpFunctions.getAlertingRules(GetAlertingRulesArgs.builder()
                .ids(fooAlertingRule.id())
                .build());
    
        }
    }
    
    resources:
      fooWorkspace:
        type: volcengine:vmp:Workspace
        properties:
          instanceTypeId: vmp.standard.15d
          deleteProtectionEnabled: false
          description: acc-test-1
          username: admin123
          password: '***********'
      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: '30'
              repeatInterval: '30'
            - level: P0
              groupBies:
                - __rule__
              groupWait: '30'
              groupInterval: '30'
              repeatInterval: '30'
            - level: P1
              groupBies:
                - __rule__
              groupWait: '40'
              groupInterval: '45'
              repeatInterval: '30'
      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
    variables:
      fooAlertingRules:
        fn::invoke:
          Function: volcengine:vmp:getAlertingRules
          Arguments:
            ids:
              - ${fooAlertingRule.id}
    

    Using getAlertingRules

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getAlertingRules(args: GetAlertingRulesArgs, opts?: InvokeOptions): Promise<GetAlertingRulesResult>
    function getAlertingRulesOutput(args: GetAlertingRulesOutputArgs, opts?: InvokeOptions): Output<GetAlertingRulesResult>
    def get_alerting_rules(ids: Optional[Sequence[str]] = None,
                           name: Optional[str] = None,
                           name_regex: Optional[str] = None,
                           notify_group_policy_ids: Optional[Sequence[str]] = None,
                           notify_policy_ids: Optional[Sequence[str]] = None,
                           output_file: Optional[str] = None,
                           status: Optional[str] = None,
                           type: Optional[str] = None,
                           workspace_id: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetAlertingRulesResult
    def get_alerting_rules_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                           name: Optional[pulumi.Input[str]] = None,
                           name_regex: Optional[pulumi.Input[str]] = None,
                           notify_group_policy_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                           notify_policy_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                           output_file: Optional[pulumi.Input[str]] = None,
                           status: Optional[pulumi.Input[str]] = None,
                           type: Optional[pulumi.Input[str]] = None,
                           workspace_id: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetAlertingRulesResult]
    func GetAlertingRules(ctx *Context, args *GetAlertingRulesArgs, opts ...InvokeOption) (*GetAlertingRulesResult, error)
    func GetAlertingRulesOutput(ctx *Context, args *GetAlertingRulesOutputArgs, opts ...InvokeOption) GetAlertingRulesResultOutput

    > Note: This function is named GetAlertingRules in the Go SDK.

    public static class GetAlertingRules 
    {
        public static Task<GetAlertingRulesResult> InvokeAsync(GetAlertingRulesArgs args, InvokeOptions? opts = null)
        public static Output<GetAlertingRulesResult> Invoke(GetAlertingRulesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAlertingRulesResult> getAlertingRules(GetAlertingRulesArgs args, InvokeOptions options)
    public static Output<GetAlertingRulesResult> getAlertingRules(GetAlertingRulesArgs args, InvokeOptions options)
    
    fn::invoke:
      function: volcengine:vmp/getAlertingRules:getAlertingRules
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids List<string>
    A list of vmp alerting rule IDs.
    Name string
    The name of vmp alerting rule. This field support fuzzy query.
    NameRegex string
    A Name Regex of Resource.
    NotifyGroupPolicyIds List<string>
    A list of notify group policy IDs.
    NotifyPolicyIds List<string>
    A list of notify policy IDs.
    OutputFile string
    File name where to save data source results.
    Status string
    The status of vmp alerting rule. Valid values: Running, Disabled.
    Type string
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    WorkspaceId string
    The workspace id of vmp alerting rule.
    Ids []string
    A list of vmp alerting rule IDs.
    Name string
    The name of vmp alerting rule. This field support fuzzy query.
    NameRegex string
    A Name Regex of Resource.
    NotifyGroupPolicyIds []string
    A list of notify group policy IDs.
    NotifyPolicyIds []string
    A list of notify policy IDs.
    OutputFile string
    File name where to save data source results.
    Status string
    The status of vmp alerting rule. Valid values: Running, Disabled.
    Type string
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    WorkspaceId string
    The workspace id of vmp alerting rule.
    ids List<String>
    A list of vmp alerting rule IDs.
    name String
    The name of vmp alerting rule. This field support fuzzy query.
    nameRegex String
    A Name Regex of Resource.
    notifyGroupPolicyIds List<String>
    A list of notify group policy IDs.
    notifyPolicyIds List<String>
    A list of notify policy IDs.
    outputFile String
    File name where to save data source results.
    status String
    The status of vmp alerting rule. Valid values: Running, Disabled.
    type String
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    workspaceId String
    The workspace id of vmp alerting rule.
    ids string[]
    A list of vmp alerting rule IDs.
    name string
    The name of vmp alerting rule. This field support fuzzy query.
    nameRegex string
    A Name Regex of Resource.
    notifyGroupPolicyIds string[]
    A list of notify group policy IDs.
    notifyPolicyIds string[]
    A list of notify policy IDs.
    outputFile string
    File name where to save data source results.
    status string
    The status of vmp alerting rule. Valid values: Running, Disabled.
    type string
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    workspaceId string
    The workspace id of vmp alerting rule.
    ids Sequence[str]
    A list of vmp alerting rule IDs.
    name str
    The name of vmp alerting rule. This field support fuzzy query.
    name_regex str
    A Name Regex of Resource.
    notify_group_policy_ids Sequence[str]
    A list of notify group policy IDs.
    notify_policy_ids Sequence[str]
    A list of notify policy IDs.
    output_file str
    File name where to save data source results.
    status str
    The status of vmp alerting rule. Valid values: Running, Disabled.
    type str
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    workspace_id str
    The workspace id of vmp alerting rule.
    ids List<String>
    A list of vmp alerting rule IDs.
    name String
    The name of vmp alerting rule. This field support fuzzy query.
    nameRegex String
    A Name Regex of Resource.
    notifyGroupPolicyIds List<String>
    A list of notify group policy IDs.
    notifyPolicyIds List<String>
    A list of notify policy IDs.
    outputFile String
    File name where to save data source results.
    status String
    The status of vmp alerting rule. Valid values: Running, Disabled.
    type String
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    workspaceId String
    The workspace id of vmp alerting rule.

    getAlertingRules Result

    The following output properties are available:

    AlertingRules List<GetAlertingRulesAlertingRule>
    The collection of query.
    Id string
    The provider-assigned unique ID for this managed resource.
    TotalCount int
    The total count of query.
    Ids List<string>
    Name string
    The name of the vmp alerting rule.
    NameRegex string
    NotifyGroupPolicyIds List<string>
    NotifyPolicyIds List<string>
    OutputFile string
    Status string
    The status of the vmp alerting rule.
    Type string
    The type of the vmp alerting rule.
    WorkspaceId string
    The id of the workspace.
    AlertingRules []GetAlertingRulesAlertingRule
    The collection of query.
    Id string
    The provider-assigned unique ID for this managed resource.
    TotalCount int
    The total count of query.
    Ids []string
    Name string
    The name of the vmp alerting rule.
    NameRegex string
    NotifyGroupPolicyIds []string
    NotifyPolicyIds []string
    OutputFile string
    Status string
    The status of the vmp alerting rule.
    Type string
    The type of the vmp alerting rule.
    WorkspaceId string
    The id of the workspace.
    alertingRules List<GetAlertingRulesAlertingRule>
    The collection of query.
    id String
    The provider-assigned unique ID for this managed resource.
    totalCount Integer
    The total count of query.
    ids List<String>
    name String
    The name of the vmp alerting rule.
    nameRegex String
    notifyGroupPolicyIds List<String>
    notifyPolicyIds List<String>
    outputFile String
    status String
    The status of the vmp alerting rule.
    type String
    The type of the vmp alerting rule.
    workspaceId String
    The id of the workspace.
    alertingRules GetAlertingRulesAlertingRule[]
    The collection of query.
    id string
    The provider-assigned unique ID for this managed resource.
    totalCount number
    The total count of query.
    ids string[]
    name string
    The name of the vmp alerting rule.
    nameRegex string
    notifyGroupPolicyIds string[]
    notifyPolicyIds string[]
    outputFile string
    status string
    The status of the vmp alerting rule.
    type string
    The type of the vmp alerting rule.
    workspaceId string
    The id of the workspace.
    alerting_rules Sequence[GetAlertingRulesAlertingRule]
    The collection of query.
    id str
    The provider-assigned unique ID for this managed resource.
    total_count int
    The total count of query.
    ids Sequence[str]
    name str
    The name of the vmp alerting rule.
    name_regex str
    notify_group_policy_ids Sequence[str]
    notify_policy_ids Sequence[str]
    output_file str
    status str
    The status of the vmp alerting rule.
    type str
    The type of the vmp alerting rule.
    workspace_id str
    The id of the workspace.
    alertingRules List<Property Map>
    The collection of query.
    id String
    The provider-assigned unique ID for this managed resource.
    totalCount Number
    The total count of query.
    ids List<String>
    name String
    The name of the vmp alerting rule.
    nameRegex String
    notifyGroupPolicyIds List<String>
    notifyPolicyIds List<String>
    outputFile String
    status String
    The status of the vmp alerting rule.
    type String
    The type of the vmp alerting rule.
    workspaceId String
    The id of the workspace.

    Supporting Types

    GetAlertingRulesAlertingRule

    Annotations List<GetAlertingRulesAlertingRuleAnnotation>
    The annotations of the vmp alerting rule.
    CreateTime string
    The create time of the vmp alerting rule.
    Description string
    The description of the vmp alerting rule.
    Id string
    The id of the vmp alerting rule.
    Labels List<GetAlertingRulesAlertingRuleLabel>
    The labels of the vmp alerting rule.
    Levels List<GetAlertingRulesAlertingRuleLevel>
    The alerting levels of the vmp alerting rule.
    Name string
    The name of vmp alerting rule. This field support fuzzy query.
    NotifyGroupPolicyId string
    The notify group policy id of the vmp alerting rule.
    NotifyPolicyId string
    The notify policy id of the vmp alerting rule.
    Queries List<GetAlertingRulesAlertingRuleQuery>
    The alerting query of the vmp alerting rule.
    Status string
    The status of vmp alerting rule. Valid values: Running, Disabled.
    Type string
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    UpdateTime string
    The update time of the vmp alerting rule.
    Annotations []GetAlertingRulesAlertingRuleAnnotation
    The annotations of the vmp alerting rule.
    CreateTime string
    The create time of the vmp alerting rule.
    Description string
    The description of the vmp alerting rule.
    Id string
    The id of the vmp alerting rule.
    Labels []GetAlertingRulesAlertingRuleLabel
    The labels of the vmp alerting rule.
    Levels []GetAlertingRulesAlertingRuleLevel
    The alerting levels of the vmp alerting rule.
    Name string
    The name of vmp alerting rule. This field support fuzzy query.
    NotifyGroupPolicyId string
    The notify group policy id of the vmp alerting rule.
    NotifyPolicyId string
    The notify policy id of the vmp alerting rule.
    Queries []GetAlertingRulesAlertingRuleQuery
    The alerting query of the vmp alerting rule.
    Status string
    The status of vmp alerting rule. Valid values: Running, Disabled.
    Type string
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    UpdateTime string
    The update time of the vmp alerting rule.
    annotations List<GetAlertingRulesAlertingRuleAnnotation>
    The annotations of the vmp alerting rule.
    createTime String
    The create time of the vmp alerting rule.
    description String
    The description of the vmp alerting rule.
    id String
    The id of the vmp alerting rule.
    labels List<GetAlertingRulesAlertingRuleLabel>
    The labels of the vmp alerting rule.
    levels List<GetAlertingRulesAlertingRuleLevel>
    The alerting levels of the vmp alerting rule.
    name String
    The name of vmp alerting rule. This field support fuzzy query.
    notifyGroupPolicyId String
    The notify group policy id of the vmp alerting rule.
    notifyPolicyId String
    The notify policy id of the vmp alerting rule.
    queries List<GetAlertingRulesAlertingRuleQuery>
    The alerting query of the vmp alerting rule.
    status String
    The status of vmp alerting rule. Valid values: Running, Disabled.
    type String
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    updateTime String
    The update time of the vmp alerting rule.
    annotations GetAlertingRulesAlertingRuleAnnotation[]
    The annotations of the vmp alerting rule.
    createTime string
    The create time of the vmp alerting rule.
    description string
    The description of the vmp alerting rule.
    id string
    The id of the vmp alerting rule.
    labels GetAlertingRulesAlertingRuleLabel[]
    The labels of the vmp alerting rule.
    levels GetAlertingRulesAlertingRuleLevel[]
    The alerting levels of the vmp alerting rule.
    name string
    The name of vmp alerting rule. This field support fuzzy query.
    notifyGroupPolicyId string
    The notify group policy id of the vmp alerting rule.
    notifyPolicyId string
    The notify policy id of the vmp alerting rule.
    queries GetAlertingRulesAlertingRuleQuery[]
    The alerting query of the vmp alerting rule.
    status string
    The status of vmp alerting rule. Valid values: Running, Disabled.
    type string
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    updateTime string
    The update time of the vmp alerting rule.
    annotations Sequence[GetAlertingRulesAlertingRuleAnnotation]
    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.
    id str
    The id of the vmp alerting rule.
    labels Sequence[GetAlertingRulesAlertingRuleLabel]
    The labels of the vmp alerting rule.
    levels Sequence[GetAlertingRulesAlertingRuleLevel]
    The alerting levels of the vmp alerting rule.
    name str
    The name of vmp alerting rule. This field support fuzzy query.
    notify_group_policy_id str
    The notify group policy id of the vmp alerting rule.
    notify_policy_id str
    The notify policy id of the vmp alerting rule.
    queries Sequence[GetAlertingRulesAlertingRuleQuery]
    The alerting query of the vmp alerting rule.
    status str
    The status of vmp alerting rule. Valid values: Running, Disabled.
    type str
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    update_time str
    The update time of the vmp alerting rule.
    annotations List<Property Map>
    The annotations of the vmp alerting rule.
    createTime String
    The create time of the vmp alerting rule.
    description String
    The description of the vmp alerting rule.
    id String
    The id 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 vmp alerting rule. This field support fuzzy query.
    notifyGroupPolicyId String
    The notify group policy id of the vmp alerting rule.
    notifyPolicyId String
    The notify policy id of the vmp alerting rule.
    queries List<Property Map>
    The alerting query of the vmp alerting rule.
    status String
    The status of vmp alerting rule. Valid values: Running, Disabled.
    type String
    The type of vmp alerting rule. Valid values: vmp/PromQL.
    updateTime String
    The update time of the vmp alerting rule.

    GetAlertingRulesAlertingRuleAnnotation

    Name string
    The name of vmp alerting rule. This field support fuzzy query.
    Value string
    The value of the label.
    Name string
    The name of vmp alerting rule. This field support fuzzy query.
    Value string
    The value of the label.
    name String
    The name of vmp alerting rule. This field support fuzzy query.
    value String
    The value of the label.
    name string
    The name of vmp alerting rule. This field support fuzzy query.
    value string
    The value of the label.
    name str
    The name of vmp alerting rule. This field support fuzzy query.
    value str
    The value of the label.
    name String
    The name of vmp alerting rule. This field support fuzzy query.
    value String
    The value of the label.

    GetAlertingRulesAlertingRuleLabel

    Key string
    The name of the label.
    Value string
    The value of the label.
    Key string
    The name of the label.
    Value string
    The value of the label.
    key String
    The name of the label.
    value String
    The value of the label.
    key string
    The name of the label.
    value string
    The value of the label.
    key str
    The name of the label.
    value str
    The value of the label.
    key String
    The name of the label.
    value String
    The value of the label.

    GetAlertingRulesAlertingRuleLevel

    Comparator string
    The comparator of the vmp alerting rule.
    For string
    The duration of the alerting rule.
    Level string
    The level of the vmp alerting rule.
    Threshold double
    The threshold of the vmp alerting rule.
    Comparator string
    The comparator of the vmp alerting rule.
    For string
    The duration of the alerting rule.
    Level string
    The level of the vmp alerting rule.
    Threshold float64
    The threshold of the vmp alerting rule.
    comparator String
    The comparator of the vmp alerting rule.
    for_ String
    The duration of the alerting rule.
    level String
    The level of the vmp alerting rule.
    threshold Double
    The threshold of the vmp alerting rule.
    comparator string
    The comparator of the vmp alerting rule.
    for string
    The duration of the alerting rule.
    level string
    The level of the vmp alerting rule.
    threshold number
    The threshold of the vmp alerting rule.
    comparator str
    The comparator of the vmp alerting rule.
    for_ str
    The duration of the alerting rule.
    level str
    The level of the vmp alerting rule.
    threshold float
    The threshold of the vmp alerting rule.
    comparator String
    The comparator of the vmp alerting rule.
    for String
    The duration of the alerting rule.
    level String
    The level of the vmp alerting rule.
    threshold Number
    The threshold of the vmp alerting rule.

    GetAlertingRulesAlertingRuleQuery

    PromQl string
    The prom ql of query.
    WorkspaceId string
    The workspace id of vmp alerting rule.
    PromQl string
    The prom ql of query.
    WorkspaceId string
    The workspace id of vmp alerting rule.
    promQl String
    The prom ql of query.
    workspaceId String
    The workspace id of vmp alerting rule.
    promQl string
    The prom ql of query.
    workspaceId string
    The workspace id of vmp alerting rule.
    prom_ql str
    The prom ql of query.
    workspace_id str
    The workspace id of vmp alerting rule.
    promQl String
    The prom ql of query.
    workspaceId String
    The workspace id of vmp alerting rule.

    Package Details

    Repository
    volcengine volcengine/pulumi-volcengine
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the volcengine Terraform Provider.
    volcengine logo
    Volcengine v0.0.34 published on Wednesday, Jul 2, 2025 by Volcengine