Class: DatadogAPIClient::V1::MonitorOptions

Inherits:
Object
  • Object
show all
Includes:
BaseGenericModel
Defined in:
lib/datadog_api_client/v1/models/monitor_options.rb

Overview

List of options associated with your monitor.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseGenericModel

included

Instance Attribute Details

#_unparsedObject

whether the object has unparsed attributes



23
24
25
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 23

def _unparsed
  @_unparsed
end

#additional_propertiesObject

Returns the value of attribute additional_properties.



156
157
158
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 156

def additional_properties
  @additional_properties
end

#aggregationObject

Type of aggregation performed in the monitor query.



25
26
27
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 25

def aggregation
  @aggregation
end

#device_idsObject

IDs of the device the Synthetics monitor is running on.



28
29
30
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 28

def device_ids
  @device_ids
end

#enable_logs_sampleObject

Whether or not to send a log sample when the log monitor triggers.



31
32
33
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 31

def enable_logs_sample
  @enable_logs_sample
end

#enable_samplesObject

Whether or not to send a list of samples when the monitor triggers. This is only used by CI Test and Pipeline monitors.



34
35
36
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 34

def enable_samples
  @enable_samples
end

#escalation_messageObject

We recommend using the is_renotify, block in the original message instead. A message to include with a re-notification. Supports the @username notification we allow elsewhere. Not applicable if renotify_interval is None.



34
35
36
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 34

def escalation_message
  @escalation_message
end

#evaluation_delayObject

Time (in seconds) to delay evaluation, as a non-negative integer. For example, if the value is set to 300 (5min), the timeframe is set to last_5m and the time is 7:00, the monitor evaluates data from 6:50 to 6:55. This is useful for AWS CloudWatch and other backfilled metrics to ensure the monitor always has data during evaluation.



37
38
39
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 37

def evaluation_delay
  @evaluation_delay
end

#group_retention_durationObject

The time span after which groups with missing data are dropped from the monitor state. The minimum value is one hour, and the maximum value is 72 hours. Example values are: "60m", "1h", and "2d". This option is only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors.



51
52
53
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 51

def group_retention_duration
  @group_retention_duration
end

#groupby_simple_monitorObject

Whether the log alert monitor triggers a single alert or multiple alerts when any group breaches a threshold. Use notify_by instead.



40
41
42
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 40

def groupby_simple_monitor
  @groupby_simple_monitor
end

#include_tagsObject

A Boolean indicating whether notifications from this monitor automatically inserts its triggering tags into the title.

Examples

  • If True, [Triggered on {host:h1}] Monitor Title
  • If False, [Triggered] Monitor Title


43
44
45
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 43

def include_tags
  @include_tags
end

#lockedObject

Whether or not the monitor is locked (only editable by creator and admins). Use restricted_roles instead.



46
47
48
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 46

def locked
  @locked
end

#min_failure_durationObject

How long the test should be in failure before alerting (integer, number of seconds, max 7200).



49
50
51
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 49

def min_failure_duration
  @min_failure_duration
end

#min_location_failedObject

The minimum number of locations in failure at the same time during at least one moment in the min_failure_duration period (min_location_failed and min_failure_duration are part of the advanced alerting rules - integer, >= 1).



52
53
54
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 52

def min_location_failed
  @min_location_failed
end

#new_group_delayObject

Time (in seconds) to skip evaluations for new groups.

For example, this option can be used to skip evaluations for new hosts while they initialize.

Must be a non negative integer.



55
56
57
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 55

def new_group_delay
  @new_group_delay
end

#new_host_delayObject

Time (in seconds) to allow a host to boot and applications to fully start before starting the evaluation of monitor results. Should be a non negative integer.

Use new_group_delay instead.



58
59
60
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 58

def new_host_delay
  @new_host_delay
end

#no_data_timeframeObject

The number of minutes before a monitor notifies after data stops reporting. Datadog recommends at least 2x the monitor timeframe for query alerts or 2 minutes for service checks. If omitted, 2x the evaluation timeframe is used for query alerts, and 24 hours is used for service checks.



61
62
63
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 61

def no_data_timeframe
  @no_data_timeframe
end

#notification_preset_nameObject

Toggles the display of additional content sent in the monitor notification.



94
95
96
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 94

def notification_preset_name
  @notification_preset_name
end

#notify_auditObject

A Boolean indicating whether tagged users is notified on changes to this monitor.



64
65
66
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 64

def notify_audit
  @notify_audit
end

#notify_byObject

Controls what granularity a monitor alerts on. Only available for monitors with groupings. For instance, a monitor grouped by cluster, namespace, and pod can be configured to only notify on each new cluster violating the alert conditions by setting notify_by to ["cluster"]. Tags mentioned in notify_by must be a subset of the grouping tags in the query. For example, a query grouped by cluster and namespace cannot notify on region. Setting notify_by to [*] configures the monitor to notify as a simple-alert.



105
106
107
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 105

def notify_by
  @notify_by
end

#notify_no_dataObject

A Boolean indicating whether this monitor notifies when data stops reporting. Defaults to false.



67
68
69
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 67

def notify_no_data
  @notify_no_data
end

#on_missing_dataObject

Controls how groups or monitors are treated if an evaluation does not return any data points. The default option results in different behavior depending on the monitor query type. For monitors using Count queries, an empty monitor evaluation is treated as 0 and is compared to the threshold conditions. For monitors using any query type other than Count, for example Gauge, Measure, or Rate, the monitor shows the last known status. This option is only available for APM Trace Analytics, Audit Trail, CI, Error Tracking, Event, Logs, and RUM monitors.



115
116
117
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 115

def on_missing_data
  @on_missing_data
end

#renotify_intervalObject

The number of minutes after the last notification before a monitor re-notifies on the current status. It only re-notifies if it’s not resolved.



70
71
72
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 70

def renotify_interval
  @renotify_interval
end

#renotify_occurrencesObject

The number of times re-notification messages should be sent on the current status at the provided re-notification interval.



73
74
75
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 73

def renotify_occurrences
  @renotify_occurrences
end

#renotify_statusesObject

The types of monitor statuses for which re-notification messages are sent. Default: null if renotify_interval is null. If renotify_interval is set, defaults to renotify on Alert and No Data.



76
77
78
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 76

def renotify_statuses
  @renotify_statuses
end

#require_full_windowObject

A Boolean indicating whether this monitor needs a full window of data before it’s evaluated. We highly recommend you set this to false for sparse metrics, otherwise some evaluations are skipped. Default is false. This setting only applies to metric monitors.



79
80
81
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 79

def require_full_window
  @require_full_window
end

#scheduling_optionsObject

Configuration options for scheduling.



136
137
138
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 136

def scheduling_options
  @scheduling_options
end

#silencedObject

Information about the downtime applied to the monitor. Only shows v1 downtimes.



82
83
84
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 82

def silenced
  @silenced
end

#synthetics_check_idObject

ID of the corresponding Synthetic check.



85
86
87
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 85

def synthetics_check_id
  @synthetics_check_id
end

#threshold_windowsObject

Alerting time window options.



145
146
147
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 145

def threshold_windows
  @threshold_windows
end

#thresholdsObject

List of the different monitor threshold available.



148
149
150
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 148

def thresholds
  @thresholds
end

#timeout_hObject

The number of hours of the monitor not reporting data before it automatically resolves from a triggered state. The minimum allowed value is 0 hours. The maximum allowed value is 24 hours.



92
93
94
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 92

def timeout_h
  @timeout_h
end

#variablesObject

List of requests that can be used in the monitor query. This feature is currently in beta.



154
155
156
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 154

def variables
  @variables
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



125
126
127
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 125

def self.acceptable_attributes
  attribute_map.values
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



391
392
393
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 391

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

Instance Method Details

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 421

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when :Array
    # generic array, return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = DatadogAPIClient::V1.const_get(type)
    res = klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
    if res.instance_of? DatadogAPIClient::V1::UnparsedObject
      self._unparsed = true
    end
    res
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 499

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 398

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


378
379
380
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 378

def eql?(o)
  self == o
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 310

def list_invalid_properties
  invalid_properties = Array.new
  if !@min_failure_duration.nil? && @min_failure_duration > 7200
    invalid_properties.push('invalid value for "min_failure_duration", must be smaller than or equal to 7200.')
  end

  if !@min_failure_duration.nil? && @min_failure_duration < 0
    invalid_properties.push('invalid value for "min_failure_duration", must be greater than or equal to 0.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



475
476
477
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 475

def to_body
  to_hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



469
470
471
# File 'lib/datadog_api_client/v1/models/monitor_options.rb', line 469

def to_s
  to_hash.to_s
end