"update"
********

* Description

* Usage

* Required Parameters

* Optional Parameters

* Global Parameters

* Example using required parameter


Description
===========

Updates the specified alarm.


Usage
=====

   oci monitoring alarm update [OPTIONS]


Required Parameters
===================

--alarm-id [text]

The OCID of an alarm.


Optional Parameters
===================

--alarm-summary [text]

Customizable alarm summary (*alarmSummary* alarm message parameter).
Optionally include dynamic variables. The alarm summary appears within
the body of the alarm message and in responses to ListAlarmStatus
GetAlarmHistory and RetrieveDimensionStates.

--body [text]

The human-readable content of the delivered alarm notification.
Optionally include dynamic variables. 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.

--compartment-id, -c [text]

The OCID of the compartment containing the alarm.

--defined-tags [complex type]

Usage of predefined tag keys. These predefined keys are scoped to
namespaces. Example: *{“Operations”: {“CostCenter”: “42”}}* This is a
complex type whose value must be valid JSON. The value can be provided
as a string on the command line or passed in as a file using the
file://path/to/file syntax.

The "--generate-param-json-input" option can be used to generate an
example of the JSON which must be provided. We recommend storing this
example in a file, modifying it as needed and then passing it back in
via the file:// syntax.

--destinations [complex type]

A list of destinations for alarm notifications. Each destination is
represented by the OCID of a related resource, such as a topic.
Supported destination services: Notifications, Streaming. Limit: One
destination per supported destination service. This is a complex type
whose value must be valid JSON. The value can be provided as a string
on the command line or passed in as a file using the
file://path/to/file syntax.

The "--generate-param-json-input" option can be used to generate an
example of the JSON which must be provided. We recommend storing this
example in a file, modifying it as needed and then passing it back in
via the file:// syntax.

--display-name [text]

A user-friendly name for the alarm. It does not have to be unique, and
it’s changeable. Avoid entering confidential information.

This value determines the title of each alarm notification.

Example:

   High CPU Utilization

--evaluation-slack-duration [text]

Customizable slack period to wait for metric ingestion before
evaluating the alarm. Specify a string in ISO 8601 format (*PT10M* for
ten minutes or *PT1H* for one hour). Minimum: PT3M. Maximum: PT2H.
Default: PT3M. For more information about the slack period, see About
the Internal Reset Period.

--force

Perform update without prompting for confirmation.

--freeform-tags [complex type]

Simple key-value pair that is applied without any predefined name,
type or scope. Exists for cross-compatibility only. Example:
*{“Department”: “Finance”}* This is a complex type whose value must be
valid JSON. The value can be provided as a string on the command line
or passed in as a file using the file://path/to/file syntax.

The "--generate-param-json-input" option can be used to generate an
example of the JSON which must be provided. We recommend storing this
example in a file, modifying it as needed and then passing it back in
via the file:// syntax.

--from-json [text]

Provide input to this command as a JSON document from a file using the
file://path-to/file syntax.

The "--generate-full-command-json-input" option can be used to
generate a sample json file to be used with this command option. The
key names are pre-populated and match the command option names
(converted to camelCase format, e.g. compartment-id –> compartmentId),
while the values of the keys need to be populated by the user before
using the sample file as an input to this command. For any command
option that accepts multiple values, the value of the key can be a
JSON array.

Options can still be provided on the command line. If an option exists
in both the JSON document and the command line then the command line
specified value will be used.

For examples on usage of this option, please see our “using CLI with
advanced JSON options” link: https://docs.cloud.oracle.com/iaas/Conte
nt/API/SDKDocs/cliusing.htm#AdvancedJSONOptions

--if-match [text]

For optimistic concurrency control. In the PUT or DELETE call for a
resource, set the *if-match* parameter to the value of the etag from a
previous GET or POST response for that resource.  The resource will be
updated or deleted only if the etag you provide matches the resource’s
current etag value.

--is-enabled [boolean]

Whether the alarm is enabled.

Example:

   true

--is-notifications-per-metric-dimension-enabled [boolean]

When set to *true*, splits alarm notifications per metric stream. When
set to *false*, groups alarm notifications across metric streams.

--max-wait-seconds [integer]

The maximum time to wait for the resource to reach the lifecycle state
defined by "--wait-for-state". Defaults to 1200 seconds.

--message-format [text]

The format to use for alarm notifications. The formats are: * *RAW* -
Raw JSON blob. Default value. When the *destinations* attribute
specifies *Streaming*, all alarm notifications use this format. *
*PRETTY_JSON*: JSON with new lines and indents. Available when the
*destinations* attribute specifies *Notifications* only. *
*ONS_OPTIMIZED*: Simplified, user-friendly layout. Available when the
*destinations* attribute specifies *Notifications* only. Applies to
Email subscription types only.

Accepted values are:

   ONS_OPTIMIZED, PRETTY_JSON, RAW

--metric-compartment-id [text]

The OCID of the compartment containing the metric being evaluated by
the alarm.

--metric-compartment-id-in-subtree [boolean]

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

--namespace [text]

The source service or application emitting the metric that is
evaluated by the alarm.

Example:

   oci_computeagent

--notification-title [text]

Customizable notification title (*title* alarm message parameter).
Optionally include dynamic variables. The notification title appears
as the subject line in a formatted email message and as the title in a
Slack message.

--notification-version [text]

The version of the alarm notification to be delivered. Allowed value:
*1.X* The value must start with a number (up to four digits), followed
by a period and an uppercase X.

--overrides [complex type]

A set of overrides that control evaluations of the alarm.

Each override can specify values for query, severity, body, and
pending duration. When an alarm contains overrides, the Monitoring
service evaluates each override in order, beginning with the first
override in the array (index position *0*), and then evaluates the
alarm’s base values (*ruleName* value of *BASE*).

This option is a JSON list with items of type AlarmOverride.  For
documentation on AlarmOverride please see our API reference: https://
docs.cloud.oracle.com/api/#/en/monitoring/20180401/datatypes/AlarmOve
rride. This is a complex type whose value must be valid JSON. The
value can be provided as a string on the command line or passed in as
a file using the file://path/to/file syntax.

The "--generate-param-json-input" option can be used to generate an
example of the JSON which must be provided. We recommend storing this
example in a file, modifying it as needed and then passing it back in
via the file:// syntax.

--pending-duration [text]

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”.

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.

Under the default value of PT1M, the first evaluation that breaches
the alarm updates the state to “FIRING”.

The alarm updates its status to “OK” when the breaching condition has
been clear for the most recent minute.

Example:

   PT5M

--query-text [text]

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. For available dimensions, review the metric definition for
the supported service. See Supported Services.

Example of threshold alarm:

      CpuUtilization[1m]{availabilityDomain=”cumS:PHX-
      AD-1”}.groupBy(availabilityDomain).percentile(0.9) > 85

Example of absence alarm:

      CpuUtilization[1m]{availabilityDomain=”cumS:PHX-AD-1”}.absent()

--repeat-notification-duration [text]

The frequency for re-submitting alarm notifications, if the alarm
keeps firing without interruption. Format defined by ISO 8601. For
example, *PT4H* indicates four hours. Minimum: PT1M. Maximum: P30D.

Default value: null (notifications are not re-submitted).

Example:

   PT2H

--resolution [text]

The time between calculated aggregation windows for the alarm.
Supported value: *1m*

--resource-group [text]

Resource group that you want to match. A null value returns only
metric data that has no resource groups. The alarm retrieves metric
data associated with the specified resource group only. 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

--rule-name [text]

Identifier of the alarm’s base values for alarm evaluation, for use
when the alarm contains overrides. Default value is *BASE*. For
information about alarm overrides, see AlarmOverride.

--severity [text]

The perceived severity of the alarm with regard to the affected
system.

Example:

   CRITICAL

--suppression [complex type]

The configuration details for suppressing an alarm. This is a complex
type whose value must be valid JSON. The value can be provided as a
string on the command line or passed in as a file using the
file://path/to/file syntax.

The "--generate-param-json-input" option can be used to generate an
example of the JSON which must be provided. We recommend storing this
example in a file, modifying it as needed and then passing it back in
via the file:// syntax.

--wait-for-state [text]

This operation creates, modifies or deletes a resource that has a
defined lifecycle state. Specify this option to perform the action and
then wait until the resource reaches a given lifecycle state. Multiple
states can be specified, returning on the first state. For example, "
--wait-for-state" SUCCEEDED "--wait-for-state" FAILED would return on
whichever lifecycle state is reached first. If timeout is reached, a
return code of 2 is returned. For any other error, a return code of 1
is returned.

Accepted values are:

   ACTIVE, DELETED, DELETING

--wait-interval-seconds [integer]

Check every "--wait-interval-seconds" to see whether the resource has
reached the lifecycle state defined by "--wait-for-state". Defaults to
30 seconds.


Global Parameters
=================

Use "oci --help" for help on global parameters.

"--auth-purpose", "--auth", "--cert-bundle", "--cli-auto-prompt", "--
cli-rc-file", "--config-file", "--connection-timeout", "--debug", "--
defaults-file", "--endpoint", "--generate-full-command-json-input", "
--generate-param-json-input", "--help", "--latest-version", "--max-
retries", "--no-retry", "--opc-client-request-id", "--opc-request-id",
"--output", "--profile", "--proxy", "--query", "--raw-output", "--
read-timeout", "--realm-specific-endpoint", "--region", "--release-
info", "--request-id", "--version", "-?", "-d", "-h", "-i", "-v"


Example using required parameter
================================

Copy and paste the following example into a JSON file, replacing the
example parameters with your own.

       oci monitoring alarm create --generate-param-json-input destinations > destinations.json

Copy the following CLI commands into a file named example.sh. Run the
command by typing “bash example.sh” and replacing the example
parameters with your own.

Please note this sample will only work in the POSIX-compliant bash-
like shell. You need to set up the OCI configuration and appropriate
security policies before trying the examples.

       export compartment_id=<substitute-value-of-compartment_id> # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/monitoring/alarm/create.html#cmdoption-compartment-id
       export display_name=<substitute-value-of-display_name> # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/monitoring/alarm/create.html#cmdoption-display-name
       export is_enabled=<substitute-value-of-is_enabled> # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/monitoring/alarm/create.html#cmdoption-is-enabled
       export metric_compartment_id=<substitute-value-of-metric_compartment_id> # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/monitoring/alarm/create.html#cmdoption-metric-compartment-id
       export namespace=<substitute-value-of-namespace> # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/monitoring/alarm/create.html#cmdoption-namespace
       export query_text=<substitute-value-of-query_text> # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/monitoring/alarm/create.html#cmdoption-query-text
       export severity=<substitute-value-of-severity> # https://docs.cloud.oracle.com/en-us/iaas/tools/oci-cli/latest/oci_cli_docs/cmdref/monitoring/alarm/create.html#cmdoption-severity

       alarm_id=$(oci monitoring alarm create --compartment-id $compartment_id --destinations file://destinations.json --display-name $display_name --is-enabled $is_enabled --metric-compartment-id $metric_compartment_id --namespace $namespace --query-text $query_text --severity $severity --query data.id --raw-output)

       oci monitoring alarm update --alarm-id $alarm_id
