1. Packages
  2. Fastly
  3. API Docs
  4. Alert
Fastly v8.6.0 published on Monday, Apr 22, 2024 by Pulumi

fastly.Alert

Explore with Pulumi AI

fastly logo
Fastly v8.6.0 published on Monday, Apr 22, 2024 by Pulumi

    Provides a Fastly Alert. Alerts send notifications to custom integrations (e.g., Slack channels, PagerDuty, Microsoft Teams and New Relic) when an observed metric either exceeds or falls below a threshold.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as fastly from "@pulumi/fastly";
    
    const example = new fastly.ServiceVcl("example", {name: "my_vcl_service"});
    const exampleAlert = new fastly.Alert("example", {
        name: "my_vcl_service errors",
        serviceId: example.id,
        source: "stats",
        metric: "status_5xx",
        evaluationStrategy: {
            type: "above_threshold",
            period: "5m",
            threshold: 10,
        },
    });
    
    import pulumi
    import pulumi_fastly as fastly
    
    example = fastly.ServiceVcl("example", name="my_vcl_service")
    example_alert = fastly.Alert("example",
        name="my_vcl_service errors",
        service_id=example.id,
        source="stats",
        metric="status_5xx",
        evaluation_strategy=fastly.AlertEvaluationStrategyArgs(
            type="above_threshold",
            period="5m",
            threshold=10,
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-fastly/sdk/v8/go/fastly"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := fastly.NewServiceVcl(ctx, "example", &fastly.ServiceVclArgs{
    			Name: pulumi.String("my_vcl_service"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = fastly.NewAlert(ctx, "example", &fastly.AlertArgs{
    			Name:      pulumi.String("my_vcl_service errors"),
    			ServiceId: example.ID(),
    			Source:    pulumi.String("stats"),
    			Metric:    pulumi.String("status_5xx"),
    			EvaluationStrategy: &fastly.AlertEvaluationStrategyArgs{
    				Type:      pulumi.String("above_threshold"),
    				Period:    pulumi.String("5m"),
    				Threshold: pulumi.Float64(10),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Fastly = Pulumi.Fastly;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Fastly.ServiceVcl("example", new()
        {
            Name = "my_vcl_service",
        });
    
        var exampleAlert = new Fastly.Alert("example", new()
        {
            Name = "my_vcl_service errors",
            ServiceId = example.Id,
            Source = "stats",
            Metric = "status_5xx",
            EvaluationStrategy = new Fastly.Inputs.AlertEvaluationStrategyArgs
            {
                Type = "above_threshold",
                Period = "5m",
                Threshold = 10,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.fastly.ServiceVcl;
    import com.pulumi.fastly.ServiceVclArgs;
    import com.pulumi.fastly.Alert;
    import com.pulumi.fastly.AlertArgs;
    import com.pulumi.fastly.inputs.AlertEvaluationStrategyArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            var example = new ServiceVcl("example", ServiceVclArgs.builder()        
                .name("my_vcl_service")
                .build());
    
            var exampleAlert = new Alert("exampleAlert", AlertArgs.builder()        
                .name("my_vcl_service errors")
                .serviceId(example.id())
                .source("stats")
                .metric("status_5xx")
                .evaluationStrategy(AlertEvaluationStrategyArgs.builder()
                    .type("above_threshold")
                    .period("5m")
                    .threshold(10)
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: fastly:ServiceVcl
        properties:
          name: my_vcl_service
      exampleAlert:
        type: fastly:Alert
        name: example
        properties:
          name: my_vcl_service errors
          serviceId: ${example.id}
          source: stats
          metric: status_5xx
          evaluationStrategy:
            type: above_threshold
            period: 5m
            threshold: 10
    

    Create Alert Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Alert(name: string, args: AlertArgs, opts?: CustomResourceOptions);
    @overload
    def Alert(resource_name: str,
              args: AlertArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Alert(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              evaluation_strategy: Optional[AlertEvaluationStrategyArgs] = None,
              metric: Optional[str] = None,
              service_id: Optional[str] = None,
              source: Optional[str] = None,
              description: Optional[str] = None,
              dimensions: Optional[AlertDimensionsArgs] = None,
              integration_ids: Optional[Sequence[str]] = None,
              name: Optional[str] = None)
    func NewAlert(ctx *Context, name string, args AlertArgs, opts ...ResourceOption) (*Alert, error)
    public Alert(string name, AlertArgs args, CustomResourceOptions? opts = null)
    public Alert(String name, AlertArgs args)
    public Alert(String name, AlertArgs args, CustomResourceOptions options)
    
    type: fastly:Alert
    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 AlertArgs
    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 AlertArgs
    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 AlertArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AlertArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AlertArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var alertResource = new Fastly.Alert("alertResource", new()
    {
        EvaluationStrategy = new Fastly.Inputs.AlertEvaluationStrategyArgs
        {
            Period = "string",
            Threshold = 0,
            Type = "string",
        },
        Metric = "string",
        ServiceId = "string",
        Source = "string",
        Description = "string",
        Dimensions = new Fastly.Inputs.AlertDimensionsArgs
        {
            Domains = new[]
            {
                "string",
            },
            Origins = new[]
            {
                "string",
            },
        },
        IntegrationIds = new[]
        {
            "string",
        },
        Name = "string",
    });
    
    example, err := fastly.NewAlert(ctx, "alertResource", &fastly.AlertArgs{
    	EvaluationStrategy: &fastly.AlertEvaluationStrategyArgs{
    		Period:    pulumi.String("string"),
    		Threshold: pulumi.Float64(0),
    		Type:      pulumi.String("string"),
    	},
    	Metric:      pulumi.String("string"),
    	ServiceId:   pulumi.String("string"),
    	Source:      pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Dimensions: &fastly.AlertDimensionsArgs{
    		Domains: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    		Origins: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	IntegrationIds: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Name: pulumi.String("string"),
    })
    
    var alertResource = new Alert("alertResource", AlertArgs.builder()        
        .evaluationStrategy(AlertEvaluationStrategyArgs.builder()
            .period("string")
            .threshold(0)
            .type("string")
            .build())
        .metric("string")
        .serviceId("string")
        .source("string")
        .description("string")
        .dimensions(AlertDimensionsArgs.builder()
            .domains("string")
            .origins("string")
            .build())
        .integrationIds("string")
        .name("string")
        .build());
    
    alert_resource = fastly.Alert("alertResource",
        evaluation_strategy=fastly.AlertEvaluationStrategyArgs(
            period="string",
            threshold=0,
            type="string",
        ),
        metric="string",
        service_id="string",
        source="string",
        description="string",
        dimensions=fastly.AlertDimensionsArgs(
            domains=["string"],
            origins=["string"],
        ),
        integration_ids=["string"],
        name="string")
    
    const alertResource = new fastly.Alert("alertResource", {
        evaluationStrategy: {
            period: "string",
            threshold: 0,
            type: "string",
        },
        metric: "string",
        serviceId: "string",
        source: "string",
        description: "string",
        dimensions: {
            domains: ["string"],
            origins: ["string"],
        },
        integrationIds: ["string"],
        name: "string",
    });
    
    type: fastly:Alert
    properties:
        description: string
        dimensions:
            domains:
                - string
            origins:
                - string
        evaluationStrategy:
            period: string
            threshold: 0
            type: string
        integrationIds:
            - string
        metric: string
        name: string
        serviceId: string
        source: string
    

    Alert Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Alert resource accepts the following input properties:

    EvaluationStrategy AlertEvaluationStrategy
    Criteria on how to alert.
    Metric string
    The metric name to alert on for a specific source: domains, origins, or stats.
    ServiceId string
    The service which the alert monitors.
    Source string
    The source where the metric comes from. One of: domains, origins, stats.
    Description string
    Additional text that is included in the alert notification.
    Dimensions AlertDimensions
    More filters depending on the source type.
    IntegrationIds List<string>
    List of integrations used to notify when alert fires.
    Name string
    The name of the alert.
    EvaluationStrategy AlertEvaluationStrategyArgs
    Criteria on how to alert.
    Metric string
    The metric name to alert on for a specific source: domains, origins, or stats.
    ServiceId string
    The service which the alert monitors.
    Source string
    The source where the metric comes from. One of: domains, origins, stats.
    Description string
    Additional text that is included in the alert notification.
    Dimensions AlertDimensionsArgs
    More filters depending on the source type.
    IntegrationIds []string
    List of integrations used to notify when alert fires.
    Name string
    The name of the alert.
    evaluationStrategy AlertEvaluationStrategy
    Criteria on how to alert.
    metric String
    The metric name to alert on for a specific source: domains, origins, or stats.
    serviceId String
    The service which the alert monitors.
    source String
    The source where the metric comes from. One of: domains, origins, stats.
    description String
    Additional text that is included in the alert notification.
    dimensions AlertDimensions
    More filters depending on the source type.
    integrationIds List<String>
    List of integrations used to notify when alert fires.
    name String
    The name of the alert.
    evaluationStrategy AlertEvaluationStrategy
    Criteria on how to alert.
    metric string
    The metric name to alert on for a specific source: domains, origins, or stats.
    serviceId string
    The service which the alert monitors.
    source string
    The source where the metric comes from. One of: domains, origins, stats.
    description string
    Additional text that is included in the alert notification.
    dimensions AlertDimensions
    More filters depending on the source type.
    integrationIds string[]
    List of integrations used to notify when alert fires.
    name string
    The name of the alert.
    evaluation_strategy AlertEvaluationStrategyArgs
    Criteria on how to alert.
    metric str
    The metric name to alert on for a specific source: domains, origins, or stats.
    service_id str
    The service which the alert monitors.
    source str
    The source where the metric comes from. One of: domains, origins, stats.
    description str
    Additional text that is included in the alert notification.
    dimensions AlertDimensionsArgs
    More filters depending on the source type.
    integration_ids Sequence[str]
    List of integrations used to notify when alert fires.
    name str
    The name of the alert.
    evaluationStrategy Property Map
    Criteria on how to alert.
    metric String
    The metric name to alert on for a specific source: domains, origins, or stats.
    serviceId String
    The service which the alert monitors.
    source String
    The source where the metric comes from. One of: domains, origins, stats.
    description String
    Additional text that is included in the alert notification.
    dimensions Property Map
    More filters depending on the source type.
    integrationIds List<String>
    List of integrations used to notify when alert fires.
    name String
    The name of the alert.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Alert resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing Alert Resource

    Get an existing Alert 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?: AlertState, opts?: CustomResourceOptions): Alert
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            dimensions: Optional[AlertDimensionsArgs] = None,
            evaluation_strategy: Optional[AlertEvaluationStrategyArgs] = None,
            integration_ids: Optional[Sequence[str]] = None,
            metric: Optional[str] = None,
            name: Optional[str] = None,
            service_id: Optional[str] = None,
            source: Optional[str] = None) -> Alert
    func GetAlert(ctx *Context, name string, id IDInput, state *AlertState, opts ...ResourceOption) (*Alert, error)
    public static Alert Get(string name, Input<string> id, AlertState? state, CustomResourceOptions? opts = null)
    public static Alert get(String name, Output<String> id, AlertState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    The following state arguments are supported:
    Description string
    Additional text that is included in the alert notification.
    Dimensions AlertDimensions
    More filters depending on the source type.
    EvaluationStrategy AlertEvaluationStrategy
    Criteria on how to alert.
    IntegrationIds List<string>
    List of integrations used to notify when alert fires.
    Metric string
    The metric name to alert on for a specific source: domains, origins, or stats.
    Name string
    The name of the alert.
    ServiceId string
    The service which the alert monitors.
    Source string
    The source where the metric comes from. One of: domains, origins, stats.
    Description string
    Additional text that is included in the alert notification.
    Dimensions AlertDimensionsArgs
    More filters depending on the source type.
    EvaluationStrategy AlertEvaluationStrategyArgs
    Criteria on how to alert.
    IntegrationIds []string
    List of integrations used to notify when alert fires.
    Metric string
    The metric name to alert on for a specific source: domains, origins, or stats.
    Name string
    The name of the alert.
    ServiceId string
    The service which the alert monitors.
    Source string
    The source where the metric comes from. One of: domains, origins, stats.
    description String
    Additional text that is included in the alert notification.
    dimensions AlertDimensions
    More filters depending on the source type.
    evaluationStrategy AlertEvaluationStrategy
    Criteria on how to alert.
    integrationIds List<String>
    List of integrations used to notify when alert fires.
    metric String
    The metric name to alert on for a specific source: domains, origins, or stats.
    name String
    The name of the alert.
    serviceId String
    The service which the alert monitors.
    source String
    The source where the metric comes from. One of: domains, origins, stats.
    description string
    Additional text that is included in the alert notification.
    dimensions AlertDimensions
    More filters depending on the source type.
    evaluationStrategy AlertEvaluationStrategy
    Criteria on how to alert.
    integrationIds string[]
    List of integrations used to notify when alert fires.
    metric string
    The metric name to alert on for a specific source: domains, origins, or stats.
    name string
    The name of the alert.
    serviceId string
    The service which the alert monitors.
    source string
    The source where the metric comes from. One of: domains, origins, stats.
    description str
    Additional text that is included in the alert notification.
    dimensions AlertDimensionsArgs
    More filters depending on the source type.
    evaluation_strategy AlertEvaluationStrategyArgs
    Criteria on how to alert.
    integration_ids Sequence[str]
    List of integrations used to notify when alert fires.
    metric str
    The metric name to alert on for a specific source: domains, origins, or stats.
    name str
    The name of the alert.
    service_id str
    The service which the alert monitors.
    source str
    The source where the metric comes from. One of: domains, origins, stats.
    description String
    Additional text that is included in the alert notification.
    dimensions Property Map
    More filters depending on the source type.
    evaluationStrategy Property Map
    Criteria on how to alert.
    integrationIds List<String>
    List of integrations used to notify when alert fires.
    metric String
    The metric name to alert on for a specific source: domains, origins, or stats.
    name String
    The name of the alert.
    serviceId String
    The service which the alert monitors.
    source String
    The source where the metric comes from. One of: domains, origins, stats.

    Supporting Types

    AlertDimensions, AlertDimensionsArgs

    Domains List<string>
    Names of a subset of domains that the alert monitors.
    Origins List<string>
    Addresses of a subset of backends that the alert monitors.
    Domains []string
    Names of a subset of domains that the alert monitors.
    Origins []string
    Addresses of a subset of backends that the alert monitors.
    domains List<String>
    Names of a subset of domains that the alert monitors.
    origins List<String>
    Addresses of a subset of backends that the alert monitors.
    domains string[]
    Names of a subset of domains that the alert monitors.
    origins string[]
    Addresses of a subset of backends that the alert monitors.
    domains Sequence[str]
    Names of a subset of domains that the alert monitors.
    origins Sequence[str]
    Addresses of a subset of backends that the alert monitors.
    domains List<String>
    Names of a subset of domains that the alert monitors.
    origins List<String>
    Addresses of a subset of backends that the alert monitors.

    AlertEvaluationStrategy, AlertEvaluationStrategyArgs

    Period string
    The length of time to evaluate whether the conditions have been met. The data is polled every minute. One of: 5m, 15m, 30m.
    Threshold double
    Threshold used to alert.
    Type string
    Type of strategy to use to evaluate. One of: above_threshold, below_threshold.
    Period string
    The length of time to evaluate whether the conditions have been met. The data is polled every minute. One of: 5m, 15m, 30m.
    Threshold float64
    Threshold used to alert.
    Type string
    Type of strategy to use to evaluate. One of: above_threshold, below_threshold.
    period String
    The length of time to evaluate whether the conditions have been met. The data is polled every minute. One of: 5m, 15m, 30m.
    threshold Double
    Threshold used to alert.
    type String
    Type of strategy to use to evaluate. One of: above_threshold, below_threshold.
    period string
    The length of time to evaluate whether the conditions have been met. The data is polled every minute. One of: 5m, 15m, 30m.
    threshold number
    Threshold used to alert.
    type string
    Type of strategy to use to evaluate. One of: above_threshold, below_threshold.
    period str
    The length of time to evaluate whether the conditions have been met. The data is polled every minute. One of: 5m, 15m, 30m.
    threshold float
    Threshold used to alert.
    type str
    Type of strategy to use to evaluate. One of: above_threshold, below_threshold.
    period String
    The length of time to evaluate whether the conditions have been met. The data is polled every minute. One of: 5m, 15m, 30m.
    threshold Number
    Threshold used to alert.
    type String
    Type of strategy to use to evaluate. One of: above_threshold, below_threshold.

    Import

    Fastly Alerts can be imported using their ID, e.g.

    $ pulumi import fastly:index/alert:Alert example xxxxxxxxxxxxxxxxxxxx
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Fastly pulumi/pulumi-fastly
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the fastly Terraform Provider.
    fastly logo
    Fastly v8.6.0 published on Monday, Apr 22, 2024 by Pulumi