wavefront-cli 2.18.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +7 -0
- data/.travis.yml +4 -5
- data/HISTORY.md +20 -1
- data/README.md +79 -29
- data/lib/wavefront-cli/base.rb +26 -2
- data/lib/wavefront-cli/commands/alert.rb +10 -10
- data/lib/wavefront-cli/commands/base.rb +15 -2
- data/lib/wavefront-cli/commands/cloudintegration.rb +3 -3
- data/lib/wavefront-cli/commands/config.rb +2 -1
- data/lib/wavefront-cli/commands/dashboard.rb +8 -6
- data/lib/wavefront-cli/commands/derivedmetric.rb +5 -5
- data/lib/wavefront-cli/commands/event.rb +3 -3
- data/lib/wavefront-cli/commands/integration.rb +5 -5
- data/lib/wavefront-cli/commands/link.rb +3 -3
- data/lib/wavefront-cli/commands/message.rb +2 -2
- data/lib/wavefront-cli/commands/metric.rb +1 -1
- data/lib/wavefront-cli/commands/notificant.rb +3 -3
- data/lib/wavefront-cli/commands/proxy.rb +3 -3
- data/lib/wavefront-cli/commands/query.rb +3 -3
- data/lib/wavefront-cli/commands/savedsearch.rb +3 -3
- data/lib/wavefront-cli/commands/settings.rb +22 -0
- data/lib/wavefront-cli/commands/source.rb +3 -3
- data/lib/wavefront-cli/commands/user.rb +4 -4
- data/lib/wavefront-cli/commands/usergroup.rb +5 -8
- data/lib/wavefront-cli/commands/webhook.rb +3 -3
- data/lib/wavefront-cli/commands/window.rb +3 -3
- data/lib/wavefront-cli/commands/write.rb +6 -4
- data/lib/wavefront-cli/config.rb +14 -0
- data/lib/wavefront-cli/controller.rb +2 -0
- data/lib/wavefront-cli/dashboard.rb +133 -14
- data/lib/wavefront-cli/display/base.rb +28 -7
- data/lib/wavefront-cli/display/dashboard.rb +32 -8
- data/lib/wavefront-cli/display/distribution.rb +4 -1
- data/lib/wavefront-cli/display/printer/long.rb +149 -140
- data/lib/wavefront-cli/display/printer/terse.rb +19 -42
- data/lib/wavefront-cli/display/query.rb +6 -0
- data/lib/wavefront-cli/display/settings.rb +21 -0
- data/lib/wavefront-cli/display/write.rb +12 -5
- data/lib/wavefront-cli/event.rb +1 -1
- data/lib/wavefront-cli/exception.rb +1 -0
- data/lib/wavefront-cli/settings.rb +37 -0
- data/lib/wavefront-cli/stdlib/array.rb +20 -0
- data/lib/wavefront-cli/stdlib/string.rb +8 -0
- data/lib/wavefront-cli/user.rb +1 -1
- data/lib/wavefront-cli/version.rb +1 -1
- data/lib/wavefront-cli/write.rb +310 -10
- data/spec/.rubocop.yml +3 -0
- data/spec/spec_helper.rb +81 -1
- data/spec/wavefront-cli/alert_spec.rb +1 -0
- data/spec/wavefront-cli/cloudintegration_spec.rb +1 -0
- data/spec/wavefront-cli/dashboard_spec.rb +47 -4
- data/spec/wavefront-cli/derivedmetric_spec.rb +1 -0
- data/spec/wavefront-cli/display/base_spec.rb +16 -9
- data/spec/wavefront-cli/display/printer/long_spec.rb +75 -106
- data/spec/wavefront-cli/display/printer/terse_spec.rb +33 -21
- data/spec/wavefront-cli/event_spec.rb +1 -0
- data/spec/wavefront-cli/externallink_spec.rb +1 -0
- data/spec/wavefront-cli/integration_spec.rb +1 -0
- data/spec/wavefront-cli/maintenancewindow_spec.rb +1 -0
- data/spec/wavefront-cli/proxy_spec.rb +2 -0
- data/spec/wavefront-cli/query_spec.rb +9 -0
- data/spec/wavefront-cli/resources/display/alert-human-long +24 -0
- data/spec/wavefront-cli/resources/display/alert-input.json +37 -0
- data/spec/wavefront-cli/resources/display/alerts-human-terse +9 -0
- data/spec/wavefront-cli/resources/display/alerts-input.json +1 -0
- data/spec/wavefront-cli/resources/display/user-human-long +19 -0
- data/spec/wavefront-cli/resources/display/user-human-long-no_sep +18 -0
- data/spec/wavefront-cli/resources/display/user-input.json +1 -0
- data/spec/wavefront-cli/resources/responses/README.md +2 -0
- data/spec/wavefront-cli/resources/responses/alert-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/backups.json +1 -0
- data/spec/wavefront-cli/resources/responses/cloudintegration-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/dashboard-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/derivedmetric-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/event-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/integration-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/link-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/notificant-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/proxy-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/query-cpu.json +1 -0
- data/spec/wavefront-cli/resources/responses/savedsearch-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/user-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/usergroup-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/webhook-list.json +1 -0
- data/spec/wavefront-cli/resources/responses/window-list.json +1 -0
- data/spec/wavefront-cli/savedsearch_spec.rb +1 -0
- data/spec/wavefront-cli/settings_spec.rb +19 -0
- data/spec/wavefront-cli/stdlib/array_spec.rb +20 -0
- data/spec/wavefront-cli/stdlib/string_spec.rb +13 -1
- data/spec/wavefront-cli/user_spec.rb +1 -0
- data/spec/wavefront-cli/usergroup_spec.rb +1 -0
- data/spec/wavefront-cli/webhook_spec.rb +1 -0
- data/spec/wavefront-cli/write_spec.rb +167 -0
- data/wavefront-cli.gemspec +3 -4
- metadata +65 -31
- data/.gitlab-ci.yml +0 -16
- data/lib/wavefront-cli/base_write.rb +0 -298
- data/lib/wavefront-cli/commands/report.rb +0 -37
- data/lib/wavefront-cli/display/printer/base.rb +0 -24
- data/lib/wavefront-cli/display/report.rb +0 -17
- data/lib/wavefront-cli/report.rb +0 -18
- data/spec/wavefront-cli/display/printer/base_spec.rb +0 -20
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
require_relative 'base'
|
|
2
|
-
|
|
3
|
-
# Define the report command.
|
|
4
|
-
#
|
|
5
|
-
class WavefrontCommandReport < WavefrontCommandBase
|
|
6
|
-
def description
|
|
7
|
-
'send data directly to Wavefront'
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
def _commands
|
|
11
|
-
["point #{CMN} [-s time] [-H host] [-T tag...] [-iq] <metric> <value>",
|
|
12
|
-
"file #{CMN} [-H host] [-F format] [-m metric] [-T tag...] " \
|
|
13
|
-
'[-iq] <file>']
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def _options
|
|
17
|
-
[common_options,
|
|
18
|
-
'-s, --time=TIME time of data point (omit to use ' \
|
|
19
|
-
'current time)',
|
|
20
|
-
'-H, --host=STRING source host', \
|
|
21
|
-
'-T, --tag=TAG point tag in key=value form',
|
|
22
|
-
'-F, --infileformat=STRING format of input file or stdin',
|
|
23
|
-
'-m, --metric=STRING the metric path to which contents of ' \
|
|
24
|
-
'a file will be assigned. If the file contains a metric name, ' \
|
|
25
|
-
'the two will be dot-concatenated, with this value first',
|
|
26
|
-
'-i, --delta increment metric by given value',
|
|
27
|
-
"-q, --quiet don't report the points sent summary " \
|
|
28
|
-
'(unless there were errors)']
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def postscript
|
|
32
|
-
'Files are whitespace separated, and fields can be defined ' \
|
|
33
|
-
"with the '-F' option. Use 't' for timestamp, 'm' for metric " \
|
|
34
|
-
"name, 'v' for value, 's' for source, and 'T' for tags. Put 'T' " \
|
|
35
|
-
'last.'.cmd_fold(TW, 0)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module WavefrontDisplayPrinter
|
|
2
|
-
#
|
|
3
|
-
# Base class for the two printer classes
|
|
4
|
-
#
|
|
5
|
-
class Base
|
|
6
|
-
attr_reader :out
|
|
7
|
-
|
|
8
|
-
# Give it a key-value hash, and it will return the size of the first
|
|
9
|
-
# column to use when formatting that data.
|
|
10
|
-
#
|
|
11
|
-
# @param hash [Hash] the data for which you need a column width
|
|
12
|
-
# @param pad [Integer] the number of spaces you want between columns
|
|
13
|
-
# @return [Integer] length of longest key + pad
|
|
14
|
-
#
|
|
15
|
-
def key_width(hash = {}, pad = 3)
|
|
16
|
-
return 0 if hash.keys.empty?
|
|
17
|
-
hash.keys.map(&:size).max + pad
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def to_s
|
|
21
|
-
out.join("\n")
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
require_relative 'base'
|
|
2
|
-
|
|
3
|
-
module WavefrontDisplay
|
|
4
|
-
#
|
|
5
|
-
# Format human-readable output when writing points directly to
|
|
6
|
-
# Wavefront.
|
|
7
|
-
#
|
|
8
|
-
class Report < Base
|
|
9
|
-
def do_point
|
|
10
|
-
puts 'Point received.' unless options[:quiet]
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def do_file
|
|
14
|
-
do_point
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
data/lib/wavefront-cli/report.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
require_relative 'base_write'
|
|
2
|
-
|
|
3
|
-
module WavefrontCli
|
|
4
|
-
#
|
|
5
|
-
# Write metrics direct to Wavefront. Sister of WavefrontCli::Write
|
|
6
|
-
#
|
|
7
|
-
class Report < BaseWrite
|
|
8
|
-
def send_point(point)
|
|
9
|
-
call_write(point)
|
|
10
|
-
rescue Wavefront::Exception::InvalidEndpoint
|
|
11
|
-
abort 'could not speak to API'
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def open_connection; end
|
|
15
|
-
|
|
16
|
-
def close_connection; end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require_relative '../../../../lib/wavefront-cli/display/printer/base'
|
|
4
|
-
require_relative '../spec_helper'
|
|
5
|
-
|
|
6
|
-
# Test base class
|
|
7
|
-
#
|
|
8
|
-
class WavefrontDisplayPrinterBase < MiniTest::Test
|
|
9
|
-
attr_reader :wf
|
|
10
|
-
|
|
11
|
-
def setup
|
|
12
|
-
@wf = WavefrontDisplayPrinter::Base.new
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def test_key_width
|
|
16
|
-
assert_equal(wf.key_width, 0)
|
|
17
|
-
assert_equal(wf.key_width(key1: 1, row2: 2, longrow: 3), 10)
|
|
18
|
-
assert_equal(wf.key_width({ key1: 1, row2: 2, longrow: 3 }, 3), 10)
|
|
19
|
-
end
|
|
20
|
-
end
|