Class: Mackerel::Monitor
- Inherits:
-
Object
- Object
- Mackerel::Monitor
- Defined in:
- lib/mackerel/monitor.rb
Instance Attribute Summary collapse
-
#certificationExpirationCritical ⇒ Object
Returns the value of attribute certificationExpirationCritical.
-
#certificationExpirationWarning ⇒ Object
Returns the value of attribute certificationExpirationWarning.
-
#containsString ⇒ Object
Returns the value of attribute containsString.
-
#critical ⇒ Object
Returns the value of attribute critical.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#excludeScopes ⇒ Object
Returns the value of attribute excludeScopes.
-
#expression ⇒ Object
Returns the value of attribute expression.
-
#id ⇒ Object
Returns the value of attribute id.
-
#isMute ⇒ Object
Returns the value of attribute isMute.
-
#maxCheckAttempts ⇒ Object
Returns the value of attribute maxCheckAttempts.
-
#metric ⇒ Object
Returns the value of attribute metric.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notificationInterval ⇒ Object
Returns the value of attribute notificationInterval.
-
#operator ⇒ Object
Returns the value of attribute operator.
-
#responseTimeCritical ⇒ Object
Returns the value of attribute responseTimeCritical.
-
#responseTimeDuration ⇒ Object
Returns the value of attribute responseTimeDuration.
-
#responseTimeWarning ⇒ Object
Returns the value of attribute responseTimeWarning.
-
#scopes ⇒ Object
Returns the value of attribute scopes.
-
#service ⇒ Object
Returns the value of attribute service.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
-
#warning ⇒ Object
Returns the value of attribute warning.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Monitor
constructor
A new instance of Monitor.
- #to_h ⇒ Object
- #to_json(options = nil) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Monitor
Returns a new instance of Monitor.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mackerel/monitor.rb', line 7 def initialize(args = {}) @id = args["id"] @type = args["type"] @name = args["name"] @duration = args["duration"] @metric = args["metric"] @url = args["url"] @service = args["service"] @maxCheckAttempts = args["maxCheckAttempts"] @operator = args["operator"] @warning = args["warning"] @critical = args["critical"] @responseTimeWarning = args["responseTimeWarning"] @responseTimeCritical = args["responseTimeCritical"] @responseTimeDuration = args["responseTimeDuration"] @certificationExpirationWarning = args["certificationExpirationWarning"] @certificationExpirationCritical = args["certificationExpirationCritical"] @containsString = args["containsString"] @expression = args["expression"] @notificationInterval = args["notificationInterval"] @scopes = args["scopes"] @excludeScopes = args["excludeScopes"] @isMute = args["isMute"] end |
Instance Attribute Details
#certificationExpirationCritical ⇒ Object
Returns the value of attribute certificationExpirationCritical.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def certificationExpirationCritical @certificationExpirationCritical end |
#certificationExpirationWarning ⇒ Object
Returns the value of attribute certificationExpirationWarning.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def certificationExpirationWarning @certificationExpirationWarning end |
#containsString ⇒ Object
Returns the value of attribute containsString.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def containsString @containsString end |
#critical ⇒ Object
Returns the value of attribute critical.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def critical @critical end |
#duration ⇒ Object
Returns the value of attribute duration.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def duration @duration end |
#excludeScopes ⇒ Object
Returns the value of attribute excludeScopes.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def excludeScopes @excludeScopes end |
#expression ⇒ Object
Returns the value of attribute expression.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def expression @expression end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def id @id end |
#isMute ⇒ Object
Returns the value of attribute isMute.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def isMute @isMute end |
#maxCheckAttempts ⇒ Object
Returns the value of attribute maxCheckAttempts.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def maxCheckAttempts @maxCheckAttempts end |
#metric ⇒ Object
Returns the value of attribute metric.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def metric @metric end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def name @name end |
#notificationInterval ⇒ Object
Returns the value of attribute notificationInterval.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def notificationInterval @notificationInterval end |
#operator ⇒ Object
Returns the value of attribute operator.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def operator @operator end |
#responseTimeCritical ⇒ Object
Returns the value of attribute responseTimeCritical.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def responseTimeCritical @responseTimeCritical end |
#responseTimeDuration ⇒ Object
Returns the value of attribute responseTimeDuration.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def responseTimeDuration @responseTimeDuration end |
#responseTimeWarning ⇒ Object
Returns the value of attribute responseTimeWarning.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def responseTimeWarning @responseTimeWarning end |
#scopes ⇒ Object
Returns the value of attribute scopes.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def scopes @scopes end |
#service ⇒ Object
Returns the value of attribute service.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def service @service end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def url @url end |
#warning ⇒ Object
Returns the value of attribute warning.
5 6 7 |
# File 'lib/mackerel/monitor.rb', line 5 def warning @warning end |
Instance Method Details
#to_h ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/mackerel/monitor.rb', line 32 def to_h instance_variables.flat_map do |name| respond_to?(name[1..-1]) ? [name[1..-1]] : [] end.each_with_object({}) do |name, hash| hash[name] = public_send(name) end.delete_if { |key, val| val == nil } end |
#to_json(options = nil) ⇒ Object
40 41 42 |
# File 'lib/mackerel/monitor.rb', line 40 def to_json( = nil) return to_h.to_json() end |