wavefront-cli 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +16 -0
- data/.travis.yml +5 -5
- data/HISTORY.md +91 -0
- data/README.md +1 -2
- data/lib/wavefront-cli/alert.rb +1 -1
- data/lib/wavefront-cli/base.rb +1 -1
- data/lib/wavefront-cli/base_write.rb +1 -1
- data/lib/wavefront-cli/cloudintegration.rb +1 -1
- data/lib/wavefront-cli/commands/alert.rb +1 -1
- data/lib/wavefront-cli/commands/cloudintegration.rb +1 -1
- data/lib/wavefront-cli/commands/dashboard.rb +3 -3
- data/lib/wavefront-cli/commands/derivedmetric.rb +48 -0
- data/lib/wavefront-cli/commands/event.rb +1 -1
- data/lib/wavefront-cli/commands/integration.rb +1 -1
- data/lib/wavefront-cli/commands/link.rb +1 -1
- data/lib/wavefront-cli/commands/message.rb +1 -1
- data/lib/wavefront-cli/commands/metric.rb +1 -1
- data/lib/wavefront-cli/commands/notificant.rb +1 -1
- data/lib/wavefront-cli/commands/proxy.rb +1 -1
- data/lib/wavefront-cli/commands/query.rb +6 -4
- data/lib/wavefront-cli/commands/report.rb +1 -1
- data/lib/wavefront-cli/commands/savedsearch.rb +1 -1
- data/lib/wavefront-cli/commands/source.rb +1 -1
- data/lib/wavefront-cli/commands/user.rb +1 -1
- data/lib/wavefront-cli/commands/webhook.rb +1 -1
- data/lib/wavefront-cli/commands/window.rb +1 -1
- data/lib/wavefront-cli/commands/write.rb +1 -1
- data/lib/wavefront-cli/controller.rb +3 -3
- data/lib/wavefront-cli/dashboard.rb +1 -1
- data/lib/wavefront-cli/derivedmetric.rb +53 -0
- data/lib/wavefront-cli/display/alert.rb +1 -1
- data/lib/wavefront-cli/display/cloudintegration.rb +1 -1
- data/lib/wavefront-cli/display/dashboard.rb +1 -1
- data/lib/wavefront-cli/display/derivedmetric.rb +14 -0
- data/lib/wavefront-cli/display/event.rb +1 -1
- data/lib/wavefront-cli/display/externallink.rb +1 -1
- data/lib/wavefront-cli/display/integration.rb +1 -1
- data/lib/wavefront-cli/display/maintenancewindow.rb +1 -1
- data/lib/wavefront-cli/display/message.rb +1 -1
- data/lib/wavefront-cli/display/metric.rb +1 -1
- data/lib/wavefront-cli/display/notificant.rb +1 -1
- data/lib/wavefront-cli/display/printer/long.rb +1 -1
- data/lib/wavefront-cli/display/printer/sparkline.rb +54 -0
- data/lib/wavefront-cli/display/printer/terse.rb +1 -1
- data/lib/wavefront-cli/display/proxy.rb +1 -1
- data/lib/wavefront-cli/display/query.rb +30 -21
- data/lib/wavefront-cli/display/report.rb +1 -1
- data/lib/wavefront-cli/display/savedsearch.rb +1 -1
- data/lib/wavefront-cli/display/source.rb +1 -1
- data/lib/wavefront-cli/display/user.rb +1 -1
- data/lib/wavefront-cli/display/webhook.rb +1 -1
- data/lib/wavefront-cli/display/write.rb +1 -1
- data/lib/wavefront-cli/event.rb +1 -1
- data/lib/wavefront-cli/externallink.rb +1 -1
- data/lib/wavefront-cli/integration.rb +1 -1
- data/lib/wavefront-cli/maintenancewindow.rb +1 -1
- data/lib/wavefront-cli/message.rb +1 -1
- data/lib/wavefront-cli/metric.rb +1 -1
- data/lib/wavefront-cli/notificant.rb +1 -1
- data/lib/wavefront-cli/opt_handler.rb +1 -1
- data/lib/wavefront-cli/proxy.rb +1 -1
- data/lib/wavefront-cli/query.rb +1 -1
- data/lib/wavefront-cli/savedsearch.rb +1 -1
- data/lib/wavefront-cli/source.rb +1 -1
- data/lib/wavefront-cli/string.rb +13 -6
- data/lib/wavefront-cli/user.rb +1 -1
- data/lib/wavefront-cli/version.rb +1 -1
- data/lib/wavefront-cli/webhook.rb +1 -1
- data/spec/spec_helper.rb +16 -16
- data/spec/wavefront-cli/commands/alert_spec.rb +1 -1
- data/spec/wavefront-cli/commands/base_spec.rb +1 -1
- data/spec/wavefront-cli/commands/cloudintegration_spec.rb +1 -1
- data/spec/wavefront-cli/commands/dashboard_spec.rb +1 -1
- data/spec/wavefront-cli/commands/derivedmetric_spec.rb +16 -0
- data/spec/wavefront-cli/commands/event_spec.rb +1 -1
- data/spec/wavefront-cli/commands/link_spec.rb +1 -1
- data/spec/wavefront-cli/commands/message_spec.rb +1 -1
- data/spec/wavefront-cli/commands/metric_spec.rb +1 -1
- data/spec/wavefront-cli/commands/proxy_spec.rb +1 -1
- data/spec/wavefront-cli/commands/query_spec.rb +1 -1
- data/spec/wavefront-cli/commands/webhook_spec.rb +1 -1
- data/spec/wavefront-cli/commands/window_spec.rb +1 -1
- data/spec/wavefront-cli/commands/write_spec.rb +1 -1
- data/spec/wavefront-cli/derivedmetric_spec.rb +79 -0
- data/spec/wavefront-cli/display/base_spec.rb +1 -1
- data/spec/wavefront-cli/string_spec.rb +1 -1
- data/wavefront-cli.gemspec +1 -1
- metadata +17 -8
- data/lib/wavefront-cli/output/wavefront.tf +0 -257
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 367f4cd2831b3bb22eeae430ab3b3bd9f065d847a68b59f7f6ecafa39c46c156
|
4
|
+
data.tar.gz: 11e4a86ec0ed8134ce921b237a068cc2910e01b600becef4d35f7a49d35e3564
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: faa0fecdf792a026db31353defb49e24cd5e72e8ff2d8702aa38846dd31af53abad50f9c79bed30ccb00b323196e9d9ba5da2f53c9318066dfd731898f93cafb
|
7
|
+
data.tar.gz: c6febba432e3dff6aa0a5125fd1b366dbcb59d9f056ca6f2924366b9dd9f01eb64423d4385488fbdc695649010c75f448f59e173d5333f737c6d26809a14ef3c
|
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
dependency_scanning:
|
2
|
+
image: docker:stable
|
3
|
+
variables:
|
4
|
+
DOCKER_DRIVER: overlay2
|
5
|
+
allow_failure: true
|
6
|
+
services:
|
7
|
+
- docker:stable-dind
|
8
|
+
script:
|
9
|
+
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
10
|
+
- docker run
|
11
|
+
--env DEP_SCAN_DISABLE_REMOTE_CHECKS="${DEP_SCAN_DISABLE_REMOTE_CHECKS:-false}"
|
12
|
+
--volume "$PWD:/code"
|
13
|
+
--volume /var/run/docker.sock:/var/run/docker.sock
|
14
|
+
"registry.gitlab.com/gitlab-org/security-products/dependency-scanning:$SP_VERSION" /code
|
15
|
+
artifacts:
|
16
|
+
paths: [gl-dependency-scanning-report.json]
|
data/.travis.yml
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
cache: bundler
|
3
3
|
rvm:
|
4
|
-
- 2.2.
|
5
|
-
- 2.3.
|
6
|
-
- 2.4.
|
7
|
-
- 2.5.
|
4
|
+
- 2.2.10
|
5
|
+
- 2.3.7
|
6
|
+
- 2.4.4
|
7
|
+
- 2.5.1
|
8
8
|
before_install: gem install bundler --no-rdoc --no-ri
|
9
9
|
deploy:
|
10
10
|
provider: rubygems
|
@@ -14,7 +14,7 @@ deploy:
|
|
14
14
|
on:
|
15
15
|
tags: true
|
16
16
|
repo: snltd/wavefront-cli
|
17
|
-
ruby: 2.
|
17
|
+
ruby: 2.5.1
|
18
18
|
notifications:
|
19
19
|
email: false
|
20
20
|
slack:
|
data/HISTORY.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 2.5.0
|
4
|
+
|
5
|
+
* Support [derived
|
6
|
+
metrics](https://docs.wavefront.com/derived_metrics.html).
|
7
|
+
* Remove options which were not actually supported.
|
8
|
+
* Smarter formatting of help pages.
|
9
|
+
* Pass API warnings through the the user on `query` commands.
|
10
|
+
* Add Unicode sparklines to `query` output.
|
11
|
+
* Better formatting of `query` output.
|
12
|
+
* Remove obsolete code and test files.
|
13
|
+
|
14
|
+
## 2.4.0 (10/04/2017)
|
15
|
+
|
16
|
+
* Support direct data ingestion via `report` command.
|
17
|
+
* Support writing delta metrics.
|
18
|
+
* Add `-q` to silenty write data points.
|
19
|
+
* Export alerts, alert targets and dashboards in HCL format, for
|
20
|
+
easy integration with [Space Ape's
|
21
|
+
Terraform
|
22
|
+
provider](https://github.com/spaceapegames/terraform-provider-wavefront).
|
23
|
+
|
24
|
+
## 2.3.1 (24/03/2017)
|
25
|
+
|
26
|
+
* Fix broken handling of negative values in `write` command.
|
27
|
+
|
28
|
+
## 2.3.0 (23/02/2017)
|
29
|
+
|
30
|
+
* Add query aliases.
|
31
|
+
|
32
|
+
## 2.2.0 (18/02/2017)
|
33
|
+
|
34
|
+
* Add `alert firing` and `alert snoozed` subcommands.
|
35
|
+
|
36
|
+
## 2.1.6 (11/01/2017)
|
37
|
+
|
38
|
+
* Correctly handle `=` characters in `update` subcommands.
|
39
|
+
|
40
|
+
## 2.1.5 (05/12/2017)
|
41
|
+
|
42
|
+
* Allow the user to tag events when they are created.
|
43
|
+
|
44
|
+
## 2.1.4 (15/11/2017)
|
45
|
+
|
46
|
+
* `event create` bugfix.
|
47
|
+
|
48
|
+
## 2.1.3 (31/10/2017)
|
49
|
+
|
50
|
+
* Use credential mechanism from SDK instead of rolling our own.
|
51
|
+
* Fix bug which ignored supposedly supported environment variables,
|
52
|
+
and add support for more.
|
53
|
+
* Cut dead wood out of codebase.
|
54
|
+
* Eradicate build warnings.
|
55
|
+
|
56
|
+
## 2.1.2 (31/10/2017)
|
57
|
+
|
58
|
+
* Fix no-op bug.
|
59
|
+
* Add BSD license.
|
60
|
+
|
61
|
+
## 2.1.1 (12/10/2017)
|
62
|
+
|
63
|
+
* Fix bug in relative time specifications.
|
64
|
+
|
65
|
+
## 2.1.0 (12/10/2017)
|
66
|
+
|
67
|
+
* Allow users to specify relative times, like `-10m`.
|
68
|
+
|
69
|
+
## 2.0.0 (09/10/2017)
|
70
|
+
|
71
|
+
* Support viewing and managing of integrations.
|
72
|
+
* Support notificants. (AKA alert targets).
|
73
|
+
* Support new source descriptions.
|
74
|
+
* Breaking change in `source` command.
|
75
|
+
|
76
|
+
## 1.0.3 (25/08/2017)
|
77
|
+
|
78
|
+
* Fix nil tag bug in terse source listing.
|
79
|
+
|
80
|
+
## 1.0.2 (04/08/2017)
|
81
|
+
|
82
|
+
* Greatly improve support for maintenance windows. They can now be
|
83
|
+
extended, shrunk, and closed and created on the fly.
|
84
|
+
|
85
|
+
## 1.0.1 (31/07/2017)
|
86
|
+
|
87
|
+
* Report `no data` if a query returns no data.
|
88
|
+
|
89
|
+
## 1.0.0 (28/07/2017)
|
90
|
+
|
91
|
+
* First official release.
|
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# Wavefront CLI
|
2
|
-
[![Build Status](https://travis-ci.org/snltd/wavefront-cli.svg?branch=master)](https://travis-ci.org/snltd/wavefront-cli) [![Maintainability](https://api.codeclimate.com/v1/badges/9b712047af0b2dafc146/maintainability)](https://codeclimate.com/github/snltd/wavefront-cli/maintainability) [![
|
3
|
-
|
2
|
+
[![Build Status](https://travis-ci.org/snltd/wavefront-cli.svg?branch=master)](https://travis-ci.org/snltd/wavefront-cli) [![Maintainability](https://api.codeclimate.com/v1/badges/9b712047af0b2dafc146/maintainability)](https://codeclimate.com/github/snltd/wavefront-cli/maintainability) [![Gem Version](https://badge.fury.io/rb/wavefront-cli.svg)](https://badge.fury.io/rb/wavefront-cli) ![](http://ruby-gem-downloads-badge.herokuapp.com/wavefront-cli?type=total)
|
4
3
|
|
5
4
|
This package provides a command-line interface to
|
6
5
|
[Wavefront](https://www.wavefront.com/)'s API. Each API path
|
data/lib/wavefront-cli/alert.rb
CHANGED
data/lib/wavefront-cli/base.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'base'
|
2
2
|
|
3
3
|
# Define the dashboard command.
|
4
4
|
#
|
@@ -10,11 +10,11 @@ class WavefrontCommandDashboard < WavefrontCommandBase
|
|
10
10
|
def _commands
|
11
11
|
["list #{CMN} [-l] [-f format] [-o offset] [-L limit]",
|
12
12
|
"describe #{CMN} [-f format] [-v version] <id>",
|
13
|
-
"import #{CMN} [-f format]
|
13
|
+
"import #{CMN} [-f format] <file>",
|
14
14
|
"update #{CMN} <key=value> <id>",
|
15
15
|
"delete #{CMN} <id>",
|
16
16
|
"undelete #{CMN} <id>",
|
17
|
-
"history #{CMN} [-
|
17
|
+
"history #{CMN} [-f format] [-o offset] [-L limit] <id>",
|
18
18
|
"search #{CMN} [-f format] [-o offset] [-L limit] [-l] <condition>...",
|
19
19
|
tag_commands]
|
20
20
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
# Define the derivedmetric command.
|
4
|
+
#
|
5
|
+
class WavefrontCommandDerivedmetric < WavefrontCommandBase
|
6
|
+
def description
|
7
|
+
'view and manage derived metrics'
|
8
|
+
end
|
9
|
+
|
10
|
+
def sdk_file
|
11
|
+
'derivedmetric'
|
12
|
+
end
|
13
|
+
|
14
|
+
def sdk_class
|
15
|
+
'DerivedMetric'
|
16
|
+
end
|
17
|
+
|
18
|
+
def _commands
|
19
|
+
["list #{CMN} [-l] [-f format] [-o offset] [-L limit]",
|
20
|
+
"describe #{CMN} [-f format] [-v version] <id>",
|
21
|
+
"create #{CMN} [-d description] [-T tag...] [-O] [-i interval] " \
|
22
|
+
'[-r range] <name> <query>',
|
23
|
+
"import #{CMN} [-f format] <file>",
|
24
|
+
"update #{CMN} <key=value> <id>",
|
25
|
+
"delete #{CMN} <id>",
|
26
|
+
"undelete #{CMN} <id>",
|
27
|
+
"history #{CMN} [-f format] [-o offset] [-L limit] <id>",
|
28
|
+
"search #{CMN} [-f format] [-o offset] [-L limit] [-l] <condition>...",
|
29
|
+
tag_commands]
|
30
|
+
end
|
31
|
+
|
32
|
+
def _options
|
33
|
+
[common_options,
|
34
|
+
'-l, --long list derived metrics in detail',
|
35
|
+
'-o, --offset=n start list from nth derived metrics or ' \
|
36
|
+
'revision',
|
37
|
+
'-L, --limit=COUNT number of derived metrics or revisions to ' \
|
38
|
+
'list',
|
39
|
+
'-v, --version=INTEGER version of derived metrics',
|
40
|
+
'-O, --obsolete include obsolete metrics',
|
41
|
+
'-T, --ctag=STRING add customer tag',
|
42
|
+
'-d, --desc=STRING additional information about query',
|
43
|
+
'-i, --interval=INTEGER execute query every n minutes [default: 1]',
|
44
|
+
'-r, --range=INTEGER include results in the last n minutes ' \
|
45
|
+
'[default: 5]',
|
46
|
+
'-f, --format=STRING output format']
|
47
|
+
end
|
48
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'base'
|
2
2
|
|
3
3
|
# Define the query command.
|
4
4
|
#
|
@@ -10,10 +10,10 @@ class WavefrontCommandQuery < WavefrontCommandBase
|
|
10
10
|
def _commands
|
11
11
|
['aliases [-DV] [-c file] [-P profile]',
|
12
12
|
"#{CMN} [-g granularity] [-s time] [-e time] [-f format] " \
|
13
|
-
'[-
|
13
|
+
'[-WikvO] [-S mode] [-N name] [-p points] <query>',
|
14
14
|
"raw #{CMN} [-H host] [-s time] [-e time] [-f format] <metric>",
|
15
15
|
"run #{CMN} [-g granularity] [-s time] [-e time] [-f format] " \
|
16
|
-
'[-
|
16
|
+
'[-WkivO] [-S mode] [-N name] [-p points] <alias>']
|
17
17
|
end
|
18
18
|
|
19
19
|
def _options
|
@@ -30,6 +30,8 @@ class WavefrontCommandQuery < WavefrontCommandBase
|
|
30
30
|
'points (mean, median, min, max, sum, count, last, first)',
|
31
31
|
'-O, --obsolete include metrics unreported for > 4 weeks',
|
32
32
|
'-H, --host=STRING host or source to query on',
|
33
|
-
'-f, --format=STRING output format'
|
33
|
+
'-f, --format=STRING output format',
|
34
|
+
'-k, --nospark do not show sparkline',
|
35
|
+
'-W, --nowarn do not show API warning messages']
|
34
36
|
end
|
35
37
|
end
|
@@ -12,9 +12,9 @@ end
|
|
12
12
|
require 'pathname'
|
13
13
|
require 'pp'
|
14
14
|
require 'docopt'
|
15
|
-
require_relative '
|
16
|
-
require_relative '
|
17
|
-
require_relative '
|
15
|
+
require_relative 'version'
|
16
|
+
require_relative 'exception'
|
17
|
+
require_relative 'opt_handler'
|
18
18
|
|
19
19
|
CMD_DIR = Pathname.new(__FILE__).dirname + 'commands'
|
20
20
|
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
module WavefrontCli
|
4
|
+
#
|
5
|
+
# CLI coverage for the v2 'derivedmetric' API.
|
6
|
+
#
|
7
|
+
class DerivedMetric < WavefrontCli::Base
|
8
|
+
def validator_exception
|
9
|
+
Wavefront::Exception::InvalidDerivedMetricId
|
10
|
+
end
|
11
|
+
|
12
|
+
def do_describe
|
13
|
+
wf.describe(options[:'<id>'], options[:version])
|
14
|
+
end
|
15
|
+
|
16
|
+
def do_delete
|
17
|
+
word = if wf.describe(options[:'<id>']).status.code == 200
|
18
|
+
'Soft'
|
19
|
+
else
|
20
|
+
'Permanently'
|
21
|
+
end
|
22
|
+
|
23
|
+
puts format('%s deleting derived metric definition %s', word,
|
24
|
+
options[:'<id>'])
|
25
|
+
|
26
|
+
wf.delete(options[:'<id>'])
|
27
|
+
end
|
28
|
+
|
29
|
+
def do_history
|
30
|
+
wf.history(options[:'<id>'])
|
31
|
+
end
|
32
|
+
|
33
|
+
def do_create
|
34
|
+
wf.create(build_body)
|
35
|
+
end
|
36
|
+
|
37
|
+
def build_body
|
38
|
+
ret = { query: options[:'<query>'],
|
39
|
+
name: options[:'<name>'],
|
40
|
+
minutes: options[:range].to_i,
|
41
|
+
includeObsoleteMetrics: options[:obsolete],
|
42
|
+
processRateMinutes: options[:interval].to_i }
|
43
|
+
|
44
|
+
ret[:additionalInformation] = options[:desc] if options[:desc]
|
45
|
+
ret[:tags] = options[:ctag] if valid_tags?
|
46
|
+
ret
|
47
|
+
end
|
48
|
+
|
49
|
+
def valid_tags?
|
50
|
+
!options[:ctag].empty? && validate_tags(options[:ctag])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|