Class: WavefrontDisplay::Alert
- Inherits:
-
Base
- Object
- Base
- WavefrontDisplay::Alert
show all
- Defined in:
- lib/wavefront-cli/display/alert.rb
Overview
Format human-readable output for alerts.
Constant Summary
WavefrontCli::Constants::DEFAULT_OPTS, WavefrontCli::Constants::HUMAN_TIME_FORMAT, WavefrontCli::Constants::HUMAN_TIME_FORMAT_MS
Instance Attribute Summary
Attributes inherited from Base
#data, #hide_blank, #indent, #indent_step, #indent_str, #kw, #options
Instance Method Summary
collapse
Methods inherited from Base
#_two_columns, #do_delete, #do_import, #do_tag_add, #do_tag_clear, #do_tag_delete, #do_tag_set, #do_tags, #do_undelete, #drop_fields, #friendly_name, #human_time, #indent_wrap, #initialize, #key_width, #long_output, #multicolumn, #print_array, #print_line, #readable_time, #run, #run_error, #set_indent, #terse_output
Instance Method Details
#do_describe ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'lib/wavefront-cli/display/alert.rb', line 18
def do_describe
readable_time(:created, :lastProcessedMillis,
:lastNotificationMillis, :createdEpochMillis,
:updatedEpochMillis, :updated)
drop_fields(:conditionQBEnabled, :displayExpressionQBEnabled,
:displayExpressionQBSerialization)
long_output
end
|
#do_list ⇒ Object
8
9
10
11
12
|
# File 'lib/wavefront-cli/display/alert.rb', line 8
def do_list
long_output [:id, :minutes, :target, :status, :tags, :hostsUsed,
:condition, :displayExpression, :severity,
:additionalInformation]
end
|
#do_list_brief ⇒ Object
14
15
16
|
# File 'lib/wavefront-cli/display/alert.rb', line 14
def do_list_brief
multicolumn(:id, :status, :name)
end
|
#do_snooze ⇒ Object
27
28
29
30
31
32
|
# File 'lib/wavefront-cli/display/alert.rb', line 27
def do_snooze
print "Snoozed alert '#{options[:'<id>']}' "
puts options[:time] ? "for #{options[:time]} seconds." :
'indefinitely.'
end
|
#do_summary ⇒ Object
38
39
40
41
42
|
# File 'lib/wavefront-cli/display/alert.rb', line 38
def do_summary
kw = data.keys.map(&:size).max + 2
data.delete_if { |_k, v| v.zero? } unless options[:all]
data.sort.each { |k, v| puts format("%-#{kw}s%s", k, v) }
end
|
#do_unsnooze ⇒ Object
34
35
36
|
# File 'lib/wavefront-cli/display/alert.rb', line 34
def do_unsnooze
puts "Unsnoozed alert '#{options[:'<id>']}'."
end
|