Gets information about preconfigured alert rules available in Scaleway Cockpit.
Preconfigured alerts are ready-to-use alert rules that monitor common metrics for Scaleway services.
You can enable these alerts in your Alert Manager using the scaleway.observability.AlertManager resource.
For more information, refer to Cockpit’s product documentation and API documentation.
Example Usage
Basic usage
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";
const main = scaleway.observability.getPreconfiguredAlert({
projectId: project.id,
});
export const availableAlerts = main.then(main => main.alerts);
import pulumi
import pulumi_scaleway as scaleway
main = scaleway.observability.get_preconfigured_alert(project_id=project["id"])
pulumi.export("availableAlerts", main.alerts)
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/observability"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
main, err := observability.GetPreconfiguredAlert(ctx, &observability.GetPreconfiguredAlertArgs{
ProjectId: pulumi.StringRef(project.Id),
}, nil)
if err != nil {
return err
}
ctx.Export("availableAlerts", main.Alerts)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumi.Scaleway;
return await Deployment.RunAsync(() =>
{
var main = Scaleway.Observability.GetPreconfiguredAlert.Invoke(new()
{
ProjectId = project.Id,
});
return new Dictionary<string, object?>
{
["availableAlerts"] = main.Apply(getPreconfiguredAlertResult => getPreconfiguredAlertResult.Alerts),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.observability.ObservabilityFunctions;
import com.pulumi.scaleway.observability.inputs.GetPreconfiguredAlertArgs;
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) {
final var main = ObservabilityFunctions.getPreconfiguredAlert(GetPreconfiguredAlertArgs.builder()
.projectId(project.id())
.build());
ctx.export("availableAlerts", main.alerts());
}
}
variables:
main:
fn::invoke:
function: scaleway:observability:getPreconfiguredAlert
arguments:
projectId: ${project.id}
outputs:
availableAlerts: ${main.alerts}
Filter by status
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";
const enabled = scaleway.observability.getPreconfiguredAlert({
projectId: project.id,
ruleStatus: "enabled",
});
const disabled = scaleway.observability.getPreconfiguredAlert({
projectId: project.id,
ruleStatus: "disabled",
});
import pulumi
import pulumi_scaleway as scaleway
enabled = scaleway.observability.get_preconfigured_alert(project_id=project["id"],
rule_status="enabled")
disabled = scaleway.observability.get_preconfigured_alert(project_id=project["id"],
rule_status="disabled")
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/observability"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := observability.GetPreconfiguredAlert(ctx, &observability.GetPreconfiguredAlertArgs{
ProjectId: pulumi.StringRef(project.Id),
RuleStatus: pulumi.StringRef("enabled"),
}, nil)
if err != nil {
return err
}
_, err = observability.GetPreconfiguredAlert(ctx, &observability.GetPreconfiguredAlertArgs{
ProjectId: pulumi.StringRef(project.Id),
RuleStatus: pulumi.StringRef("disabled"),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumi.Scaleway;
return await Deployment.RunAsync(() =>
{
var enabled = Scaleway.Observability.GetPreconfiguredAlert.Invoke(new()
{
ProjectId = project.Id,
RuleStatus = "enabled",
});
var disabled = Scaleway.Observability.GetPreconfiguredAlert.Invoke(new()
{
ProjectId = project.Id,
RuleStatus = "disabled",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.observability.ObservabilityFunctions;
import com.pulumi.scaleway.observability.inputs.GetPreconfiguredAlertArgs;
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) {
final var enabled = ObservabilityFunctions.getPreconfiguredAlert(GetPreconfiguredAlertArgs.builder()
.projectId(project.id())
.ruleStatus("enabled")
.build());
final var disabled = ObservabilityFunctions.getPreconfiguredAlert(GetPreconfiguredAlertArgs.builder()
.projectId(project.id())
.ruleStatus("disabled")
.build());
}
}
variables:
enabled:
fn::invoke:
function: scaleway:observability:getPreconfiguredAlert
arguments:
projectId: ${project.id}
ruleStatus: enabled
disabled:
fn::invoke:
function: scaleway:observability:getPreconfiguredAlert
arguments:
projectId: ${project.id}
ruleStatus: disabled
Use with Alert Manager
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";
const project = new scaleway.account.Project("project", {name: "my-observability-project"});
const main = new scaleway.observability.Cockpit("main", {projectId: project.id});
const all = scaleway.observability.getPreconfiguredAlertOutput({
projectId: main.projectId,
});
const mainAlertManager = new scaleway.observability.AlertManager("main", {
projectId: main.projectId,
preconfiguredAlertIds: all.apply(all => .filter(alert => alert.productName == "instance" && alert.ruleStatus == "disabled").map(alert => (alert.preconfiguredRuleId))),
contactPoints: [{
email: "alerts@example.com",
}],
});
import pulumi
import pulumi_scaleway as scaleway
import pulumiverse_scaleway as scaleway
project = scaleway.account.Project("project", name="my-observability-project")
main = scaleway.observability.Cockpit("main", project_id=project.id)
all = scaleway.observability.get_preconfigured_alert_output(project_id=main.project_id)
main_alert_manager = scaleway.observability.AlertManager("main",
project_id=main.project_id,
preconfigured_alert_ids=all.apply(lambda all: [alert.preconfigured_rule_id for alert in all.alerts if alert.product_name == "instance" and alert.rule_status == "disabled"]),
contact_points=[{
"email": "alerts@example.com",
}])
Example coming soon!
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumi.Scaleway;
using Scaleway = Pulumiverse.Scaleway;
return await Deployment.RunAsync(() =>
{
var project = new Scaleway.Account.Project("project", new()
{
Name = "my-observability-project",
});
var main = new Scaleway.Observability.Cockpit("main", new()
{
ProjectId = project.Id,
});
var all = Scaleway.Observability.GetPreconfiguredAlert.Invoke(new()
{
ProjectId = main.ProjectId,
});
var mainAlertManager = new Scaleway.Observability.AlertManager("main", new()
{
ProjectId = main.ProjectId,
PreconfiguredAlertIds = .Where(alert => alert.ProductName == "instance" && alert.RuleStatus == "disabled").Select(alert =>
{
return alert.PreconfiguredRuleId;
}).ToList(),
ContactPoints = new[]
{
new Scaleway.Observability.Inputs.AlertManagerContactPointArgs
{
Email = "alerts@example.com",
},
},
});
});
Example coming soon!
Example coming soon!
Using getPreconfiguredAlert
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 getPreconfiguredAlert(args: GetPreconfiguredAlertArgs, opts?: InvokeOptions): Promise<GetPreconfiguredAlertResult>
function getPreconfiguredAlertOutput(args: GetPreconfiguredAlertOutputArgs, opts?: InvokeOptions): Output<GetPreconfiguredAlertResult>def get_preconfigured_alert(data_source_id: Optional[str] = None,
project_id: Optional[str] = None,
region: Optional[str] = None,
rule_status: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetPreconfiguredAlertResult
def get_preconfigured_alert_output(data_source_id: Optional[pulumi.Input[str]] = None,
project_id: Optional[pulumi.Input[str]] = None,
region: Optional[pulumi.Input[str]] = None,
rule_status: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetPreconfiguredAlertResult]func GetPreconfiguredAlert(ctx *Context, args *GetPreconfiguredAlertArgs, opts ...InvokeOption) (*GetPreconfiguredAlertResult, error)
func GetPreconfiguredAlertOutput(ctx *Context, args *GetPreconfiguredAlertOutputArgs, opts ...InvokeOption) GetPreconfiguredAlertResultOutput> Note: This function is named GetPreconfiguredAlert in the Go SDK.
public static class GetPreconfiguredAlert
{
public static Task<GetPreconfiguredAlertResult> InvokeAsync(GetPreconfiguredAlertArgs args, InvokeOptions? opts = null)
public static Output<GetPreconfiguredAlertResult> Invoke(GetPreconfiguredAlertInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetPreconfiguredAlertResult> getPreconfiguredAlert(GetPreconfiguredAlertArgs args, InvokeOptions options)
public static Output<GetPreconfiguredAlertResult> getPreconfiguredAlert(GetPreconfiguredAlertArgs args, InvokeOptions options)
fn::invoke:
function: scaleway:observability/getPreconfiguredAlert:getPreconfiguredAlert
arguments:
# arguments dictionaryThe following arguments are supported:
- Data
Source stringId - Filter alerts by data source ID.
- Project
Id string - The ID of the project the alerts are associated with. If not provided, the default project configured in the provider is used.
- Region string
- The region in which the alerts exist.
- Rule
Status string - Filter alerts by rule status. Valid values are
enabledordisabled.
- Data
Source stringId - Filter alerts by data source ID.
- Project
Id string - The ID of the project the alerts are associated with. If not provided, the default project configured in the provider is used.
- Region string
- The region in which the alerts exist.
- Rule
Status string - Filter alerts by rule status. Valid values are
enabledordisabled.
- data
Source StringId - Filter alerts by data source ID.
- project
Id String - The ID of the project the alerts are associated with. If not provided, the default project configured in the provider is used.
- region String
- The region in which the alerts exist.
- rule
Status String - Filter alerts by rule status. Valid values are
enabledordisabled.
- data
Source stringId - Filter alerts by data source ID.
- project
Id string - The ID of the project the alerts are associated with. If not provided, the default project configured in the provider is used.
- region string
- The region in which the alerts exist.
- rule
Status string - Filter alerts by rule status. Valid values are
enabledordisabled.
- data_
source_ strid - Filter alerts by data source ID.
- project_
id str - The ID of the project the alerts are associated with. If not provided, the default project configured in the provider is used.
- region str
- The region in which the alerts exist.
- rule_
status str - Filter alerts by rule status. Valid values are
enabledordisabled.
- data
Source StringId - Filter alerts by data source ID.
- project
Id String - The ID of the project the alerts are associated with. If not provided, the default project configured in the provider is used.
- region String
- The region in which the alerts exist.
- rule
Status String - Filter alerts by rule status. Valid values are
enabledordisabled.
getPreconfiguredAlert Result
The following output properties are available:
- Alerts
List<Pulumiverse.
Scaleway. Observability. Outputs. Get Preconfigured Alert Alert> - List of preconfigured alerts. Each alert contains:
- Id string
- The provider-assigned unique ID for this managed resource.
- Project
Id string - Data
Source stringId - ID of the data source containing the alert rule.
- Region string
- Rule
Status string - Status of the alert rule (
enabled,disabled,enabling,disabling).
- Alerts
[]Get
Preconfigured Alert Alert - List of preconfigured alerts. Each alert contains:
- Id string
- The provider-assigned unique ID for this managed resource.
- Project
Id string - Data
Source stringId - ID of the data source containing the alert rule.
- Region string
- Rule
Status string - Status of the alert rule (
enabled,disabled,enabling,disabling).
- alerts
List<Get
Preconfigured Alert Alert> - List of preconfigured alerts. Each alert contains:
- id String
- The provider-assigned unique ID for this managed resource.
- project
Id String - data
Source StringId - ID of the data source containing the alert rule.
- region String
- rule
Status String - Status of the alert rule (
enabled,disabled,enabling,disabling).
- alerts
Get
Preconfigured Alert Alert[] - List of preconfigured alerts. Each alert contains:
- id string
- The provider-assigned unique ID for this managed resource.
- project
Id string - data
Source stringId - ID of the data source containing the alert rule.
- region string
- rule
Status string - Status of the alert rule (
enabled,disabled,enabling,disabling).
- alerts
Sequence[Get
Preconfigured Alert Alert] - List of preconfigured alerts. Each alert contains:
- id str
- The provider-assigned unique ID for this managed resource.
- project_
id str - data_
source_ strid - ID of the data source containing the alert rule.
- region str
- rule_
status str - Status of the alert rule (
enabled,disabled,enabling,disabling).
- alerts List<Property Map>
- List of preconfigured alerts. Each alert contains:
- id String
- The provider-assigned unique ID for this managed resource.
- project
Id String - data
Source StringId - ID of the data source containing the alert rule.
- region String
- rule
Status String - Status of the alert rule (
enabled,disabled,enabling,disabling).
Supporting Types
GetPreconfiguredAlertAlert
- Annotations Dictionary<string, string>
- Map of annotations attached to the alert.
- Data
Source stringId - Filter alerts by data source ID.
- Display
Description string - Human-readable description of the alert.
- Display
Name string - Human-readable name of the alert.
- Duration string
- Duration for which the condition must be true before the alert fires (e.g., "5m").
- Name string
- Name of the alert rule.
- Preconfigured
Rule stringId - Unique identifier of the preconfigured rule. Use this ID in
scaleway.observability.AlertManagerresource. - Product
Family string - Family of the product (e.g., "compute", "storage", "network").
- Product
Name string - Scaleway product associated with the alert (e.g., "instance", "rdb", "kubernetes").
- Rule string
- PromQL expression defining the alert condition.
- Rule
Status string - Filter alerts by rule status. Valid values are
enabledordisabled. - State string
- Current state of the alert (
inactive,pending,firing).
- Annotations map[string]string
- Map of annotations attached to the alert.
- Data
Source stringId - Filter alerts by data source ID.
- Display
Description string - Human-readable description of the alert.
- Display
Name string - Human-readable name of the alert.
- Duration string
- Duration for which the condition must be true before the alert fires (e.g., "5m").
- Name string
- Name of the alert rule.
- Preconfigured
Rule stringId - Unique identifier of the preconfigured rule. Use this ID in
scaleway.observability.AlertManagerresource. - Product
Family string - Family of the product (e.g., "compute", "storage", "network").
- Product
Name string - Scaleway product associated with the alert (e.g., "instance", "rdb", "kubernetes").
- Rule string
- PromQL expression defining the alert condition.
- Rule
Status string - Filter alerts by rule status. Valid values are
enabledordisabled. - State string
- Current state of the alert (
inactive,pending,firing).
- annotations Map<String,String>
- Map of annotations attached to the alert.
- data
Source StringId - Filter alerts by data source ID.
- display
Description String - Human-readable description of the alert.
- display
Name String - Human-readable name of the alert.
- duration String
- Duration for which the condition must be true before the alert fires (e.g., "5m").
- name String
- Name of the alert rule.
- preconfigured
Rule StringId - Unique identifier of the preconfigured rule. Use this ID in
scaleway.observability.AlertManagerresource. - product
Family String - Family of the product (e.g., "compute", "storage", "network").
- product
Name String - Scaleway product associated with the alert (e.g., "instance", "rdb", "kubernetes").
- rule String
- PromQL expression defining the alert condition.
- rule
Status String - Filter alerts by rule status. Valid values are
enabledordisabled. - state String
- Current state of the alert (
inactive,pending,firing).
- annotations {[key: string]: string}
- Map of annotations attached to the alert.
- data
Source stringId - Filter alerts by data source ID.
- display
Description string - Human-readable description of the alert.
- display
Name string - Human-readable name of the alert.
- duration string
- Duration for which the condition must be true before the alert fires (e.g., "5m").
- name string
- Name of the alert rule.
- preconfigured
Rule stringId - Unique identifier of the preconfigured rule. Use this ID in
scaleway.observability.AlertManagerresource. - product
Family string - Family of the product (e.g., "compute", "storage", "network").
- product
Name string - Scaleway product associated with the alert (e.g., "instance", "rdb", "kubernetes").
- rule string
- PromQL expression defining the alert condition.
- rule
Status string - Filter alerts by rule status. Valid values are
enabledordisabled. - state string
- Current state of the alert (
inactive,pending,firing).
- annotations Mapping[str, str]
- Map of annotations attached to the alert.
- data_
source_ strid - Filter alerts by data source ID.
- display_
description str - Human-readable description of the alert.
- display_
name str - Human-readable name of the alert.
- duration str
- Duration for which the condition must be true before the alert fires (e.g., "5m").
- name str
- Name of the alert rule.
- preconfigured_
rule_ strid - Unique identifier of the preconfigured rule. Use this ID in
scaleway.observability.AlertManagerresource. - product_
family str - Family of the product (e.g., "compute", "storage", "network").
- product_
name str - Scaleway product associated with the alert (e.g., "instance", "rdb", "kubernetes").
- rule str
- PromQL expression defining the alert condition.
- rule_
status str - Filter alerts by rule status. Valid values are
enabledordisabled. - state str
- Current state of the alert (
inactive,pending,firing).
- annotations Map<String>
- Map of annotations attached to the alert.
- data
Source StringId - Filter alerts by data source ID.
- display
Description String - Human-readable description of the alert.
- display
Name String - Human-readable name of the alert.
- duration String
- Duration for which the condition must be true before the alert fires (e.g., "5m").
- name String
- Name of the alert rule.
- preconfigured
Rule StringId - Unique identifier of the preconfigured rule. Use this ID in
scaleway.observability.AlertManagerresource. - product
Family String - Family of the product (e.g., "compute", "storage", "network").
- product
Name String - Scaleway product associated with the alert (e.g., "instance", "rdb", "kubernetes").
- rule String
- PromQL expression defining the alert condition.
- rule
Status String - Filter alerts by rule status. Valid values are
enabledordisabled. - state String
- Current state of the alert (
inactive,pending,firing).
Package Details
- Repository
- scaleway pulumiverse/pulumi-scaleway
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
scalewayTerraform Provider.
