set_alarm_state ( $alarm_name, $state_value, $state_reason, $opt )

Temporarily sets the state of an alarm. When the updated StateValue differs from the previous value, the action configured for the appropriate state is invoked. This is not a permanent change. The next periodic alarm check (in about a minute) will set the alarm to its actual state.

Access

public

Parameters

Parameter

Type

Required

Description

$alarm_name

string

Required

The descriptive name for the alarm. This name must be unique within the user’s AWS account. The maximum length is 255 characters.

$state_value

string

Required

The value of the state. [Allowed values: OK, ALARM, INSUFFICIENT_DATA]

$state_reason

string

Required

The reason that this alarm is set to this specific state (in human-readable text format)

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • StateReasonData - string - Optional - The reason that this alarm is set to this specific state (in machine-readable JSON format)
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Manually set the state of the alarm.

$cw = new AmazonCloudWatch();

$response = $cw->set_alarm_state('my-alarm', 'OK', 'Reason for manually modifying the state.');

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/cloudwatch.class.php | Toggle source view (9 lines) | View on GitHub

public function set_alarm_state($alarm_name, $state_value, $state_reason, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['AlarmName'] = $alarm_name;
    $opt['StateValue'] = $state_value;
    $opt['StateReason'] = $state_reason;
    
    return $this->authenticate('SetAlarmState', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback