Skip to content

Commit 3a72710

Browse files
Publisher Map feature Monitoring added to Email
1 parent 95bc57a commit 3a72710

11 files changed

+96
-52
lines changed

examples/monitoring/alarms/alarms.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ variable "alarm_is_enabled" {
4949
default = false
5050
}
5151

52+
variable "alarm_message_format" {
53+
default = "ONS_OPTIMIZED"
54+
}
55+
5256
variable "alarm_metric_compartment_id_in_subtree" {
5357
default = false
5458
}
@@ -157,6 +161,7 @@ resource "oci_monitoring_alarm" "test_alarm" {
157161

158162
#Optional
159163
body = var.alarm_body
164+
message_format = var.alarm_message_format
160165
metric_compartment_id_in_subtree = var.alarm_metric_compartment_id_in_subtree
161166
pending_duration = var.alarm_pending_duration
162167
repeat_notification_duration = var.alarm_repeat_notification_duration

oci/monitoring_alarm_data_source.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ func (s *MonitoringAlarmDataSourceCrud) SetData() error {
9191
s.D.Set("is_enabled", *s.Res.IsEnabled)
9292
}
9393

94+
s.D.Set("message_format", s.Res.MessageFormat)
95+
9496
if s.Res.MetricCompartmentId != nil {
9597
s.D.Set("metric_compartment_id", *s.Res.MetricCompartmentId)
9698
}

oci/monitoring_alarm_resource.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ func MonitoringAlarmResource() *schema.Resource {
8585
Computed: true,
8686
Elem: schema.TypeString,
8787
},
88+
"message_format": {
89+
Type: schema.TypeString,
90+
Optional: true,
91+
Computed: true,
92+
},
8893
"metric_compartment_id_in_subtree": {
8994
Type: schema.TypeBool,
9095
Optional: true,
@@ -273,6 +278,10 @@ func (s *MonitoringAlarmResourceCrud) Create() error {
273278
request.IsEnabled = &tmp
274279
}
275280

281+
if messageFormat, ok := s.D.GetOkExists("message_format"); ok {
282+
request.MessageFormat = oci_monitoring.CreateAlarmDetailsMessageFormatEnum(messageFormat.(string))
283+
}
284+
276285
if metricCompartmentId, ok := s.D.GetOkExists("metric_compartment_id"); ok {
277286
tmp := metricCompartmentId.(string)
278287
request.MetricCompartmentId = &tmp
@@ -416,6 +425,10 @@ func (s *MonitoringAlarmResourceCrud) Update() error {
416425
request.IsEnabled = &tmp
417426
}
418427

428+
if messageFormat, ok := s.D.GetOkExists("message_format"); ok {
429+
request.MessageFormat = oci_monitoring.UpdateAlarmDetailsMessageFormatEnum(messageFormat.(string))
430+
}
431+
419432
if metricCompartmentId, ok := s.D.GetOkExists("metric_compartment_id"); ok {
420433
tmp := metricCompartmentId.(string)
421434
request.MetricCompartmentId = &tmp
@@ -519,6 +532,8 @@ func (s *MonitoringAlarmResourceCrud) SetData() error {
519532
s.D.Set("is_enabled", *s.Res.IsEnabled)
520533
}
521534

535+
s.D.Set("message_format", s.Res.MessageFormat)
536+
522537
if s.Res.MetricCompartmentId != nil {
523538
s.D.Set("metric_compartment_id", *s.Res.MetricCompartmentId)
524539
}

oci/monitoring_alarm_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ var (
5353
"body": Representation{repType: Optional, create: `CPU utilization has reached high values.`, update: `body2`},
5454
"defined_tags": Representation{repType: Optional, create: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "value")}`, update: `${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "updatedValue")}`},
5555
"freeform_tags": Representation{repType: Optional, create: map[string]string{"Department": "Finance"}, update: map[string]string{"Department": "Accounting"}},
56+
"message_format": Representation{repType: Optional, create: `ONS_OPTIMIZED`, update: `PRETTY_JSON`},
5657
"metric_compartment_id_in_subtree": Representation{repType: Optional, create: `false`, update: `true`},
5758
"pending_duration": Representation{repType: Optional, create: `PT5M`, update: `PT10M`},
5859
"repeat_notification_duration": Representation{repType: Optional, create: `PT2H`, update: `PT10M`},
@@ -132,6 +133,7 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
132133
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
133134
resource.TestCheckResourceAttrSet(resourceName, "id"),
134135
resource.TestCheckResourceAttr(resourceName, "is_enabled", "false"),
136+
resource.TestCheckResourceAttr(resourceName, "message_format", "ONS_OPTIMIZED"),
135137
resource.TestCheckResourceAttrSet(resourceName, "metric_compartment_id"),
136138
resource.TestCheckResourceAttr(resourceName, "metric_compartment_id_in_subtree", "false"),
137139
resource.TestCheckResourceAttr(resourceName, "namespace", "oci_computeagent"),
@@ -177,6 +179,7 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
177179
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
178180
resource.TestCheckResourceAttrSet(resourceName, "id"),
179181
resource.TestCheckResourceAttr(resourceName, "is_enabled", "false"),
182+
resource.TestCheckResourceAttr(resourceName, "message_format", "ONS_OPTIMIZED"),
180183
resource.TestCheckResourceAttrSet(resourceName, "metric_compartment_id"),
181184
resource.TestCheckResourceAttr(resourceName, "metric_compartment_id_in_subtree", "false"),
182185
resource.TestCheckResourceAttr(resourceName, "namespace", "oci_computeagent"),
@@ -217,6 +220,7 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
217220
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
218221
resource.TestCheckResourceAttrSet(resourceName, "id"),
219222
resource.TestCheckResourceAttr(resourceName, "is_enabled", "true"),
223+
resource.TestCheckResourceAttr(resourceName, "message_format", "PRETTY_JSON"),
220224
resource.TestCheckResourceAttrSet(resourceName, "metric_compartment_id"),
221225
resource.TestCheckResourceAttr(resourceName, "metric_compartment_id_in_subtree", "true"),
222226
resource.TestCheckResourceAttr(resourceName, "namespace", "oci_lbaas"),
@@ -291,6 +295,7 @@ func TestMonitoringAlarmResource_basic(t *testing.T) {
291295
resource.TestCheckResourceAttr(singularDatasourceName, "freeform_tags.%", "1"),
292296
resource.TestCheckResourceAttrSet(singularDatasourceName, "id"),
293297
resource.TestCheckResourceAttr(singularDatasourceName, "is_enabled", "true"),
298+
resource.TestCheckResourceAttr(singularDatasourceName, "message_format", "PRETTY_JSON"),
294299
resource.TestCheckResourceAttr(singularDatasourceName, "metric_compartment_id_in_subtree", "true"),
295300
resource.TestCheckResourceAttr(singularDatasourceName, "namespace", "oci_lbaas"),
296301
resource.TestCheckResourceAttr(singularDatasourceName, "pending_duration", "PT10M"),

website/docs/d/monitoring_alarm.html.markdown

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ This data source provides details about a specific Alarm resource in Oracle Clou
1313
Gets the specified alarm.
1414
For important limits information, see [Limits on Monitoring](https://docs.cloud.oracle.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#Limits).
1515

16-
This call is subject to a Monitoring limit that applies to the total number of requests across all alarm operations.
17-
Monitoring might throttle this call to reject an otherwise valid request when the total rate of alarm operations exceeds 10 requests,
16+
This call is subject to a Monitoring limit that applies to the total number of requests across all alarm operations.
17+
Monitoring might throttle this call to reject an otherwise valid request when the total rate of alarm operations exceeds 10 requests,
1818
or transactions, per second (TPS) for a given tenancy.
1919

2020

@@ -38,31 +38,35 @@ The following arguments are supported:
3838

3939
The following attributes are exported:
4040

41-
* `body` - The human-readable content of the notification delivered. Oracle recommends providing guidance to operators for resolving the alarm condition. Consider adding links to standard runbook practices. Avoid entering confidential information. Example: `High CPU usage alert. Follow runbook instructions for resolution.`
41+
* `body` - The human-readable content of the notification delivered. Oracle recommends providing guidance to operators for resolving the alarm condition. Consider adding links to standard runbook practices. Example: `High CPU usage alert. Follow runbook instructions for resolution.`
4242
* `compartment_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the alarm.
4343
* `defined_tags` - Usage of predefined tag keys. These predefined keys are scoped to namespaces. Example: `{"Operations.CostCenter": "42"}`
44-
* `destinations` - A list of destinations to which the notifications for this alarm will be delivered. Each destination is represented by an [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) related to the supported destination service. For example, a destination using the Notifications service is represented by a topic OCID. Supported destination services: Notifications Service. Limit: One destination per supported destination service.
45-
* `display_name` - A user-friendly name for the alarm. It does not have to be unique, and it's changeable. Avoid entering confidential information.
44+
* `destinations` - A list of destinations to which the notifications for this alarm will be delivered. Each destination is represented by an [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) related to the supported destination service. For example, a destination using the Notifications service is represented by a topic OCID. Supported destination services: Notifications Service. Limit: One destination per supported destination service.
45+
* `display_name` - A user-friendly name for the alarm. It does not have to be unique, and it's changeable.
4646

4747
This name is sent as the title for notifications related to this alarm.
4848

4949
Example: `High CPU Utilization`
5050
* `freeform_tags` - Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: `{"Department": "Finance"}`
5151
* `id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the alarm.
5252
* `is_enabled` - Whether the alarm is enabled. Example: `true`
53+
* `message_format` - The format to use for notification messages sent from this alarm. The formats are:
54+
* `RAW` - Raw JSON blob. Default value.
55+
* `PRETTY_JSON`: JSON with new lines and indents.
56+
* `ONS_OPTIMIZED`: Simplified, user-friendly layout. Applies only to messages sent through the Notifications service to the following subscription types: Email.
5357
* `metric_compartment_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the compartment containing the metric being evaluated by the alarm.
5458
* `metric_compartment_id_in_subtree` - When true, the alarm evaluates metrics from all compartments and subcompartments. The parameter can only be set to true when metricCompartmentId is the tenancy OCID (the tenancy is the root compartment). A true value requires the user to have tenancy-level permissions. If this requirement is not met, then the call is rejected. When false, the alarm evaluates metrics from only the compartment specified in metricCompartmentId. Default is false. Example: `true`
5559
* `namespace` - The source service or application emitting the metric that is evaluated by the alarm. Example: `oci_computeagent`
56-
* `pending_duration` - The period of time that the condition defined in the alarm must persist before the alarm state changes from "OK" to "FIRING". For example, a value of 5 minutes means that the alarm must persist in breaching the condition for five minutes before the alarm updates its state to "FIRING".
60+
* `pending_duration` - The period of time that the condition defined in the alarm must persist before the alarm state changes from "OK" to "FIRING". For example, a value of 5 minutes means that the alarm must persist in breaching the condition for five minutes before the alarm updates its state to "FIRING".
5761

5862
The duration is specified as a string in ISO 8601 format (`PT10M` for ten minutes or `PT1H` for one hour). Minimum: PT1M. Maximum: PT1H. Default: PT1M.
5963

60-
Under the default value of PT1M, the first evaluation that breaches the alarm updates the state to "FIRING".
64+
Under the default value of PT1M, the first evaluation that breaches the alarm updates the state to "FIRING".
6165

62-
The alarm updates its status to "OK" when the breaching condition has been clear for the most recent minute.
66+
The alarm updates its status to "OK" when the breaching condition has been clear for the most recent minute.
6367

6468
Example: `PT5M`
65-
* `query` - The Monitoring Query Language (MQL) expression to evaluate for the alarm. The Alarms feature of the Monitoring service interprets results for each returned time series as Boolean values, where zero represents false and a non-zero value represents true. A true value means that the trigger rule condition has been met. The query must specify a metric, statistic, interval, and trigger rule (threshold or absence). Supported values for interval: `1m`-`60m` (also `1h`). You can optionally specify dimensions and grouping functions. Supported grouping functions: `grouping()`, `groupBy()`. For details about Monitoring Query Language (MQL), see [Monitoring Query Language (MQL) Reference](https://docs.cloud.oracle.com/iaas/Content/Monitoring/Reference/mql.htm). For available dimensions, review the metric definition for the supported service. See [Supported Services](https://docs.cloud.oracle.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#SupportedServices).
69+
* `query` - The Monitoring Query Language (MQL) expression to evaluate for the alarm. The Alarms feature of the Monitoring service interprets results for each returned time series as Boolean values, where zero represents false and a non-zero value represents true. A true value means that the trigger rule condition has been met. The query must specify a metric, statistic, interval, and trigger rule (threshold or absence). Supported values for interval depend on the specified time range. More interval values are supported for smaller time ranges. You can optionally specify dimensions and grouping functions. Supported grouping functions: `grouping()`, `groupBy()`. For details about Monitoring Query Language (MQL), see [Monitoring Query Language (MQL) Reference](https://docs.cloud.oracle.com/iaas/Content/Monitoring/Reference/mql.htm). For available dimensions, review the metric definition for the supported service. See [Supported Services](https://docs.cloud.oracle.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#SupportedServices).
6670

6771
Example of threshold alarm:
6872

@@ -85,7 +89,7 @@ The following attributes are exported:
8589

8690
Example: `PT2H`
8791
* `resolution` - The time between calculated aggregation windows for the alarm. Supported value: `1m`
88-
* `resource_group` - Resource group specified as a filter for metric data retrieved by the alarm. A resource group is a custom string that can be used as a filter. Only one resource group can be applied per metric. A valid resourceGroup value starts with an alphabetical character and includes only alphanumeric characters, periods (.), underscores (_), hyphens (-), and dollar signs ($). Avoid entering confidential information. Example: `frontend-fleet`
92+
* `resource_group` - Resource group to match for metric data retrieved by the alarm. A resource group is a custom string that you can match when retrieving custom metrics. Only one resource group can be applied per metric. A valid resourceGroup value starts with an alphabetical character and includes only alphanumeric characters, periods (.), underscores (_), hyphens (-), and dollar signs ($). Example: `frontend-fleet`
8993
* `severity` - The perceived type of response required when the alarm is in the "FIRING" state. Example: `CRITICAL`
9094
* `state` - The current lifecycle state of the alarm. Example: `DELETED`
9195
* `suppression` - The configuration details for suppressing an alarm.

website/docs/d/monitoring_alarm_history_collection.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ This data source provides details about a specific Alarm History Collection reso
1313
Get the history of the specified alarm.
1414
For important limits information, see [Limits on Monitoring](https://docs.cloud.oracle.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#Limits).
1515

16-
This call is subject to a Monitoring limit that applies to the total number of requests across all alarm operations.
17-
Monitoring might throttle this call to reject an otherwise valid request when the total rate of alarm operations exceeds 10 requests,
16+
This call is subject to a Monitoring limit that applies to the total number of requests across all alarm operations.
17+
Monitoring might throttle this call to reject an otherwise valid request when the total rate of alarm operations exceeds 10 requests,
1818
or transactions, per second (TPS) for a given tenancy.
1919

2020

@@ -48,7 +48,7 @@ The following attributes are exported:
4848

4949
* `alarm_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the alarm for which to retrieve history.
5050
* `entries` - The set of history entries retrieved for the alarm.
51-
* `summary` - Description for this alarm history entry. Avoid entering confidential information.
51+
* `summary` - Description for this alarm history entry.
5252

5353
Example 1 - alarm state history entry: `The alarm state is FIRING`
5454

website/docs/d/monitoring_alarm_statuses.html.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ This data source provides the list of Alarm Statuses in Oracle Cloud Infrastruct
1313
List the status of each alarm in the specified compartment.
1414
For important limits information, see [Limits on Monitoring](https://docs.cloud.oracle.com/iaas/Content/Monitoring/Concepts/monitoringoverview.htm#Limits).
1515

16-
This call is subject to a Monitoring limit that applies to the total number of requests across all alarm operations.
17-
Monitoring might throttle this call to reject an otherwise valid request when the total rate of alarm operations exceeds 10 requests,
16+
This call is subject to a Monitoring limit that applies to the total number of requests across all alarm operations.
17+
Monitoring might throttle this call to reject an otherwise valid request when the total rate of alarm operations exceeds 10 requests,
1818
or transactions, per second (TPS) for a given tenancy.
1919

2020

@@ -62,5 +62,5 @@ The following attributes are exported:
6262
Example: `Planned outage due to change IT-1234.`
6363
* `time_suppress_from` - The start date and time for the suppression to take place, inclusive. Format defined by RFC3339. Example: `2019-02-01T01:02:29.600Z`
6464
* `time_suppress_until` - The end date and time for the suppression to take place, inclusive. Format defined by RFC3339. Example: `2019-02-01T02:02:29.600Z`
65-
* `timestamp_triggered` - Timestamp for the transition of the alarm state. For example, the time when the alarm transitioned from OK to Firing. Example: `2019-02-01T01:02:29.600Z`
65+
* `timestamp_triggered` - Timestamp for the transition of the alarm state. For example, the time when the alarm transitioned from OK to Firing. Note: A three-minute lag for this value accounts for any late-arriving metrics. Example: `2019-02-01T01:02:29.600Z`
6666

0 commit comments

Comments
 (0)