cloudamqp.Alarm
Explore with Pulumi AI
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 lemur
and tiger
are limited to fewer alarm types. The limited types supported can be seen in the table below in Alarm Type Reference.
Alarm Type reference
Supported alarm types: cpu, memory, disk, queue, connection, flow, consumer, netsplit, server_unreachable, notice
Required arguments for all alarms: instance_id, type, 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 |
Connection flow | flow | ✔ | ✔ | time_threshold, value_threshold |
Consumer | consumer | ✔ | ✔ | time_threshold, value_threshold, queue, vhost |
Netsplit | netsplit | - | ✔ | time_threshold |
Server unreachable | server_unreachable | - | ✔ | time_threshold |
Notice | notice | ✔ | ✔ |
Notice alarm is manadatory! Only one can exists and cannot be deleted. Setting
no_default_alarm
to true, will still create this alarm.
Dependency
This resource depends on CloudAMQP instance identifier, cloudamqp_instance.instance.id
.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using CloudAmqp = Pulumi.CloudAmqp;
return await Deployment.RunAsync(() =>
{
// New recipient
var recipient01 = new CloudAmqp.Notification("recipient01", new()
{
InstanceId = cloudamqp_instance.Instance.Id,
Type = "email",
Value = "alarm@example.com",
});
// New cpu alarm
var cpuAlarm = new CloudAmqp.Alarm("cpuAlarm", new()
{
InstanceId = cloudamqp_instance.Instance.Id,
Type = "cpu",
Enabled = true,
ReminderInterval = 600,
ValueThreshold = 95,
TimeThreshold = 600,
Recipients = new[]
{
recipient01.Id,
},
});
// New memory alarm
var memoryAlarm = new CloudAmqp.Alarm("memoryAlarm", new()
{
InstanceId = cloudamqp_instance.Instance.Id,
Type = "memory",
Enabled = true,
ReminderInterval = 600,
ValueThreshold = 95,
TimeThreshold = 600,
Recipients = new[]
{
recipient01.Id,
},
});
});
package main
import (
"github.com/pulumi/pulumi-cloudamqp/sdk/v3/go/cloudamqp"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
recipient01, err := cloudamqp.NewNotification(ctx, "recipient01", &cloudamqp.NotificationArgs{
InstanceId: pulumi.Any(cloudamqp_instance.Instance.Id),
Type: pulumi.String("email"),
Value: pulumi.String("alarm@example.com"),
})
if err != nil {
return err
}
_, err = cloudamqp.NewAlarm(ctx, "cpuAlarm", &cloudamqp.AlarmArgs{
InstanceId: pulumi.Any(cloudamqp_instance.Instance.Id),
Type: pulumi.String("cpu"),
Enabled: pulumi.Bool(true),
ReminderInterval: pulumi.Int(600),
ValueThreshold: pulumi.Int(95),
TimeThreshold: pulumi.Int(600),
Recipients: pulumi.IntArray{
recipient01.ID(),
},
})
if err != nil {
return err
}
_, err = cloudamqp.NewAlarm(ctx, "memoryAlarm", &cloudamqp.AlarmArgs{
InstanceId: pulumi.Any(cloudamqp_instance.Instance.Id),
Type: pulumi.String("memory"),
Enabled: pulumi.Bool(true),
ReminderInterval: pulumi.Int(600),
ValueThreshold: pulumi.Int(95),
TimeThreshold: pulumi.Int(600),
Recipients: pulumi.IntArray{
recipient01.ID(),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.cloudamqp.Notification;
import com.pulumi.cloudamqp.NotificationArgs;
import com.pulumi.cloudamqp.Alarm;
import com.pulumi.cloudamqp.AlarmArgs;
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 recipient01 = new Notification("recipient01", NotificationArgs.builder()
.instanceId(cloudamqp_instance.instance().id())
.type("email")
.value("alarm@example.com")
.build());
var cpuAlarm = new Alarm("cpuAlarm", AlarmArgs.builder()
.instanceId(cloudamqp_instance.instance().id())
.type("cpu")
.enabled(true)
.reminderInterval(600)
.valueThreshold(95)
.timeThreshold(600)
.recipients(recipient01.id())
.build());
var memoryAlarm = new Alarm("memoryAlarm", AlarmArgs.builder()
.instanceId(cloudamqp_instance.instance().id())
.type("memory")
.enabled(true)
.reminderInterval(600)
.valueThreshold(95)
.timeThreshold(600)
.recipients(recipient01.id())
.build());
}
}
import pulumi
import pulumi_cloudamqp as cloudamqp
# New recipient
recipient01 = cloudamqp.Notification("recipient01",
instance_id=cloudamqp_instance["instance"]["id"],
type="email",
value="alarm@example.com")
# New cpu alarm
cpu_alarm = cloudamqp.Alarm("cpuAlarm",
instance_id=cloudamqp_instance["instance"]["id"],
type="cpu",
enabled=True,
reminder_interval=600,
value_threshold=95,
time_threshold=600,
recipients=[recipient01.id])
# New memory alarm
memory_alarm = cloudamqp.Alarm("memoryAlarm",
instance_id=cloudamqp_instance["instance"]["id"],
type="memory",
enabled=True,
reminder_interval=600,
value_threshold=95,
time_threshold=600,
recipients=[recipient01.id])
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,
reminderInterval: 600,
valueThreshold: 95,
timeThreshold: 600,
recipients: [recipient01.id],
});
// New memory alarm
const memoryAlarm = new cloudamqp.Alarm("memoryAlarm", {
instanceId: cloudamqp_instance.instance.id,
type: "memory",
enabled: true,
reminderInterval: 600,
valueThreshold: 95,
timeThreshold: 600,
recipients: [recipient01.id],
});
resources:
# New recipient
recipient01:
type: cloudamqp:Notification
properties:
instanceId: ${cloudamqp_instance.instance.id}
type: email
value: alarm@example.com
# New cpu alarm
cpuAlarm:
type: cloudamqp:Alarm
properties:
instanceId: ${cloudamqp_instance.instance.id}
type: cpu
enabled: true
reminderInterval: 600
valueThreshold: 95
timeThreshold: 600
recipients:
- ${recipient01.id}
# New memory alarm
memoryAlarm:
type: cloudamqp:Alarm
properties:
instanceId: ${cloudamqp_instance.instance.id}
type: memory
enabled: true
reminderInterval: 600
valueThreshold: 95
timeThreshold: 600
recipients:
- ${recipient01.id}
Create Alarm Resource
new Alarm(name: string, args: AlarmArgs, opts?: CustomResourceOptions);
@overload
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,
reminder_interval: Optional[int] = None,
time_threshold: Optional[int] = None,
type: Optional[str] = None,
value_calculation: Optional[str] = None,
value_threshold: Optional[int] = None,
vhost_regex: Optional[str] = None)
@overload
def Alarm(resource_name: str,
args: AlarmArgs,
opts: Optional[ResourceOptions] = None)
func NewAlarm(ctx *Context, name string, args AlarmArgs, opts ...ResourceOption) (*Alarm, error)
public Alarm(string name, AlarmArgs args, CustomResourceOptions? opts = null)
type: cloudamqp:Alarm
properties: # The arguments to resource properties.
options: # 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.
- resource_name str
- The unique name of the resource.
- args AlarmArgs
- 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 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.
- name String
- The unique name of the resource.
- args AlarmArgs
- The arguments to resource properties.
- options 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 Architecture and Concepts docs.
Inputs
The Alarm resource accepts the following input properties:
- Enabled bool
Enable or disable the alarm to trigger.
- Instance
Id 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.
- Message
Type string Message type
(total, unacked, ready)
used by queue alarm type.Specific argument for
disk
alarm- Queue
Regex string Regex for which queue to check.
- Reminder
Interval int The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- Time
Threshold int The time interval (in seconds) the
value_threshold
should be active before triggering an alarm.- Value
Calculation string Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- Value
Threshold int The value to trigger the alarm for.
- Vhost
Regex string Regex for which vhost to check
- Enabled bool
Enable or disable the alarm to trigger.
- Instance
Id 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.
- Message
Type string Message type
(total, unacked, ready)
used by queue alarm type.Specific argument for
disk
alarm- Queue
Regex string Regex for which queue to check.
- Reminder
Interval int The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- Time
Threshold int The time interval (in seconds) the
value_threshold
should be active before triggering an alarm.- Value
Calculation string Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- Value
Threshold int The value to trigger the alarm for.
- Vhost
Regex string Regex for which vhost to check
- enabled Boolean
Enable or disable the alarm to trigger.
- instance
Id Integer The CloudAMQP instance ID.
- recipients List<Integer>
Identifier for recipient to be notified. Leave empty to notify all recipients.
- type String
The alarm type, see valid options below.
- message
Type String Message type
(total, unacked, ready)
used by queue alarm type.Specific argument for
disk
alarm- queue
Regex String Regex for which queue to check.
- reminder
Interval Integer The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- time
Threshold Integer The time interval (in seconds) the
value_threshold
should be active before triggering an alarm.- value
Calculation String Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- value
Threshold Integer The value to trigger the alarm for.
- vhost
Regex String Regex for which vhost to check
- enabled boolean
Enable or disable the alarm to trigger.
- instance
Id 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.
- message
Type string Message type
(total, unacked, ready)
used by queue alarm type.Specific argument for
disk
alarm- queue
Regex string Regex for which queue to check.
- reminder
Interval number The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- time
Threshold number The time interval (in seconds) the
value_threshold
should be active before triggering an alarm.- value
Calculation string Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- value
Threshold number The value to trigger the alarm for.
- vhost
Regex 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.Specific argument for
disk
alarm- queue_
regex str Regex for which queue to check.
- reminder_
interval int The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- time_
threshold int The time interval (in seconds) the
value_threshold
should be active before triggering an alarm.- value_
calculation str Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- value_
threshold int The value to trigger the alarm for.
- vhost_
regex str Regex for which vhost to check
- enabled Boolean
Enable or disable the alarm to trigger.
- instance
Id Number The CloudAMQP instance ID.
- recipients List<Number>
Identifier for recipient to be notified. Leave empty to notify all recipients.
- type String
The alarm type, see valid options below.
- message
Type String Message type
(total, unacked, ready)
used by queue alarm type.Specific argument for
disk
alarm- queue
Regex String Regex for which queue to check.
- reminder
Interval Number The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- time
Threshold Number The time interval (in seconds) the
value_threshold
should be active before triggering an alarm.- value
Calculation String Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- value
Threshold Number The value to trigger the alarm for.
- vhost
Regex String 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 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 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,
reminder_interval: Optional[int] = None,
time_threshold: Optional[int] = None,
type: Optional[str] = None,
value_calculation: 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)
public static Alarm get(String name, Output<String> id, AlarmState 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.
- Enabled bool
Enable or disable the alarm to trigger.
- Instance
Id int The CloudAMQP instance ID.
- Message
Type string Message type
(total, unacked, ready)
used by queue alarm type.Specific argument for
disk
alarm- Queue
Regex string Regex for which queue to check.
- Recipients List<int>
Identifier for recipient to be notified. Leave empty to notify all recipients.
- Reminder
Interval int The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- Time
Threshold 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.
- Value
Calculation string Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- Value
Threshold int The value to trigger the alarm for.
- Vhost
Regex 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 string Message type
(total, unacked, ready)
used by queue alarm type.Specific argument for
disk
alarm- Queue
Regex string Regex for which queue to check.
- Recipients []int
Identifier for recipient to be notified. Leave empty to notify all recipients.
- Reminder
Interval int The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- Time
Threshold 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.
- Value
Calculation string Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- Value
Threshold int The value to trigger the alarm for.
- Vhost
Regex string Regex for which vhost to check
- enabled Boolean
Enable or disable the alarm to trigger.
- instance
Id Integer The CloudAMQP instance ID.
- message
Type String Message type
(total, unacked, ready)
used by queue alarm type.Specific argument for
disk
alarm- queue
Regex String Regex for which queue to check.
- recipients List<Integer>
Identifier for recipient to be notified. Leave empty to notify all recipients.
- reminder
Interval Integer The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- time
Threshold Integer The time interval (in seconds) the
value_threshold
should be active before triggering an alarm.- type String
The alarm type, see valid options below.
- value
Calculation String Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- value
Threshold Integer The value to trigger the alarm for.
- vhost
Regex String Regex for which vhost to check
- enabled boolean
Enable or disable the alarm to trigger.
- instance
Id number The CloudAMQP instance ID.
- message
Type string Message type
(total, unacked, ready)
used by queue alarm type.Specific argument for
disk
alarm- queue
Regex string Regex for which queue to check.
- recipients number[]
Identifier for recipient to be notified. Leave empty to notify all recipients.
- reminder
Interval number The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- time
Threshold 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.
- value
Calculation string Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- value
Threshold number The value to trigger the alarm for.
- vhost
Regex 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.Specific argument for
disk
alarm- queue_
regex str Regex for which queue to check.
- recipients Sequence[int]
Identifier for recipient to be notified. Leave empty to notify all recipients.
- reminder_
interval int The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- 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_
calculation str Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- value_
threshold int The value to trigger the alarm for.
- vhost_
regex str Regex for which vhost to check
- enabled Boolean
Enable or disable the alarm to trigger.
- instance
Id Number The CloudAMQP instance ID.
- message
Type String Message type
(total, unacked, ready)
used by queue alarm type.Specific argument for
disk
alarm- queue
Regex String Regex for which queue to check.
- recipients List<Number>
Identifier for recipient to be notified. Leave empty to notify all recipients.
- reminder
Interval Number The reminder interval (in seconds) to resend the alarm if not resolved. Set to 0 for no reminders. The Default is 0.
- time
Threshold 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.
- value
Calculation String Disk value threshold calculation,
fixed, percentage
of disk space remaining.Based on alarm type, different arguments are flagged as required or optional.
- value
Threshold Number The value to trigger the alarm for.
- vhost
Regex String 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 <id>,<instance_id>`
Package Details
- Repository
- CloudAMQP pulumi/pulumi-cloudamqp
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
cloudamqp
Terraform Provider.