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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +16 -0
  3. data/.travis.yml +5 -5
  4. data/HISTORY.md +91 -0
  5. data/README.md +1 -2
  6. data/lib/wavefront-cli/alert.rb +1 -1
  7. data/lib/wavefront-cli/base.rb +1 -1
  8. data/lib/wavefront-cli/base_write.rb +1 -1
  9. data/lib/wavefront-cli/cloudintegration.rb +1 -1
  10. data/lib/wavefront-cli/commands/alert.rb +1 -1
  11. data/lib/wavefront-cli/commands/cloudintegration.rb +1 -1
  12. data/lib/wavefront-cli/commands/dashboard.rb +3 -3
  13. data/lib/wavefront-cli/commands/derivedmetric.rb +48 -0
  14. data/lib/wavefront-cli/commands/event.rb +1 -1
  15. data/lib/wavefront-cli/commands/integration.rb +1 -1
  16. data/lib/wavefront-cli/commands/link.rb +1 -1
  17. data/lib/wavefront-cli/commands/message.rb +1 -1
  18. data/lib/wavefront-cli/commands/metric.rb +1 -1
  19. data/lib/wavefront-cli/commands/notificant.rb +1 -1
  20. data/lib/wavefront-cli/commands/proxy.rb +1 -1
  21. data/lib/wavefront-cli/commands/query.rb +6 -4
  22. data/lib/wavefront-cli/commands/report.rb +1 -1
  23. data/lib/wavefront-cli/commands/savedsearch.rb +1 -1
  24. data/lib/wavefront-cli/commands/source.rb +1 -1
  25. data/lib/wavefront-cli/commands/user.rb +1 -1
  26. data/lib/wavefront-cli/commands/webhook.rb +1 -1
  27. data/lib/wavefront-cli/commands/window.rb +1 -1
  28. data/lib/wavefront-cli/commands/write.rb +1 -1
  29. data/lib/wavefront-cli/controller.rb +3 -3
  30. data/lib/wavefront-cli/dashboard.rb +1 -1
  31. data/lib/wavefront-cli/derivedmetric.rb +53 -0
  32. data/lib/wavefront-cli/display/alert.rb +1 -1
  33. data/lib/wavefront-cli/display/cloudintegration.rb +1 -1
  34. data/lib/wavefront-cli/display/dashboard.rb +1 -1
  35. data/lib/wavefront-cli/display/derivedmetric.rb +14 -0
  36. data/lib/wavefront-cli/display/event.rb +1 -1
  37. data/lib/wavefront-cli/display/externallink.rb +1 -1
  38. data/lib/wavefront-cli/display/integration.rb +1 -1
  39. data/lib/wavefront-cli/display/maintenancewindow.rb +1 -1
  40. data/lib/wavefront-cli/display/message.rb +1 -1
  41. data/lib/wavefront-cli/display/metric.rb +1 -1
  42. data/lib/wavefront-cli/display/notificant.rb +1 -1
  43. data/lib/wavefront-cli/display/printer/long.rb +1 -1
  44. data/lib/wavefront-cli/display/printer/sparkline.rb +54 -0
  45. data/lib/wavefront-cli/display/printer/terse.rb +1 -1
  46. data/lib/wavefront-cli/display/proxy.rb +1 -1
  47. data/lib/wavefront-cli/display/query.rb +30 -21
  48. data/lib/wavefront-cli/display/report.rb +1 -1
  49. data/lib/wavefront-cli/display/savedsearch.rb +1 -1
  50. data/lib/wavefront-cli/display/source.rb +1 -1
  51. data/lib/wavefront-cli/display/user.rb +1 -1
  52. data/lib/wavefront-cli/display/webhook.rb +1 -1
  53. data/lib/wavefront-cli/display/write.rb +1 -1
  54. data/lib/wavefront-cli/event.rb +1 -1
  55. data/lib/wavefront-cli/externallink.rb +1 -1
  56. data/lib/wavefront-cli/integration.rb +1 -1
  57. data/lib/wavefront-cli/maintenancewindow.rb +1 -1
  58. data/lib/wavefront-cli/message.rb +1 -1
  59. data/lib/wavefront-cli/metric.rb +1 -1
  60. data/lib/wavefront-cli/notificant.rb +1 -1
  61. data/lib/wavefront-cli/opt_handler.rb +1 -1
  62. data/lib/wavefront-cli/proxy.rb +1 -1
  63. data/lib/wavefront-cli/query.rb +1 -1
  64. data/lib/wavefront-cli/savedsearch.rb +1 -1
  65. data/lib/wavefront-cli/source.rb +1 -1
  66. data/lib/wavefront-cli/string.rb +13 -6
  67. data/lib/wavefront-cli/user.rb +1 -1
  68. data/lib/wavefront-cli/version.rb +1 -1
  69. data/lib/wavefront-cli/webhook.rb +1 -1
  70. data/spec/spec_helper.rb +16 -16
  71. data/spec/wavefront-cli/commands/alert_spec.rb +1 -1
  72. data/spec/wavefront-cli/commands/base_spec.rb +1 -1
  73. data/spec/wavefront-cli/commands/cloudintegration_spec.rb +1 -1
  74. data/spec/wavefront-cli/commands/dashboard_spec.rb +1 -1
  75. data/spec/wavefront-cli/commands/derivedmetric_spec.rb +16 -0
  76. data/spec/wavefront-cli/commands/event_spec.rb +1 -1
  77. data/spec/wavefront-cli/commands/link_spec.rb +1 -1
  78. data/spec/wavefront-cli/commands/message_spec.rb +1 -1
  79. data/spec/wavefront-cli/commands/metric_spec.rb +1 -1
  80. data/spec/wavefront-cli/commands/proxy_spec.rb +1 -1
  81. data/spec/wavefront-cli/commands/query_spec.rb +1 -1
  82. data/spec/wavefront-cli/commands/webhook_spec.rb +1 -1
  83. data/spec/wavefront-cli/commands/window_spec.rb +1 -1
  84. data/spec/wavefront-cli/commands/write_spec.rb +1 -1
  85. data/spec/wavefront-cli/derivedmetric_spec.rb +79 -0
  86. data/spec/wavefront-cli/display/base_spec.rb +1 -1
  87. data/spec/wavefront-cli/string_spec.rb +1 -1
  88. data/wavefront-cli.gemspec +1 -1
  89. metadata +17 -8
  90. data/lib/wavefront-cli/output/wavefront.tf +0 -257
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 903c8e5083d5ea318618590cf9e366f451e6cf044037c9771791dd647703ec68
4
- data.tar.gz: 7e4fe291218861044b5d117806eaecc17457da88079704fc3394eaebfcfabeca
3
+ metadata.gz: 367f4cd2831b3bb22eeae430ab3b3bd9f065d847a68b59f7f6ecafa39c46c156
4
+ data.tar.gz: 11e4a86ec0ed8134ce921b237a068cc2910e01b600becef4d35f7a49d35e3564
5
5
  SHA512:
6
- metadata.gz: eb2afd54929d82f8f97dfee37de753f8c25d4e9f4f31c8413e174446f0d90264122b1002162b3beab2ce0f0caaddf52d029a71ca61a3178b4a99c4e698626761
7
- data.tar.gz: 234cb0155c0abaffac24583945bdd4311d049dfec3788f5961fdc579de9339fc6ef4033c83cbdac92e7e7e7301ab7a453178e5ae94137f9ba0d1d212e3d02a6f
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.9
5
- - 2.3.6
6
- - 2.4.3
7
- - 2.5.0
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.3.6
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) [![Dependency Status](https://gemnasium.com/badges/github.com/snltd/wavefront-cli.svg)](https://gemnasium.com/github.com/snltd/wavefront-cli) [![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)
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
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  module WavefrontCli
4
4
  #
@@ -1,7 +1,7 @@
1
1
  require 'yaml'
2
2
  require 'json'
3
3
  require 'wavefront-sdk/validators'
4
- require_relative './exception'
4
+ require_relative 'exception'
5
5
 
6
6
  module WavefrontCli
7
7
  #
@@ -1,5 +1,5 @@
1
1
  require 'wavefront-sdk/mixins'
2
- require_relative './base'
2
+ require_relative 'base'
3
3
 
4
4
  module WavefrontCli
5
5
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  module WavefrontCli
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the Alert command
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the cloud integration command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
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] [-F] <file>",
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} [-b] [-f format] [-o offset] [-L limit] <id>",
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 './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the event command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the cloud integration command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the external link command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the message command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the metric command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the notificant command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the proxy command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
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
- '[-ivO] [-S mode] [-N name] [-p points] <query>',
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
- '[-ivO] [-S mode] [-N name] [-p points] <alias>']
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
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the report command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the saved search command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the source command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the user command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the webhook command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the maintenance window command.
4
4
  #
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  # Define the write command.
4
4
  #
@@ -12,9 +12,9 @@ end
12
12
  require 'pathname'
13
13
  require 'pp'
14
14
  require 'docopt'
15
- require_relative './version'
16
- require_relative './exception'
17
- require_relative './opt_handler'
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
 
@@ -1,4 +1,4 @@
1
- require_relative './base'
1
+ require_relative 'base'
2
2
 
3
3
  module WavefrontCli
4
4
  #
@@ -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