Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

Alarm

This resource allows you to create and manage alarms to trigger based on a set of conditions. Once triggerd a notification will be sent to the assigned recipients. When creating a new instance, there will also be a set of default alarms (cpu, memory and disk) created. All default alarms uses the default recipient for notifications.

By setting no_default_alarms to true in cloudamqp.Instance. This will create the instance without default alarms and avoid the need to import them to get full control.

Available for all subscription plans, but lemurand tigerare limited to fewer alarm types. The limited types supported can be seen in the table below in Alarm Type Reference.

Alarm Type reference

Valid options for notification type.

Required arguments for all alarms: instance_id, type and enabled
Optional argument for all alarms: tags, queue_regex, vhost_regex

| Name | Type | Shared | Dedicated | Required arguments | | —- | —- | —- | —- | —- | —- | | CPU | cpu | - | ✔ | time_threshold, value_threshold | | Memory | memory | - | ✔ | time_threshold, value_threshold | | Disk space | disk | - | ✔ | time_threshold, value_threshold | | Queue | queue | ✔ | ✔  | time_threshold, value_threshold, queue_regex, vhost_regex, message_type | | Connection | connection | ✔ | ✔ | time_threshold, value_threshold | | Consumer | consumer | ✔ | ✔ | time_threshold, value_threshold, queue, vhost | | Netsplit | netsplit | - | ✔ | time_threshold | | Server unreachable | server_unreachable | - | ✔ | time_threshold | | Notice | notice | ✔ | ✔ |

Dependency

This resource depends on CloudAMQP instance identifier, cloudamqp_instance.instance.id.

Example Usage

Coming soon!

Coming soon!

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as cloudamqp from "@pulumi/cloudamqp";

// New recipient
const recipient01 = new cloudamqp.Notification("recipient01", {
    instanceId: cloudamqp_instance.instance.id,
    type: "email",
    value: "alarm@example.com",
});
// New cpu alarm
const cpuAlarm = new cloudamqp.Alarm("cpuAlarm", {
    instanceId: cloudamqp_instance.instance.id,
    type: "cpu",
    enabled: true,
    valueThreshold: 95,
    timeThreshold: 600,
    recipient: [2],
});
// New memory alarm
const memoryAlarm = new cloudamqp.Alarm("memoryAlarm", {
    instanceId: cloudamqp_instance.instance.id,
    type: "memory",
    enabled: true,
    valueThreshold: 95,
    timeThreshold: 600,
    recipient: [2],
});

Create a Alarm Resource

new Alarm(name: string, args: AlarmArgs, opts?: CustomResourceOptions);
def Alarm(resource_name: str, opts: Optional[ResourceOptions] = None, enabled: Optional[bool] = None, instance_id: Optional[int] = None, message_type: Optional[str] = None, queue_regex: Optional[str] = None, recipients: Optional[Sequence[int]] = None, time_threshold: Optional[int] = None, type: Optional[str] = None, value_threshold: Optional[int] = None, vhost_regex: Optional[str] = None)
func NewAlarm(ctx *Context, name string, args AlarmArgs, opts ...ResourceOption) (*Alarm, error)
public Alarm(string name, AlarmArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args AlarmArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args AlarmArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AlarmArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Alarm Resource Properties

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

Inputs

The Alarm resource accepts the following input properties:

Enabled bool

Enable or disable the alarm to trigger.

InstanceId int

The CloudAMQP instance ID.

Recipients List<int>

Identifier for recipient to be notified. Leave empty to notify all recipients.

Type string

The alarm type, see valid options below.

MessageType string

Message type (total, unacked, ready) used by queue alarm type.

QueueRegex string

Regex for which queue to check.

TimeThreshold int

The time interval (in seconds) the value_threshold should be active before triggering an alarm.

ValueThreshold int

The value to trigger the alarm for.

VhostRegex string

Regex for which vhost to check

Enabled bool

Enable or disable the alarm to trigger.

InstanceId int

The CloudAMQP instance ID.

Recipients []int

Identifier for recipient to be notified. Leave empty to notify all recipients.

Type string

The alarm type, see valid options below.

MessageType string

Message type (total, unacked, ready) used by queue alarm type.

QueueRegex string

Regex for which queue to check.

TimeThreshold int

The time interval (in seconds) the value_threshold should be active before triggering an alarm.

ValueThreshold int

The value to trigger the alarm for.

VhostRegex string

Regex for which vhost to check

enabled boolean

Enable or disable the alarm to trigger.

instanceId number

The CloudAMQP instance ID.

recipients number[]

Identifier for recipient to be notified. Leave empty to notify all recipients.

type string

The alarm type, see valid options below.

messageType string

Message type (total, unacked, ready) used by queue alarm type.

queueRegex string

Regex for which queue to check.

timeThreshold number

The time interval (in seconds) the value_threshold should be active before triggering an alarm.

valueThreshold number

The value to trigger the alarm for.

vhostRegex string

Regex for which vhost to check

enabled bool

Enable or disable the alarm to trigger.

instance_id int

The CloudAMQP instance ID.

recipients Sequence[int]

Identifier for recipient to be notified. Leave empty to notify all recipients.

type str

The alarm type, see valid options below.

message_type str

Message type (total, unacked, ready) used by queue alarm type.

queue_regex str

Regex for which queue to check.

time_threshold int

The time interval (in seconds) the value_threshold should be active before triggering an alarm.

value_threshold int

The value to trigger the alarm for.

vhost_regex str

Regex for which vhost to check

Outputs

All input properties are implicitly available as output properties. Additionally, the Alarm 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing Alarm Resource

Get an existing Alarm 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?: AlarmState, opts?: CustomResourceOptions): Alarm
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, enabled: Optional[bool] = None, instance_id: Optional[int] = None, message_type: Optional[str] = None, queue_regex: Optional[str] = None, recipients: Optional[Sequence[int]] = None, time_threshold: Optional[int] = None, type: Optional[str] = None, value_threshold: Optional[int] = None, vhost_regex: Optional[str] = None) -> Alarm
func GetAlarm(ctx *Context, name string, id IDInput, state *AlarmState, opts ...ResourceOption) (*Alarm, error)
public static Alarm Get(string name, Input<string> id, AlarmState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Enabled bool

Enable or disable the alarm to trigger.

InstanceId int

The CloudAMQP instance ID.

MessageType string

Message type (total, unacked, ready) used by queue alarm type.

QueueRegex string

Regex for which queue to check.

Recipients List<int>

Identifier for recipient to be notified. Leave empty to notify all recipients.

TimeThreshold int

The time interval (in seconds) the value_threshold should be active before triggering an alarm.

Type string

The alarm type, see valid options below.

ValueThreshold int

The value to trigger the alarm for.

VhostRegex string

Regex for which vhost to check

Enabled bool

Enable or disable the alarm to trigger.

InstanceId int

The CloudAMQP instance ID.

MessageType string

Message type (total, unacked, ready) used by queue alarm type.

QueueRegex string

Regex for which queue to check.

Recipients []int

Identifier for recipient to be notified. Leave empty to notify all recipients.

TimeThreshold int

The time interval (in seconds) the value_threshold should be active before triggering an alarm.

Type string

The alarm type, see valid options below.

ValueThreshold int

The value to trigger the alarm for.

VhostRegex string

Regex for which vhost to check

enabled boolean

Enable or disable the alarm to trigger.

instanceId number

The CloudAMQP instance ID.

messageType string

Message type (total, unacked, ready) used by queue alarm type.

queueRegex string

Regex for which queue to check.

recipients number[]

Identifier for recipient to be notified. Leave empty to notify all recipients.

timeThreshold number

The time interval (in seconds) the value_threshold should be active before triggering an alarm.

type string

The alarm type, see valid options below.

valueThreshold number

The value to trigger the alarm for.

vhostRegex string

Regex for which vhost to check

enabled bool

Enable or disable the alarm to trigger.

instance_id int

The CloudAMQP instance ID.

message_type str

Message type (total, unacked, ready) used by queue alarm type.

queue_regex str

Regex for which queue to check.

recipients Sequence[int]

Identifier for recipient to be notified. Leave empty to notify all recipients.

time_threshold int

The time interval (in seconds) the value_threshold should be active before triggering an alarm.

type str

The alarm type, see valid options below.

value_threshold int

The value to trigger the alarm for.

vhost_regex str

Regex for which vhost to check

Import

cloudamqp_alarm can be imported using CloudAMQP internal identifier of the alarm together (CSV separated) with the instance identifier. To retrieve the alarm identifier, use CloudAMQP API

 $ pulumi import cloudamqp:index/alarm:Alarm alarm <alarm_id>,<instance_id>`

Package Details

Repository
https://github.com/pulumi/pulumi-cloudamqp
License
Apache-2.0
Notes
This Pulumi package is based on the cloudamqp Terraform Provider.