Class: Google::Monitoring::V3::AlertPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb

Overview

A description of the conditions under which some aspect of your system is considered to be "unhealthy" and the ways to notify people or services about this state. For an overview of alert policies, see Introduction to Alerting.

Defined Under Namespace

Modules: ConditionCombinerType Classes: Condition, Documentation

Instance Attribute Summary collapse

Instance Attribute Details

#combinerGoogle::Monitoring::V3::AlertPolicy::ConditionCombinerType

Returns How to combine the results of multiple conditions to determine if an incident should be opened.

Returns:



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb', line 93

class AlertPolicy
  # A content string and a MIME type that describes the content string's
  # format.
  # @!attribute [rw] content
  #   @return [String]
  #     The text of the documentation, interpreted according to +mime_type+.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller.
  # @!attribute [rw] mime_type
  #   @return [String]
  #     The format of the +content+ field. Presently, only the value
  #     +"text/markdown"+ is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  class Documentation; end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its syntax is:
  #
  #         projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     +[CONDITION_ID]+ is assigned by Stackdriver Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::CreateAlertPolicy alertPolicies::create}
  #     method, do not include the +name+ field in the conditions of the
  #     requested alerting policy. Stackdriver Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::UpdateAlertPolicy alertPolicies::update}
  #     method to update a policy, including a condition +name+ causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve +[CONDITION_ID]+ if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  class Condition
    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a +{count: 1}+ trigger is used.
    # @!attribute [rw] count
    #   @return [Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger; end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] denominator_filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies a time
    #     series that should be used as the denominator of a ratio that will be
    #     compared with the threshold. If a +denominator_filter+ is specified,
    #     the time series specified by the +filter+ field will be used as the
    #     numerator.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by +denominatorFilter+ as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the +aggregations+ and
    #     +denominator_aggregations+ fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
    #     is advisable to use the +ListTimeSeries+ method when debugging this
    #     field.
    # @!attribute [rw] comparison
    #   @return [Google::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by +filter+
    #     and +aggregation+) and the threshold (indicated by +threshold_value+).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only +COMPARISON_LT+ and +COMPARISON_GT+ are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored. When choosing a duration, it is useful to keep in mind the
    #     frequency of the underlying time series data (which may also be
    #     affected by any alignments specified in the +aggregation+ field);
    #     a good duration is long enough so that a single outlier does not
    #     generate spurious alerts, but short enough that unhealthy states
    #     are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+,
    #     or by the ratio, if +denominator_filter+ and +denominator_aggregations+
    #     are specified.
    class MetricThreshold; end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified +duration+.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the
    #     one in the [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. Currently, only values that
    #     are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+.
    class MetricAbsence; end
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical +AND+ operator. An
    # incident is created only if all conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical +OR+ operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical +AND+ operator, but unlike the regular
    # +AND+ option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end
end

#conditionsArray<Google::Monitoring::V3::AlertPolicy::Condition>

Returns A list of conditions for the policy. The conditions are combined by AND or OR according to the +combiner+ field. If the combined conditions evaluate to true, then an incident is created. A policy can have from one to six conditions.

Returns:

  • (Array<Google::Monitoring::V3::AlertPolicy::Condition>)

    A list of conditions for the policy. The conditions are combined by AND or OR according to the +combiner+ field. If the combined conditions evaluate to true, then an incident is created. A policy can have from one to six conditions.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb', line 93

class AlertPolicy
  # A content string and a MIME type that describes the content string's
  # format.
  # @!attribute [rw] content
  #   @return [String]
  #     The text of the documentation, interpreted according to +mime_type+.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller.
  # @!attribute [rw] mime_type
  #   @return [String]
  #     The format of the +content+ field. Presently, only the value
  #     +"text/markdown"+ is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  class Documentation; end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its syntax is:
  #
  #         projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     +[CONDITION_ID]+ is assigned by Stackdriver Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::CreateAlertPolicy alertPolicies::create}
  #     method, do not include the +name+ field in the conditions of the
  #     requested alerting policy. Stackdriver Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::UpdateAlertPolicy alertPolicies::update}
  #     method to update a policy, including a condition +name+ causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve +[CONDITION_ID]+ if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  class Condition
    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a +{count: 1}+ trigger is used.
    # @!attribute [rw] count
    #   @return [Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger; end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] denominator_filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies a time
    #     series that should be used as the denominator of a ratio that will be
    #     compared with the threshold. If a +denominator_filter+ is specified,
    #     the time series specified by the +filter+ field will be used as the
    #     numerator.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by +denominatorFilter+ as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the +aggregations+ and
    #     +denominator_aggregations+ fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
    #     is advisable to use the +ListTimeSeries+ method when debugging this
    #     field.
    # @!attribute [rw] comparison
    #   @return [Google::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by +filter+
    #     and +aggregation+) and the threshold (indicated by +threshold_value+).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only +COMPARISON_LT+ and +COMPARISON_GT+ are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored. When choosing a duration, it is useful to keep in mind the
    #     frequency of the underlying time series data (which may also be
    #     affected by any alignments specified in the +aggregation+ field);
    #     a good duration is long enough so that a single outlier does not
    #     generate spurious alerts, but short enough that unhealthy states
    #     are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+,
    #     or by the ratio, if +denominator_filter+ and +denominator_aggregations+
    #     are specified.
    class MetricThreshold; end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified +duration+.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the
    #     one in the [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. Currently, only values that
    #     are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+.
    class MetricAbsence; end
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical +AND+ operator. An
    # incident is created only if all conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical +OR+ operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical +AND+ operator, but unlike the regular
    # +AND+ option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end
end

#creation_recordGoogle::Monitoring::V3::MutationRecord

Returns A read-only record of the creation of the alerting policy. If provided in a call to create or update, this field will be ignored.

Returns:



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb', line 93

class AlertPolicy
  # A content string and a MIME type that describes the content string's
  # format.
  # @!attribute [rw] content
  #   @return [String]
  #     The text of the documentation, interpreted according to +mime_type+.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller.
  # @!attribute [rw] mime_type
  #   @return [String]
  #     The format of the +content+ field. Presently, only the value
  #     +"text/markdown"+ is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  class Documentation; end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its syntax is:
  #
  #         projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     +[CONDITION_ID]+ is assigned by Stackdriver Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::CreateAlertPolicy alertPolicies::create}
  #     method, do not include the +name+ field in the conditions of the
  #     requested alerting policy. Stackdriver Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::UpdateAlertPolicy alertPolicies::update}
  #     method to update a policy, including a condition +name+ causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve +[CONDITION_ID]+ if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  class Condition
    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a +{count: 1}+ trigger is used.
    # @!attribute [rw] count
    #   @return [Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger; end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] denominator_filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies a time
    #     series that should be used as the denominator of a ratio that will be
    #     compared with the threshold. If a +denominator_filter+ is specified,
    #     the time series specified by the +filter+ field will be used as the
    #     numerator.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by +denominatorFilter+ as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the +aggregations+ and
    #     +denominator_aggregations+ fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
    #     is advisable to use the +ListTimeSeries+ method when debugging this
    #     field.
    # @!attribute [rw] comparison
    #   @return [Google::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by +filter+
    #     and +aggregation+) and the threshold (indicated by +threshold_value+).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only +COMPARISON_LT+ and +COMPARISON_GT+ are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored. When choosing a duration, it is useful to keep in mind the
    #     frequency of the underlying time series data (which may also be
    #     affected by any alignments specified in the +aggregation+ field);
    #     a good duration is long enough so that a single outlier does not
    #     generate spurious alerts, but short enough that unhealthy states
    #     are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+,
    #     or by the ratio, if +denominator_filter+ and +denominator_aggregations+
    #     are specified.
    class MetricThreshold; end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified +duration+.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the
    #     one in the [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. Currently, only values that
    #     are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+.
    class MetricAbsence; end
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical +AND+ operator. An
    # incident is created only if all conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical +OR+ operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical +AND+ operator, but unlike the regular
    # +AND+ option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end
end

#display_nameString

Returns A short name or phrase used to identify the policy in dashboards, notifications, and incidents. To avoid confusion, don't use the same display name for multiple policies in the same project. The name is limited to 512 Unicode characters.

Returns:

  • (String)

    A short name or phrase used to identify the policy in dashboards, notifications, and incidents. To avoid confusion, don't use the same display name for multiple policies in the same project. The name is limited to 512 Unicode characters.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb', line 93

class AlertPolicy
  # A content string and a MIME type that describes the content string's
  # format.
  # @!attribute [rw] content
  #   @return [String]
  #     The text of the documentation, interpreted according to +mime_type+.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller.
  # @!attribute [rw] mime_type
  #   @return [String]
  #     The format of the +content+ field. Presently, only the value
  #     +"text/markdown"+ is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  class Documentation; end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its syntax is:
  #
  #         projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     +[CONDITION_ID]+ is assigned by Stackdriver Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::CreateAlertPolicy alertPolicies::create}
  #     method, do not include the +name+ field in the conditions of the
  #     requested alerting policy. Stackdriver Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::UpdateAlertPolicy alertPolicies::update}
  #     method to update a policy, including a condition +name+ causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve +[CONDITION_ID]+ if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  class Condition
    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a +{count: 1}+ trigger is used.
    # @!attribute [rw] count
    #   @return [Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger; end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] denominator_filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies a time
    #     series that should be used as the denominator of a ratio that will be
    #     compared with the threshold. If a +denominator_filter+ is specified,
    #     the time series specified by the +filter+ field will be used as the
    #     numerator.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by +denominatorFilter+ as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the +aggregations+ and
    #     +denominator_aggregations+ fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
    #     is advisable to use the +ListTimeSeries+ method when debugging this
    #     field.
    # @!attribute [rw] comparison
    #   @return [Google::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by +filter+
    #     and +aggregation+) and the threshold (indicated by +threshold_value+).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only +COMPARISON_LT+ and +COMPARISON_GT+ are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored. When choosing a duration, it is useful to keep in mind the
    #     frequency of the underlying time series data (which may also be
    #     affected by any alignments specified in the +aggregation+ field);
    #     a good duration is long enough so that a single outlier does not
    #     generate spurious alerts, but short enough that unhealthy states
    #     are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+,
    #     or by the ratio, if +denominator_filter+ and +denominator_aggregations+
    #     are specified.
    class MetricThreshold; end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified +duration+.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the
    #     one in the [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. Currently, only values that
    #     are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+.
    class MetricAbsence; end
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical +AND+ operator. An
    # incident is created only if all conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical +OR+ operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical +AND+ operator, but unlike the regular
    # +AND+ option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end
end

#documentationGoogle::Monitoring::V3::AlertPolicy::Documentation

Returns Documentation that is included with notifications and incidents related to this policy. Best practice is for the documentation to include information to help responders understand, mitigate, escalate, and correct the underlying problems detected by the alerting policy. Notification channels that have limited capacity might not show this documentation.

Returns:

  • (Google::Monitoring::V3::AlertPolicy::Documentation)

    Documentation that is included with notifications and incidents related to this policy. Best practice is for the documentation to include information to help responders understand, mitigate, escalate, and correct the underlying problems detected by the alerting policy. Notification channels that have limited capacity might not show this documentation.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb', line 93

class AlertPolicy
  # A content string and a MIME type that describes the content string's
  # format.
  # @!attribute [rw] content
  #   @return [String]
  #     The text of the documentation, interpreted according to +mime_type+.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller.
  # @!attribute [rw] mime_type
  #   @return [String]
  #     The format of the +content+ field. Presently, only the value
  #     +"text/markdown"+ is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  class Documentation; end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its syntax is:
  #
  #         projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     +[CONDITION_ID]+ is assigned by Stackdriver Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::CreateAlertPolicy alertPolicies::create}
  #     method, do not include the +name+ field in the conditions of the
  #     requested alerting policy. Stackdriver Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::UpdateAlertPolicy alertPolicies::update}
  #     method to update a policy, including a condition +name+ causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve +[CONDITION_ID]+ if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  class Condition
    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a +{count: 1}+ trigger is used.
    # @!attribute [rw] count
    #   @return [Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger; end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] denominator_filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies a time
    #     series that should be used as the denominator of a ratio that will be
    #     compared with the threshold. If a +denominator_filter+ is specified,
    #     the time series specified by the +filter+ field will be used as the
    #     numerator.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by +denominatorFilter+ as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the +aggregations+ and
    #     +denominator_aggregations+ fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
    #     is advisable to use the +ListTimeSeries+ method when debugging this
    #     field.
    # @!attribute [rw] comparison
    #   @return [Google::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by +filter+
    #     and +aggregation+) and the threshold (indicated by +threshold_value+).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only +COMPARISON_LT+ and +COMPARISON_GT+ are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored. When choosing a duration, it is useful to keep in mind the
    #     frequency of the underlying time series data (which may also be
    #     affected by any alignments specified in the +aggregation+ field);
    #     a good duration is long enough so that a single outlier does not
    #     generate spurious alerts, but short enough that unhealthy states
    #     are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+,
    #     or by the ratio, if +denominator_filter+ and +denominator_aggregations+
    #     are specified.
    class MetricThreshold; end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified +duration+.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the
    #     one in the [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. Currently, only values that
    #     are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+.
    class MetricAbsence; end
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical +AND+ operator. An
    # incident is created only if all conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical +OR+ operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical +AND+ operator, but unlike the regular
    # +AND+ option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end
end

#enabledGoogle::Protobuf::BoolValue

Returns Whether or not the policy is enabled. On write, the default interpretation if unset is that the policy is enabled. On read, clients should not make any assumption about the state if it has not been populated. The field should always be populated on List and Get operations, unless a field projection has been specified that strips it out.

Returns:

  • (Google::Protobuf::BoolValue)

    Whether or not the policy is enabled. On write, the default interpretation if unset is that the policy is enabled. On read, clients should not make any assumption about the state if it has not been populated. The field should always be populated on List and Get operations, unless a field projection has been specified that strips it out.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb', line 93

class AlertPolicy
  # A content string and a MIME type that describes the content string's
  # format.
  # @!attribute [rw] content
  #   @return [String]
  #     The text of the documentation, interpreted according to +mime_type+.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller.
  # @!attribute [rw] mime_type
  #   @return [String]
  #     The format of the +content+ field. Presently, only the value
  #     +"text/markdown"+ is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  class Documentation; end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its syntax is:
  #
  #         projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     +[CONDITION_ID]+ is assigned by Stackdriver Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::CreateAlertPolicy alertPolicies::create}
  #     method, do not include the +name+ field in the conditions of the
  #     requested alerting policy. Stackdriver Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::UpdateAlertPolicy alertPolicies::update}
  #     method to update a policy, including a condition +name+ causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve +[CONDITION_ID]+ if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  class Condition
    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a +{count: 1}+ trigger is used.
    # @!attribute [rw] count
    #   @return [Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger; end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] denominator_filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies a time
    #     series that should be used as the denominator of a ratio that will be
    #     compared with the threshold. If a +denominator_filter+ is specified,
    #     the time series specified by the +filter+ field will be used as the
    #     numerator.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by +denominatorFilter+ as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the +aggregations+ and
    #     +denominator_aggregations+ fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
    #     is advisable to use the +ListTimeSeries+ method when debugging this
    #     field.
    # @!attribute [rw] comparison
    #   @return [Google::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by +filter+
    #     and +aggregation+) and the threshold (indicated by +threshold_value+).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only +COMPARISON_LT+ and +COMPARISON_GT+ are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored. When choosing a duration, it is useful to keep in mind the
    #     frequency of the underlying time series data (which may also be
    #     affected by any alignments specified in the +aggregation+ field);
    #     a good duration is long enough so that a single outlier does not
    #     generate spurious alerts, but short enough that unhealthy states
    #     are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+,
    #     or by the ratio, if +denominator_filter+ and +denominator_aggregations+
    #     are specified.
    class MetricThreshold; end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified +duration+.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the
    #     one in the [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. Currently, only values that
    #     are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+.
    class MetricAbsence; end
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical +AND+ operator. An
    # incident is created only if all conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical +OR+ operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical +AND+ operator, but unlike the regular
    # +AND+ option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end
end

#mutation_recordGoogle::Monitoring::V3::MutationRecord

Returns A read-only record of the most recent change to the alerting policy. If provided in a call to create or update, this field will be ignored.

Returns:



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb', line 93

class AlertPolicy
  # A content string and a MIME type that describes the content string's
  # format.
  # @!attribute [rw] content
  #   @return [String]
  #     The text of the documentation, interpreted according to +mime_type+.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller.
  # @!attribute [rw] mime_type
  #   @return [String]
  #     The format of the +content+ field. Presently, only the value
  #     +"text/markdown"+ is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  class Documentation; end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its syntax is:
  #
  #         projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     +[CONDITION_ID]+ is assigned by Stackdriver Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::CreateAlertPolicy alertPolicies::create}
  #     method, do not include the +name+ field in the conditions of the
  #     requested alerting policy. Stackdriver Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::UpdateAlertPolicy alertPolicies::update}
  #     method to update a policy, including a condition +name+ causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve +[CONDITION_ID]+ if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  class Condition
    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a +{count: 1}+ trigger is used.
    # @!attribute [rw] count
    #   @return [Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger; end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] denominator_filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies a time
    #     series that should be used as the denominator of a ratio that will be
    #     compared with the threshold. If a +denominator_filter+ is specified,
    #     the time series specified by the +filter+ field will be used as the
    #     numerator.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by +denominatorFilter+ as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the +aggregations+ and
    #     +denominator_aggregations+ fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
    #     is advisable to use the +ListTimeSeries+ method when debugging this
    #     field.
    # @!attribute [rw] comparison
    #   @return [Google::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by +filter+
    #     and +aggregation+) and the threshold (indicated by +threshold_value+).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only +COMPARISON_LT+ and +COMPARISON_GT+ are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored. When choosing a duration, it is useful to keep in mind the
    #     frequency of the underlying time series data (which may also be
    #     affected by any alignments specified in the +aggregation+ field);
    #     a good duration is long enough so that a single outlier does not
    #     generate spurious alerts, but short enough that unhealthy states
    #     are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+,
    #     or by the ratio, if +denominator_filter+ and +denominator_aggregations+
    #     are specified.
    class MetricThreshold; end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified +duration+.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the
    #     one in the [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. Currently, only values that
    #     are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+.
    class MetricAbsence; end
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical +AND+ operator. An
    # incident is created only if all conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical +OR+ operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical +AND+ operator, but unlike the regular
    # +AND+ option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end
end

#nameString

Returns Required if the policy exists. The resource name for this policy. The syntax is:

projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]

+[ALERT_POLICY_ID]+ is assigned by Stackdriver Monitoring when the policy is created. When calling the alertPolicies::create method, do not include the +name+ field in the alerting policy passed as part of the request.

Returns:

  • (String)

    Required if the policy exists. The resource name for this policy. The syntax is:

    projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID]
    

    +[ALERT_POLICY_ID]+ is assigned by Stackdriver Monitoring when the policy is created. When calling the alertPolicies::create method, do not include the +name+ field in the alerting policy passed as part of the request.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb', line 93

class AlertPolicy
  # A content string and a MIME type that describes the content string's
  # format.
  # @!attribute [rw] content
  #   @return [String]
  #     The text of the documentation, interpreted according to +mime_type+.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller.
  # @!attribute [rw] mime_type
  #   @return [String]
  #     The format of the +content+ field. Presently, only the value
  #     +"text/markdown"+ is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  class Documentation; end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its syntax is:
  #
  #         projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     +[CONDITION_ID]+ is assigned by Stackdriver Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::CreateAlertPolicy alertPolicies::create}
  #     method, do not include the +name+ field in the conditions of the
  #     requested alerting policy. Stackdriver Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::UpdateAlertPolicy alertPolicies::update}
  #     method to update a policy, including a condition +name+ causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve +[CONDITION_ID]+ if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  class Condition
    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a +{count: 1}+ trigger is used.
    # @!attribute [rw] count
    #   @return [Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger; end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] denominator_filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies a time
    #     series that should be used as the denominator of a ratio that will be
    #     compared with the threshold. If a +denominator_filter+ is specified,
    #     the time series specified by the +filter+ field will be used as the
    #     numerator.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by +denominatorFilter+ as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the +aggregations+ and
    #     +denominator_aggregations+ fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
    #     is advisable to use the +ListTimeSeries+ method when debugging this
    #     field.
    # @!attribute [rw] comparison
    #   @return [Google::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by +filter+
    #     and +aggregation+) and the threshold (indicated by +threshold_value+).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only +COMPARISON_LT+ and +COMPARISON_GT+ are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored. When choosing a duration, it is useful to keep in mind the
    #     frequency of the underlying time series data (which may also be
    #     affected by any alignments specified in the +aggregation+ field);
    #     a good duration is long enough so that a single outlier does not
    #     generate spurious alerts, but short enough that unhealthy states
    #     are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+,
    #     or by the ratio, if +denominator_filter+ and +denominator_aggregations+
    #     are specified.
    class MetricThreshold; end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified +duration+.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the
    #     one in the [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. Currently, only values that
    #     are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+.
    class MetricAbsence; end
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical +AND+ operator. An
    # incident is created only if all conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical +OR+ operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical +AND+ operator, but unlike the regular
    # +AND+ option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end
end

#notification_channelsArray<String>

Returns Identifies the notification channels to which notifications should be sent when incidents are opened or closed or when new violations occur on an already opened incident. Each element of this array corresponds to the +name+ field in each of the +NotificationChannel+ objects that are returned from the [+ListNotificationChannels+] [google.monitoring.v3.NotificationChannelService.ListNotificationChannels] method. The syntax of the entries in this field is:

projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]

Returns:

  • (Array<String>)

    Identifies the notification channels to which notifications should be sent when incidents are opened or closed or when new violations occur on an already opened incident. Each element of this array corresponds to the +name+ field in each of the +NotificationChannel+ objects that are returned from the [+ListNotificationChannels+] [google.monitoring.v3.NotificationChannelService.ListNotificationChannels] method. The syntax of the entries in this field is:

    projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]
    


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb', line 93

class AlertPolicy
  # A content string and a MIME type that describes the content string's
  # format.
  # @!attribute [rw] content
  #   @return [String]
  #     The text of the documentation, interpreted according to +mime_type+.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller.
  # @!attribute [rw] mime_type
  #   @return [String]
  #     The format of the +content+ field. Presently, only the value
  #     +"text/markdown"+ is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  class Documentation; end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its syntax is:
  #
  #         projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     +[CONDITION_ID]+ is assigned by Stackdriver Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::CreateAlertPolicy alertPolicies::create}
  #     method, do not include the +name+ field in the conditions of the
  #     requested alerting policy. Stackdriver Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::UpdateAlertPolicy alertPolicies::update}
  #     method to update a policy, including a condition +name+ causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve +[CONDITION_ID]+ if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  class Condition
    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a +{count: 1}+ trigger is used.
    # @!attribute [rw] count
    #   @return [Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger; end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] denominator_filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies a time
    #     series that should be used as the denominator of a ratio that will be
    #     compared with the threshold. If a +denominator_filter+ is specified,
    #     the time series specified by the +filter+ field will be used as the
    #     numerator.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by +denominatorFilter+ as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the +aggregations+ and
    #     +denominator_aggregations+ fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
    #     is advisable to use the +ListTimeSeries+ method when debugging this
    #     field.
    # @!attribute [rw] comparison
    #   @return [Google::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by +filter+
    #     and +aggregation+) and the threshold (indicated by +threshold_value+).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only +COMPARISON_LT+ and +COMPARISON_GT+ are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored. When choosing a duration, it is useful to keep in mind the
    #     frequency of the underlying time series data (which may also be
    #     affected by any alignments specified in the +aggregation+ field);
    #     a good duration is long enough so that a single outlier does not
    #     generate spurious alerts, but short enough that unhealthy states
    #     are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+,
    #     or by the ratio, if +denominator_filter+ and +denominator_aggregations+
    #     are specified.
    class MetricThreshold; end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified +duration+.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the
    #     one in the [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. Currently, only values that
    #     are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+.
    class MetricAbsence; end
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical +AND+ operator. An
    # incident is created only if all conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical +OR+ operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical +AND+ operator, but unlike the regular
    # +AND+ option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end
end

#user_labelsHash{String => String}

Returns User-supplied key/value data to be used for organizing and identifying the +AlertPolicy+ objects.

The field can contain up to 64 entries. Each key and value is limited to 63 Unicode characters or 128 bytes, whichever is smaller. Labels and values can contain only lowercase letters, numerals, underscores, and dashes. Keys must begin with a letter.

Returns:

  • (Hash{String => String})

    User-supplied key/value data to be used for organizing and identifying the +AlertPolicy+ objects.

    The field can contain up to 64 entries. Each key and value is limited to 63 Unicode characters or 128 bytes, whichever is smaller. Labels and values can contain only lowercase letters, numerals, underscores, and dashes. Keys must begin with a letter.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/google/cloud/monitoring/v3/doc/google/monitoring/v3/alert.rb', line 93

class AlertPolicy
  # A content string and a MIME type that describes the content string's
  # format.
  # @!attribute [rw] content
  #   @return [String]
  #     The text of the documentation, interpreted according to +mime_type+.
  #     The content may not exceed 8,192 Unicode characters and may not exceed
  #     more than 10,240 bytes when encoded in UTF-8 format, whichever is
  #     smaller.
  # @!attribute [rw] mime_type
  #   @return [String]
  #     The format of the +content+ field. Presently, only the value
  #     +"text/markdown"+ is supported. See
  #     [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information.
  class Documentation; end

  # A condition is a true/false test that determines when an alerting policy
  # should open an incident. If a condition evaluates to true, it signifies
  # that something is wrong.
  # @!attribute [rw] name
  #   @return [String]
  #     Required if the condition exists. The unique resource name for this
  #     condition. Its syntax is:
  #
  #         projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID]
  #
  #     +[CONDITION_ID]+ is assigned by Stackdriver Monitoring when the
  #     condition is created as part of a new or updated alerting policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::CreateAlertPolicy alertPolicies::create}
  #     method, do not include the +name+ field in the conditions of the
  #     requested alerting policy. Stackdriver Monitoring creates the
  #     condition identifiers and includes them in the new policy.
  #
  #     When calling the
  #     {Google::Monitoring::V3::AlertPolicyService::UpdateAlertPolicy alertPolicies::update}
  #     method to update a policy, including a condition +name+ causes the
  #     existing condition to be updated. Conditions without names are added to
  #     the updated policy. Existing conditions are deleted if they are not
  #     updated.
  #
  #     Best practice is to preserve +[CONDITION_ID]+ if you make only small
  #     changes, such as those to condition thresholds, durations, or trigger
  #     values.  Otherwise, treat the change as a new condition and let the
  #     existing condition be deleted.
  # @!attribute [rw] display_name
  #   @return [String]
  #     A short name or phrase used to identify the condition in dashboards,
  #     notifications, and incidents. To avoid confusion, don't use the same
  #     display name for multiple conditions in the same policy.
  # @!attribute [rw] condition_threshold
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricThreshold]
  #     A condition that compares a time series against a threshold.
  # @!attribute [rw] condition_absent
  #   @return [Google::Monitoring::V3::AlertPolicy::Condition::MetricAbsence]
  #     A condition that checks that a time series continues to
  #     receive new data points.
  class Condition
    # Specifies how many time series must fail a predicate to trigger a
    # condition. If not specified, then a +{count: 1}+ trigger is used.
    # @!attribute [rw] count
    #   @return [Integer]
    #     The absolute number of time series that must fail
    #     the predicate for the condition to be triggered.
    # @!attribute [rw] percent
    #   @return [Float]
    #     The percentage of time series that must fail the
    #     predicate for the condition to be triggered.
    class Trigger; end

    # A condition type that compares a collection of time series
    # against a threshold.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] denominator_filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that identifies a time
    #     series that should be used as the denominator of a ratio that will be
    #     compared with the threshold. If a +denominator_filter+ is specified,
    #     the time series specified by the +filter+ field will be used as the
    #     numerator.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] denominator_aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series
    #     selected by +denominatorFilter+ as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resources).
    #
    #     When computing ratios, the +aggregations+ and
    #     +denominator_aggregations+ fields must use the same alignment period
    #     and produce time series that have the same periodicity and labels.
    #
    #     This field is similar to the one in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It
    #     is advisable to use the +ListTimeSeries+ method when debugging this
    #     field.
    # @!attribute [rw] comparison
    #   @return [Google::Monitoring::V3::ComparisonType]
    #     The comparison to apply between the time series (indicated by +filter+
    #     and +aggregation+) and the threshold (indicated by +threshold_value+).
    #     The comparison is applied on each time series, with the time series
    #     on the left-hand side and the threshold on the right-hand side.
    #
    #     Only +COMPARISON_LT+ and +COMPARISON_GT+ are supported currently.
    # @!attribute [rw] threshold_value
    #   @return [Float]
    #     A value against which to compare the time series.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must violate the
    #     threshold to be considered failing. Currently, only values
    #     that are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored. When choosing a duration, it is useful to keep in mind the
    #     frequency of the underlying time series data (which may also be
    #     affected by any alignments specified in the +aggregation+ field);
    #     a good duration is long enough so that a single outlier does not
    #     generate spurious alerts, but short enough that unhealthy states
    #     are detected and alerted on quickly.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+,
    #     or by the ratio, if +denominator_filter+ and +denominator_aggregations+
    #     are specified.
    class MetricThreshold; end

    # A condition type that checks that monitored resources
    # are reporting data. The configuration defines a metric and
    # a set of monitored resources. The predicate is considered in violation
    # when a time series for the specified metric of a monitored
    # resource does not include any data in the specified +duration+.
    # @!attribute [rw] filter
    #   @return [String]
    #     A [filter](https://cloud.google.com/monitoring/api/v3/filters) that
    #     identifies which time series should be compared with the threshold.
    #
    #     The filter is similar to the one that is specified in the
    #     [+MetricService.ListTimeSeries+
    #     request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that
    #     call is useful to verify the time series that will be retrieved /
    #     processed) and must specify the metric type and optionally may contain
    #     restrictions on resource type, resource labels, and metric labels.
    #     This field may not exceed 2048 Unicode characters in length.
    # @!attribute [rw] aggregations
    #   @return [Array<Google::Monitoring::V3::Aggregation>]
    #     Specifies the alignment of data points in individual time series as
    #     well as how to combine the retrieved time series together (such as
    #     when aggregating multiple streams on each resource to a single
    #     stream for each resource or when aggregating streams across all
    #     members of a group of resrouces). Multiple aggregations
    #     are applied in the order specified.
    #
    #     This field is similar to the
    #     one in the [+MetricService.ListTimeSeries+ request](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list).
    #     It is advisable to use the +ListTimeSeries+ method when debugging this field.
    # @!attribute [rw] duration
    #   @return [Google::Protobuf::Duration]
    #     The amount of time that a time series must fail to report new
    #     data to be considered failing. Currently, only values that
    #     are a multiple of a minute--e.g.  60, 120, or 300
    #     seconds--are supported. If an invalid value is given, an
    #     error will be returned. The +Duration.nanos+ field is
    #     ignored.
    # @!attribute [rw] trigger
    #   @return [Google::Monitoring::V3::AlertPolicy::Condition::Trigger]
    #     The number/percent of time series for which the comparison must hold
    #     in order for the condition to trigger. If unspecified, then the
    #     condition will trigger if the comparison is true for any of the
    #     time series that have been identified by +filter+ and +aggregations+.
    class MetricAbsence; end
  end

  # Operators for combining conditions.
  module ConditionCombinerType
    # An unspecified combiner.
    COMBINE_UNSPECIFIED = 0

    # Combine conditions using the logical +AND+ operator. An
    # incident is created only if all conditions are met
    # simultaneously. This combiner is satisfied if all conditions are
    # met, even if they are met on completely different resources.
    AND = 1

    # Combine conditions using the logical +OR+ operator. An incident
    # is created if any of the listed conditions is met.
    OR = 2

    # Combine conditions using logical +AND+ operator, but unlike the regular
    # +AND+ option, an incident is created only if all conditions are met
    # simultaneously on at least one resource.
    AND_WITH_MATCHING_RESOURCE = 3
  end
end