"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
===================

--body [text]

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.

--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 to which the notifications for this alarm will
be delivered. Each destination is represented by an OCID 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. 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 name is sent as the title for notifications related to this
alarm.

Example:

   High CPU Utilization

--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 notifications per metric stream. When set
to *false*, groups notifications across metric streams. Example:
*true*

--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 notification messages sent from this alarm. The
formats are: * *RAW* - Raw JSON blob. Default value. * *PRETTY_JSON*:
JSON with new lines and indents. * *ONS_OPTIMIZED*: Simplified, user-
friendly layout. Applies only to messages sent through the
Notifications service to the following subscription types: Email.

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

--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 at which notifications are re-submitted, 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

--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", "--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
