wavefront-cli 2.18.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +7 -0
  4. data/.travis.yml +4 -5
  5. data/HISTORY.md +20 -1
  6. data/README.md +79 -29
  7. data/lib/wavefront-cli/base.rb +26 -2
  8. data/lib/wavefront-cli/commands/alert.rb +10 -10
  9. data/lib/wavefront-cli/commands/base.rb +15 -2
  10. data/lib/wavefront-cli/commands/cloudintegration.rb +3 -3
  11. data/lib/wavefront-cli/commands/config.rb +2 -1
  12. data/lib/wavefront-cli/commands/dashboard.rb +8 -6
  13. data/lib/wavefront-cli/commands/derivedmetric.rb +5 -5
  14. data/lib/wavefront-cli/commands/event.rb +3 -3
  15. data/lib/wavefront-cli/commands/integration.rb +5 -5
  16. data/lib/wavefront-cli/commands/link.rb +3 -3
  17. data/lib/wavefront-cli/commands/message.rb +2 -2
  18. data/lib/wavefront-cli/commands/metric.rb +1 -1
  19. data/lib/wavefront-cli/commands/notificant.rb +3 -3
  20. data/lib/wavefront-cli/commands/proxy.rb +3 -3
  21. data/lib/wavefront-cli/commands/query.rb +3 -3
  22. data/lib/wavefront-cli/commands/savedsearch.rb +3 -3
  23. data/lib/wavefront-cli/commands/settings.rb +22 -0
  24. data/lib/wavefront-cli/commands/source.rb +3 -3
  25. data/lib/wavefront-cli/commands/user.rb +4 -4
  26. data/lib/wavefront-cli/commands/usergroup.rb +5 -8
  27. data/lib/wavefront-cli/commands/webhook.rb +3 -3
  28. data/lib/wavefront-cli/commands/window.rb +3 -3
  29. data/lib/wavefront-cli/commands/write.rb +6 -4
  30. data/lib/wavefront-cli/config.rb +14 -0
  31. data/lib/wavefront-cli/controller.rb +2 -0
  32. data/lib/wavefront-cli/dashboard.rb +133 -14
  33. data/lib/wavefront-cli/display/base.rb +28 -7
  34. data/lib/wavefront-cli/display/dashboard.rb +32 -8
  35. data/lib/wavefront-cli/display/distribution.rb +4 -1
  36. data/lib/wavefront-cli/display/printer/long.rb +149 -140
  37. data/lib/wavefront-cli/display/printer/terse.rb +19 -42
  38. data/lib/wavefront-cli/display/query.rb +6 -0
  39. data/lib/wavefront-cli/display/settings.rb +21 -0
  40. data/lib/wavefront-cli/display/write.rb +12 -5
  41. data/lib/wavefront-cli/event.rb +1 -1
  42. data/lib/wavefront-cli/exception.rb +1 -0
  43. data/lib/wavefront-cli/settings.rb +37 -0
  44. data/lib/wavefront-cli/stdlib/array.rb +20 -0
  45. data/lib/wavefront-cli/stdlib/string.rb +8 -0
  46. data/lib/wavefront-cli/user.rb +1 -1
  47. data/lib/wavefront-cli/version.rb +1 -1
  48. data/lib/wavefront-cli/write.rb +310 -10
  49. data/spec/.rubocop.yml +3 -0
  50. data/spec/spec_helper.rb +81 -1
  51. data/spec/wavefront-cli/alert_spec.rb +1 -0
  52. data/spec/wavefront-cli/cloudintegration_spec.rb +1 -0
  53. data/spec/wavefront-cli/dashboard_spec.rb +47 -4
  54. data/spec/wavefront-cli/derivedmetric_spec.rb +1 -0
  55. data/spec/wavefront-cli/display/base_spec.rb +16 -9
  56. data/spec/wavefront-cli/display/printer/long_spec.rb +75 -106
  57. data/spec/wavefront-cli/display/printer/terse_spec.rb +33 -21
  58. data/spec/wavefront-cli/event_spec.rb +1 -0
  59. data/spec/wavefront-cli/externallink_spec.rb +1 -0
  60. data/spec/wavefront-cli/integration_spec.rb +1 -0
  61. data/spec/wavefront-cli/maintenancewindow_spec.rb +1 -0
  62. data/spec/wavefront-cli/proxy_spec.rb +2 -0
  63. data/spec/wavefront-cli/query_spec.rb +9 -0
  64. data/spec/wavefront-cli/resources/display/alert-human-long +24 -0
  65. data/spec/wavefront-cli/resources/display/alert-input.json +37 -0
  66. data/spec/wavefront-cli/resources/display/alerts-human-terse +9 -0
  67. data/spec/wavefront-cli/resources/display/alerts-input.json +1 -0
  68. data/spec/wavefront-cli/resources/display/user-human-long +19 -0
  69. data/spec/wavefront-cli/resources/display/user-human-long-no_sep +18 -0
  70. data/spec/wavefront-cli/resources/display/user-input.json +1 -0
  71. data/spec/wavefront-cli/resources/responses/README.md +2 -0
  72. data/spec/wavefront-cli/resources/responses/alert-list.json +1 -0
  73. data/spec/wavefront-cli/resources/responses/backups.json +1 -0
  74. data/spec/wavefront-cli/resources/responses/cloudintegration-list.json +1 -0
  75. data/spec/wavefront-cli/resources/responses/dashboard-list.json +1 -0
  76. data/spec/wavefront-cli/resources/responses/derivedmetric-list.json +1 -0
  77. data/spec/wavefront-cli/resources/responses/event-list.json +1 -0
  78. data/spec/wavefront-cli/resources/responses/integration-list.json +1 -0
  79. data/spec/wavefront-cli/resources/responses/link-list.json +1 -0
  80. data/spec/wavefront-cli/resources/responses/notificant-list.json +1 -0
  81. data/spec/wavefront-cli/resources/responses/proxy-list.json +1 -0
  82. data/spec/wavefront-cli/resources/responses/query-cpu.json +1 -0
  83. data/spec/wavefront-cli/resources/responses/savedsearch-list.json +1 -0
  84. data/spec/wavefront-cli/resources/responses/user-list.json +1 -0
  85. data/spec/wavefront-cli/resources/responses/usergroup-list.json +1 -0
  86. data/spec/wavefront-cli/resources/responses/webhook-list.json +1 -0
  87. data/spec/wavefront-cli/resources/responses/window-list.json +1 -0
  88. data/spec/wavefront-cli/savedsearch_spec.rb +1 -0
  89. data/spec/wavefront-cli/settings_spec.rb +19 -0
  90. data/spec/wavefront-cli/stdlib/array_spec.rb +20 -0
  91. data/spec/wavefront-cli/stdlib/string_spec.rb +13 -1
  92. data/spec/wavefront-cli/user_spec.rb +1 -0
  93. data/spec/wavefront-cli/usergroup_spec.rb +1 -0
  94. data/spec/wavefront-cli/webhook_spec.rb +1 -0
  95. data/spec/wavefront-cli/write_spec.rb +167 -0
  96. data/wavefront-cli.gemspec +3 -4
  97. metadata +65 -31
  98. data/.gitlab-ci.yml +0 -16
  99. data/lib/wavefront-cli/base_write.rb +0 -298
  100. data/lib/wavefront-cli/commands/report.rb +0 -37
  101. data/lib/wavefront-cli/display/printer/base.rb +0 -24
  102. data/lib/wavefront-cli/display/report.rb +0 -17
  103. data/lib/wavefront-cli/report.rb +0 -18
  104. data/spec/wavefront-cli/display/printer/base_spec.rb +0 -20
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative '../../../../lib/wavefront-cli/display/printer/terse'
4
4
  require_relative '../spec_helper'
5
+ require_relative '../../../spec_helper'
5
6
 
6
7
  TERSE_DATA = [{ id: 'id1', name: 'name1', fa: 1, fb: 2, fc: 3 },
7
8
  { id: 'id2', name: 'name2', fa: 11, fb: 21, fc: 31 }].freeze
@@ -9,38 +10,49 @@ TERSE_DATA = [{ id: 'id1', name: 'name1', fa: 1, fb: 2, fc: 3 },
9
10
  # Test terse printer
10
11
  #
11
12
  class WavefrontDisplayPrinterTerse < MiniTest::Test
12
- attr_reader :wf
13
+ attr_reader :wf, :out
13
14
 
14
15
  def setup
15
- @wf = WavefrontDisplayPrinter::Terse.new(TERSE_DATA, :id, :name)
16
+ @wf = WavefrontDisplayPrinter::Terse.new(TERSE_DATA, %i[id name])
16
17
  end
17
18
 
18
- def test_format_string
19
- assert_equal(wf.fmt_string, '%-3s %-5s')
19
+ def test_fmt
20
+ assert_equal('%-3<id>s', wf.format_string(TERSE_DATA, [:id]))
21
+ assert_equal('%-3<id>s %-5<name>s',
22
+ wf.format_string(TERSE_DATA, %i[id name]))
23
+ assert_equal('%-5<name>s', wf.format_string(TERSE_DATA, [:name]))
20
24
  end
21
25
 
22
- def test_longest_keys
23
- assert_equal(wf.longest_keys, id: 3, name: 5)
26
+ def test_to_s
27
+ assert_equal("id1 name1\nid2 name2", wf.to_s)
28
+ input = [{ id: 'id1', names: %w[Rob Robert], num: 67 },
29
+ { id: 'id2', names: %w[Katharine Kate], num: 3 }]
30
+
31
+ wf2 = WavefrontDisplayPrinter::Terse.new(input, %i[id names num])
32
+ assert_equal("id1 Rob, Robert 67\nid2 Katharine, Kate 3",
33
+ wf2.to_s)
34
+
35
+ wf3 = WavefrontDisplayPrinter::Terse.new(input, %i[id names])
36
+ assert_equal("id1 Rob, Robert\nid2 Katharine, Kate", wf3.to_s)
24
37
  end
25
38
 
26
- def test_prep_output_1
27
- x = wf.prep_output
28
- assert_equal(x[0], 'id1 name1')
29
- assert_equal(x[1], 'id2 name2')
39
+ def test_stringify
40
+ assert_equal([{ id: 'id1', things: 'a, b, c', num: 5 },
41
+ { id: 'id2', things: 'letters', num: 3 }],
42
+ wf.stringify([{ id: 'id1', things: %w[a b c], num: 5 },
43
+ { id: 'id2', things: 'letters', num: 3 }],
44
+ [:things]))
30
45
  end
31
46
 
32
- def test_prep_output_2
33
- wf.instance_variable_set(:@fmt_string, '%-10s %-100s')
34
- wf.instance_variable_set(:@keys, %i[name fb])
35
- x = wf.prep_output
36
- assert_equal(x[0], 'name1 2')
37
- assert_equal(x[1], 'name2 21')
47
+ def test_to_list
48
+ assert_equal('a, b, c', wf.to_list(%w[a b c]))
49
+ assert_equal('abc', wf.to_list('abc'))
38
50
  end
39
51
 
40
- def test_prep_output_3
41
- wf.instance_variable_set(:@keys, %i[name nokey])
42
- x = wf.prep_output
43
- assert_equal(x[0], 'name1')
44
- assert_equal(x[1], 'name2')
52
+ def test_end_to_end
53
+ input, expected = OUTPUT_TESTER.in_and_out('alerts-input.json',
54
+ 'alerts-human-terse')
55
+ out = WavefrontDisplayPrinter::Terse.new(input, %i[id status name]).to_s
56
+ assert_equal(expected, out + "\n")
45
57
  end
46
58
  end
@@ -25,4 +25,5 @@ describe "#{word} command" do
25
25
  matchingMethod: 'EXACT' }],
26
26
  sort: { field: 'id', ascending: true } },
27
27
  headers: JSON_POST_HEADERS)
28
+ test_list_output(word)
28
29
  end
@@ -68,4 +68,5 @@ describe "#{word} command" do
68
68
  }.to_json,
69
69
  headers: JSON_POST_HEADERS },
70
70
  WavefrontCli::ExternalLink)
71
+ test_list_output(word, k)
71
72
  end
@@ -41,4 +41,5 @@ describe "#{word} command" do
41
41
  "alert install #{bad_id}",
42
42
  "alert uninstall #{bad_id}",
43
43
  "uninstall #{bad_id}", "status #{bad_id}"])
44
+ test_list_output(word)
44
45
  end
@@ -34,4 +34,5 @@ describe "#{word} command" do
34
34
  },
35
35
  headers: JSON_POST_HEADERS },
36
36
  WavefrontCli::MaintenanceWindow)
37
+ test_list_output(word, k)
37
38
  end
@@ -34,4 +34,6 @@ describe "#{word} command" do
34
34
  matchingMethod: 'EXACT' }],
35
35
  sort: { field: 'id', ascending: true } },
36
36
  headers: JSON_POST_HEADERS)
37
+
38
+ test_list_output(word)
37
39
  end
@@ -91,6 +91,15 @@ describe "#{word} command" do
91
91
  "&startTime=#{t1}&endTime=#{t2}")
92
92
  end
93
93
 
94
+ describe 'output formatting' do
95
+ it 'tests query output' do
96
+ out, err = command_output(word, :do_default, nil, 'query-cpu.json')
97
+ refute_empty(out)
98
+ assert_empty(err)
99
+ assert out.start_with?('name ')
100
+ end
101
+ end
102
+
94
103
  class QueryTest < MiniTest::Test
95
104
  attr_reader :wf
96
105
 
@@ -0,0 +1,24 @@
1
+ id 1459508340708
2
+ name Point Rate
3
+ lastEventTime 1547088327000
4
+ created 1459508340708
5
+ severity SEVERE
6
+ hidden false
7
+ target target:EKdKFv1rJ6iPahqI
8
+ minutes 5
9
+ tags
10
+ customerTags <none>
11
+ status CHECKING
12
+ updated 1518908410462
13
+ displayExpression sum(deriv(ts(~collector.points.valid)))
14
+ condition sum(deriv(ts(~collector.points.valid))) > 500
15
+ includeObsoleteMetrics false
16
+ additionalInformation Wavefront kindly gave me an allowance of
17
+ 500points/sec. It's not polite to go over that.
18
+ metricsUsed ~collector.points.valid
19
+ hostsUsed cube-wavefront
20
+ systemOwned false
21
+ targetInfo
22
+ method EMAIL
23
+ id EKdKFv1rJ6iPahqI
24
+ name Home
@@ -0,0 +1,37 @@
1
+ {
2
+ "items": {
3
+ "id": "1459508340708",
4
+ "name": "Point Rate",
5
+ "lastEventTime": 1547088327000,
6
+ "created": 1459508340708,
7
+ "severity": "SEVERE",
8
+ "hidden": false,
9
+ "target": "target:EKdKFv1rJ6iPahqI",
10
+ "minutes": 5,
11
+ "tags": {
12
+ "customerTags": []
13
+ },
14
+ "status": [
15
+ "CHECKING"
16
+ ],
17
+ "updated": 1518908410462,
18
+ "displayExpression": "sum(deriv(ts(~collector.points.valid)))",
19
+ "condition": "sum(deriv(ts(~collector.points.valid))) > 500",
20
+ "includeObsoleteMetrics": false,
21
+ "additionalInformation": "Wavefront kindly gave me an allowance of 500points/sec. It's not polite to go over that.",
22
+ "metricsUsed": [
23
+ "~collector.points.valid"
24
+ ],
25
+ "hostsUsed": [
26
+ "cube-wavefront"
27
+ ],
28
+ "systemOwned": false,
29
+ "targetInfo": [
30
+ {
31
+ "method": "EMAIL",
32
+ "id": "EKdKFv1rJ6iPahqI",
33
+ "name": "Home"
34
+ }
35
+ ]
36
+ }
37
+ }
@@ -0,0 +1,9 @@
1
+ 1459508340708 CHECKING Point Rate
2
+ 1464128764869 CHECKING No Metrics from home
3
+ 1476741941156 NO_DATA, CHECKING Disk Error
4
+ 1489162558204 CHECKING Zpool usage
5
+ 1495232095593 CHECKING No discogs update
6
+ 1497275466684 NO_DATA, CHECKING JPC Failed Services
7
+ 1499780986548 CHECKING ZFS pool fault
8
+ 1534951532204 NO_DATA, CHECKING failed backup on lobster
9
+ 1550569759786 NO_DATA, CHECKING failed cron job
@@ -0,0 +1 @@
1
+ {"items":[{"lastEventTime":1547088327000,"severity":"SEVERE","created":1459508340708,"hidden":false,"name":"Point Rate","id":"1459508340708","target":"target:EKdKFv1rJ6iPahqI","minutes":5,"tags":{"customerTags":[]},"status":["CHECKING"],"event":{"table":"sysdef","endTime":1547092003193,"startTime":1547088327000,"name":"Point Rate","annotations":{"severity":"severe","details":"<a class=\"ds-alert-link\" href=\"https://metrics.wavefront.com/u/xT0JM2YBFR\">View Alert</a>\n<br>\n<strong>First Affected: </strong>(No Source/Label) : 627.2731507111788","type":"alert","created":"1459508340708","target":"target:EKdKFv1rJ6iPahqI"},"id":"1547088327000:Point Rate:1","canDelete":false,"canClose":false,"creatorType":["SYSTEM","ALERT"],"hosts":[""],"isEphemeral":false,"creatorId":"System Event","updaterId":"System Event","runningState":"ENDED"},"updated":1518908410462,"displayExpression":"sum(deriv(ts(~collector.points.valid)))","conditionQBEnabled":false,"displayExpressionQBEnabled":false,"condition":"sum(deriv(ts(~collector.points.valid))) > 500","includeObsoleteMetrics":false,"processRateMinutes":1,"lastProcessedMillis":1551191162476,"updateUserId":"rob@example.com","inMaintenanceHostLabelPairs":[],"failingHostLabelPairs":[],"activeMaintenanceWindows":[],"prefiringHostLabelPairs":[],"notificants":["EKdKFv1rJ6iPahqI"],"additionalInformation":"Wavefront kindly gave me an allowance of 500points/sec. It's not polite to go over that.","lastQueryTime":143,"alertsLastDay":0,"alertsLastWeek":0,"alertsLastMonth":0,"inTrash":false,"lastNotificationMillis":1547088328269,"metricsUsed":["~collector.points.valid"],"pointsScannedAtLastQuery":14,"numPointsInFailureFrame":5,"hostsUsed":["cube-wavefront"],"systemOwned":false,"updaterId":"rob@example.com","createdEpochMillis":1459508340708,"updatedEpochMillis":1518908410462,"deleted":false,"targetInfo":[{"method":"EMAIL","id":"EKdKFv1rJ6iPahqI","name":"Home"}],"sortAttr":-160},{"lastEventTime":1538601187000,"severity":"WARN","created":1464128764869,"hidden":false,"name":"No Metrics from home","id":"1464128764869","target":"target:EKdKFv1rJ6iPahqI","minutes":2,"tags":{"customerTags":["home","point"]},"status":["CHECKING"],"event":{"table":"sysdef","endTime":1538603707161,"startTime":1538601187000,"name":"No Metrics from home","annotations":{"severity":"warn","details":"<a class=\"ds-alert-link\" href=\"https://metrics.wavefront.com/u/50hxR7HcQ9\">View Alert</a>\n<br>\n<strong>First Affected: </strong>cube-wavefront (~agent.points.2878.sent) [env=lab][dc=home]","type":"alert","created":"1464128764869","target":"target:EKdKFv1rJ6iPahqI"},"id":"1538601187000:No Metrics from home:1","canDelete":false,"canClose":false,"creatorType":["SYSTEM","ALERT"],"hosts":["cube-wavefront"],"isEphemeral":false,"creatorId":"System Event","updaterId":"System Event","runningState":"ENDED"},"updated":1520509765410,"displayExpression":"rate(ts(\"~agent.points.2878.sent\", dc=home))","conditionQBEnabled":false,"displayExpressionQBEnabled":false,"condition":"rate(ts(\"~agent.points.2878.sent\", dc=home)) < 1","includeObsoleteMetrics":false,"processRateMinutes":1,"lastProcessedMillis":1551191194691,"updateUserId":"rob@example.com","inMaintenanceHostLabelPairs":[],"failingHostLabelPairs":[],"activeMaintenanceWindows":[],"prefiringHostLabelPairs":[],"notificants":["EKdKFv1rJ6iPahqI"],"additionalInformation":"We've lost connection to metrics.wavefront.com. Probably our broadband is down. If not, check `svcs` on `shark-wavefront`.","lastQueryTime":50,"alertsLastDay":0,"alertsLastWeek":0,"alertsLastMonth":0,"inTrash":false,"lastNotificationMillis":1538601188454,"metricsUsed":["~agent.points.2878.sent"],"pointsScannedAtLastQuery":10,"numPointsInFailureFrame":2,"hostsUsed":["cube-wavefront"],"systemOwned":false,"updaterId":"rob@example.com","createdEpochMillis":1464128764869,"updatedEpochMillis":1520509765410,"deleted":false,"targetInfo":[{"method":"EMAIL","id":"EKdKFv1rJ6iPahqI","name":"Home"}],"sortAttr":-170},{"lastEventTime":1514115096829,"severity":"SEVERE","created":1476741941156,"hidden":false,"name":"Disk Error","id":"1476741941156","target":"target:EKdKFv1rJ6iPahqI","minutes":1,"tags":{"customerTags":["disk","physical"]},"status":["NO_DATA","CHECKING"],"event":{"table":"sysdef","endTime":1514115331201,"startTime":1514115096829,"name":"Disk Error","annotations":{"severity":"severe","details":"<a class=\"ds-alert-link\" href=\"https://metrics.wavefront.com/u/CZvtH5b9KC\">View Alert</a>\n<br>\n<strong>First Affected: </strong>shark (disk.error.sd0.hard_errors) [env=lab][vendor=TSSTcorp][product=CDDVDW SE-208GB] : 0.05","type":"alert","created":"1476741941156","target":"target:EKdKFv1rJ6iPahqI"},"id":"1514115096829:Disk Error:1","canDelete":false,"canClose":false,"creatorType":["SYSTEM","ALERT"],"hosts":["shark"],"creatorId":"System Event","updaterId":"System Event","runningState":"ENDED"},"updated":1515628449869,"displayExpression":"rate(ts(\"disk.error.*\"))","condition":"msum(3m, rate(ts(\"disk.error.*errors\", !vendor=TSSTcorp)))","lastProcessedMillis":1551191194867,"updateUserId":"rob@example.com","inMaintenanceHostLabelPairs":[],"failingHostLabelPairs":[],"activeMaintenanceWindows":[],"prefiringHostLabelPairs":[],"notificants":["EKdKFv1rJ6iPahqI"],"additionalInformation":"There's a hard-disk error.","lastQueryTime":66,"alertsLastDay":0,"alertsLastWeek":0,"alertsLastMonth":0,"inTrash":false,"pointsScannedAtLastQuery":0,"numPointsInFailureFrame":0,"systemOwned":false,"updaterId":"rob@example.com","createdEpochMillis":1476741941156,"updatedEpochMillis":1515628449869,"deleted":false,"targetInfo":[{"method":"EMAIL","id":"EKdKFv1rJ6iPahqI","name":"Home"}],"sortAttr":840},{"lastEventTime":1542200936000,"severity":"WARN","created":1489162558204,"hidden":false,"name":"Zpool usage","id":"1489162558204","target":"webhook:CHTo47HvsPzSaGhh,target:EKdKFv1rJ6iPahqI","minutes":5,"tags":{"customerTags":["performance","storage"]},"status":["CHECKING"],"event":{"table":"sysdef","endTime":1542206931084,"startTime":1542200936000,"name":"Zpool usage","annotations":{"severity":"warn","details":"<a class=\"ds-alert-link\" href=\"https://metrics.wavefront.com/u/fQcsQNLQyf\">View Alert</a>\n<br>\n<strong>First Affected: </strong>cube (zpool.fast.cap) [env=lab] : 80.0","type":"alert","created":"1489162558204","target":"webhook:CHTo47HvsPzSaGhh,target:EKdKFv1rJ6iPahqI"},"id":"1542200936000:Zpool usage:1","canDelete":false,"canClose":false,"creatorType":["SYSTEM","ALERT"],"hosts":["cube"],"isEphemeral":false,"creatorId":"System Event","updaterId":"System Event","runningState":"ENDED"},"updated":1510914900135,"displayExpression":"highpass(79, ts(\"zpool.*cap\"))","conditionQBEnabled":false,"displayExpressionQBEnabled":false,"condition":"ts(\"zpool.*.cap\") > 79","processRateMinutes":1,"lastProcessedMillis":1551191195766,"updateUserId":"rob@example.com","inMaintenanceHostLabelPairs":[],"failingHostLabelPairs":[],"activeMaintenanceWindows":[],"prefiringHostLabelPairs":[],"snoozed":1518890686160,"notificants":["CHTo47HvsPzSaGhh","EKdKFv1rJ6iPahqI"],"additionalInformation":"ZFS performance drops dramatically when capacity exceeds 80%","lastQueryTime":153,"alertsLastDay":0,"alertsLastWeek":0,"alertsLastMonth":0,"inTrash":false,"createUserId":"rob@example.com","lastNotificationMillis":1542200937513,"metricsUsed":["zpool.rpool.cap","zpool.big.cap","zpool.fast.cap"],"pointsScannedAtLastQuery":163,"numPointsInFailureFrame":15,"hostsUsed":["cube"],"systemOwned":false,"resolveAfterMinutes":5,"creatorId":"rob@example.com","updaterId":"rob@example.com","createdEpochMillis":1489162558204,"updatedEpochMillis":1510914900135,"deleted":false,"targetInfo":[{"method":"WEBHOOK","id":"CHTo47HvsPzSaGhh","name":"Slack Alerts"},{"method":"EMAIL","id":"EKdKFv1rJ6iPahqI","name":"Home"}],"sortAttr":-170},{"lastEventTime":1550250926000,"severity":"WARN","created":1495232095593,"hidden":false,"name":"No discogs update","id":"1495232095593","target":"webhook:CHTo47HvsPzSaGhh,target:EKdKFv1rJ6iPahqI","minutes":5,"tags":{"customerTags":[]},"status":["CHECKING"],"event":{"table":"sysdef","endTime":1550256430092,"startTime":1550250926000,"name":"No discogs update","annotations":{"severity":"warn","details":"<a class=\"ds-alert-link\" href=\"https://metrics.wavefront.com/u/tRk3k0vScj\">View Alert</a>\n<br>\n<strong>First Affected: </strong>discogs (dev.test.costs.max) [env=lab] : 0.5, discogs (dev.test.costs.min) [env=lab] : 0.5, discogs (dev.test.costs.max_asking) [env=lab] : 0.5, discogs (dev.test.costs.min_asking) [env=lab] : 0.5","type":"alert","created":"1495232095593","target":"webhook:CHTo47HvsPzSaGhh,target:EKdKFv1rJ6iPahqI"},"id":"1550250926000:No discogs update:1","canDelete":false,"canClose":false,"creatorType":["SYSTEM","ALERT"],"hosts":["discogs"],"isEphemeral":false,"creatorId":"System Event","updaterId":"System Event","runningState":"ENDED"},"updated":1510532351489,"displayExpression":"mcount(1d, ts(\"dev.test.costs.*\"))","conditionQBEnabled":false,"displayExpressionQBEnabled":false,"condition":"mcount(1d, ts(\"dev.test.costs.*\")) < 10","processRateMinutes":1,"lastProcessedMillis":1551191196207,"updateUserId":"rob@example.com","inMaintenanceHostLabelPairs":[],"failingHostLabelPairs":[],"activeMaintenanceWindows":[],"prefiringHostLabelPairs":[],"snoozed":1502662765889,"notificants":["CHTo47HvsPzSaGhh","EKdKFv1rJ6iPahqI"],"additionalInformation":"","lastQueryTime":145,"alertsLastDay":0,"alertsLastWeek":0,"alertsLastMonth":2,"inTrash":false,"createUserId":"rob@example.com","lastNotificationMillis":1550250927495,"metricsUsed":["dev.test.costs.max","dev.test.costs.min","dev.test.costs.min_asking","dev.test.costs.max_asking"],"pointsScannedAtLastQuery":14,"numPointsInFailureFrame":20,"hostsUsed":["discogs"],"systemOwned":false,"creatorId":"rob@example.com","updaterId":"rob@example.com","createdEpochMillis":1495232095593,"updatedEpochMillis":1510532351489,"deleted":false,"targetInfo":[{"method":"WEBHOOK","id":"CHTo47HvsPzSaGhh","name":"Slack Alerts"},{"method":"EMAIL","id":"EKdKFv1rJ6iPahqI","name":"Home"}],"sortAttr":-170},{"lastEventTime":1511088783570,"severity":"SMOKE","created":1497275466684,"hidden":false,"name":"JPC Failed Services","id":"1497275466684","target":"target:T0in8AtVb56Zkzlz","minutes":2,"tags":{"customerTags":[]},"status":["NO_DATA","CHECKING"],"event":{"table":"sysdef","endTime":1511089205114,"startTime":1511088783570,"name":"JPC Failed Services","annotations":{"severity":"smoke","details":"<a class=\"ds-alert-link\" href=\"https://metrics.wavefront.com/u/LlTVS0HYCV\">View Alert</a>\n<br>\n<strong>First Affected: </strong>www-green (smf.svcs.maintenance) [env=production]","type":"alert","created":"1497275466684","target":"target:T0in8AtVb56Zkzlz"},"id":"1511088783570:JPC Failed Services:1","canDelete":false,"canClose":false,"creatorType":["SYSTEM","ALERT"],"hosts":["www-green"],"creatorId":"System Event","updaterId":"System Event","runningState":"ENDED"},"updated":1510527908408,"displayExpression":"","conditionQBEnabled":false,"displayExpressionQBEnabled":true,"condition":"ts(\"smf.svcs.maintenance\", env=production)","displayExpressionQBSerialization":"{\"_v\":1,\"metric\":\"\",\"filters\":[[],\"and\"],\"functions\":[]}","processRateMinutes":1,"lastProcessedMillis":1551191199080,"updateUserId":"rob@example.com","inMaintenanceHostLabelPairs":[],"failingHostLabelPairs":[],"activeMaintenanceWindows":[],"prefiringHostLabelPairs":[],"noDataEvent":{"table":"sysdef","startTime":1523971587715,"name":"JPC Failed Services","annotations":{"severity":"smoke","details":"Missing data.","targetInfo":"[{\"method\":\"EMAIL\",\"id\":\"T0in8AtVb56Zkzlz\",\"name\":\"JPC\"}]","type":"alert","created":"1497275466684","target":"target:T0in8AtVb56Zkzlz"},"id":"1523971587715:JPC Failed Services:0","canDelete":false,"canClose":false,"creatorType":["SYSTEM","ALERT"],"hosts":[],"creatorId":"System Event","updaterId":"System Event","runningState":"ONGOING"},"notificants":["T0in8AtVb56Zkzlz"],"additionalInformation":"A service has failed. Log on to the box and see what it is","lastQueryTime":31,"alertsLastDay":0,"alertsLastWeek":0,"alertsLastMonth":0,"inTrash":false,"createUserId":"rob@example.com","lastNotificationMillis":1511088783813,"pointsScannedAtLastQuery":93,"numPointsInFailureFrame":0,"systemOwned":false,"creatorId":"rob@example.com","updaterId":"rob@example.com","createdEpochMillis":1497275466684,"updatedEpochMillis":1510527908408,"deleted":false,"targetInfo":[{"method":"EMAIL","id":"T0in8AtVb56Zkzlz","name":"JPC"}],"sortAttr":820},{"lastEventTime":1539389234000,"severity":"SEVERE","created":1499780986548,"hidden":false,"name":"ZFS pool fault","id":"1499780986548","target":"webhook:CHTo47HvsPzSaGhh,target:EKdKFv1rJ6iPahqI","minutes":2,"tags":{"customerTags":["disk","physical","storage"]},"status":["CHECKING"],"event":{"table":"sysdef","endTime":1539410047785,"startTime":1539389234000,"name":"ZFS pool fault","annotations":{"severity":"severe","details":"<a class=\"ds-alert-link\" href=\"https://metrics.wavefront.com/u/NVCPHQbjD6\">View Alert</a>\n<br>\n<strong>First Affected: </strong>cube (zpool.big.health) [env=lab] : 1.0","type":"alert","created":"1499780986548","target":"webhook:CHTo47HvsPzSaGhh,target:EKdKFv1rJ6iPahqI"},"id":"1539389234000:ZFS pool fault:1","canDelete":false,"canClose":false,"creatorType":["SYSTEM","ALERT"],"hosts":["cube"],"isEphemeral":false,"creatorId":"System Event","updaterId":"System Event","runningState":"ENDED"},"updated":1510914882630,"displayExpression":"ts(\"zpool.*.health\")","conditionQBEnabled":false,"displayExpressionQBEnabled":false,"condition":"ts(\"zpool.*.health\")","processRateMinutes":1,"lastProcessedMillis":1551191199198,"updateUserId":"rob@example.com","inMaintenanceHostLabelPairs":[],"failingHostLabelPairs":[],"activeMaintenanceWindows":[],"prefiringHostLabelPairs":[],"notificants":["CHTo47HvsPzSaGhh","EKdKFv1rJ6iPahqI"],"additionalInformation":"","lastQueryTime":233,"alertsLastDay":0,"alertsLastWeek":0,"alertsLastMonth":0,"inTrash":false,"createUserId":"rob@example.com","lastNotificationMillis":1539389235338,"metricsUsed":["zpool.rpool.health","zpool.big.health","zpool.fast.health"],"pointsScannedAtLastQuery":43,"numPointsInFailureFrame":6,"hostsUsed":["cube"],"systemOwned":false,"creatorId":"rob@example.com","updaterId":"rob@example.com","createdEpochMillis":1499780986548,"updatedEpochMillis":1510914882630,"deleted":false,"targetInfo":[{"method":"WEBHOOK","id":"CHTo47HvsPzSaGhh","name":"Slack Alerts"},{"method":"EMAIL","id":"EKdKFv1rJ6iPahqI","name":"Home"}],"sortAttr":-160},{"lastEventTime":1536225069000,"severity":"WARN","created":1534951532204,"hidden":false,"name":"failed backup on lobster","id":"1534951532204","target":"rob@example.com","minutes":15,"tags":{"customerTags":["backup","home","physical"]},"status":["NO_DATA","CHECKING"],"event":{"table":"sysdef","endTime":1536229648317,"startTime":1536225069000,"name":"failed backup on lobster","annotations":{"severity":"warn","details":"<a class=\"ds-alert-link\" href=\"https://metrics.wavefront.com/u/V33KcvP27g\">View Alert</a>\n<br>\n<strong>First Affected: </strong>lobster (backups.lobster.failed) [env=lab]","type":"alert","created":"1534951532204","target":"rob@example.com"},"id":"1536225069000:failed backup on lobster:1","canDelete":false,"canClose":false,"creatorType":["SYSTEM","ALERT"],"hosts":["lobster"],"isEphemeral":false,"creatorId":"System Event","updaterId":"System Event","runningState":"ENDED"},"updated":1536015134906,"displayExpression":"","conditionQBEnabled":false,"displayExpressionQBEnabled":true,"condition":"ts(\"backups.lobster.failed\")","displayExpressionQBSerialization":"{\"_v\":1,\"metric\":\"\",\"filters\":[[],\"and\"],\"functions\":[]}","includeObsoleteMetrics":false,"processRateMinutes":1,"lastProcessedMillis":1551191159327,"updateUserId":"rob@example.com","inMaintenanceHostLabelPairs":[],"failingHostLabelPairs":[],"activeMaintenanceWindows":[],"prefiringHostLabelPairs":[],"notificants":[],"additionalInformation":"","lastQueryTime":1,"alertsLastDay":0,"alertsLastWeek":0,"alertsLastMonth":0,"inTrash":false,"createUserId":"rob@example.com","lastNotificationMillis":1536225069481,"pointsScannedAtLastQuery":0,"numPointsInFailureFrame":0,"systemOwned":false,"resolveAfterMinutes":15,"creatorId":"rob@example.com","updaterId":"rob@example.com","createdEpochMillis":1534951532204,"updatedEpochMillis":1536015134906,"deleted":false,"targetInfo":[],"sortAttr":830},{"lastEventTime":1551143502000,"severity":"WARN","created":1550569759786,"hidden":false,"name":"failed cron job","id":"1550569759786","target":"target:CHTo47HvsPzSaGhh","minutes":2,"tags":{"customerTags":[]},"status":["NO_DATA","CHECKING"],"event":{"table":"sysdef","endTime":1551143639224,"startTime":1551143502000,"name":"failed cron job","annotations":{"severity":"warn","details":"<a class=\"ds-alert-link\" href=\"https://metrics.wavefront.com/u/J3y3TcZGpn\">View Alert</a>\n<br>\n<strong>First Affected: </strong>cube (cron.job) [exit_code=1][uid=105][cmd=/usr/ruby/2.3/bin/ruby /usr/bin/bundle exec discogs_find_urls 20][env=lab][zone=cube-cron]","type":"alert","created":"1550569759786","target":"target:CHTo47HvsPzSaGhh"},"id":"1551143502000:failed cron job:1","canDelete":false,"canClose":false,"creatorType":["SYSTEM","ALERT"],"hosts":["cube"],"isEphemeral":false,"creatorId":"System Event","updaterId":"System Event","runningState":"ENDED"},"updated":1550569759786,"displayExpression":"","conditionQBEnabled":false,"displayExpressionQBEnabled":true,"condition":"ts(\"cron.job\", not exit_code=0)","displayExpressionQBSerialization":"{\"_v\":1,\"metric\":\"\",\"filters\":[[],\"and\"],\"functions\":[]}","includeObsoleteMetrics":false,"processRateMinutes":1,"lastProcessedMillis":1551191162332,"updateUserId":"rob@example.com","inMaintenanceHostLabelPairs":[],"failingHostLabelPairs":[],"activeMaintenanceWindows":[],"prefiringHostLabelPairs":[],"notificants":["CHTo47HvsPzSaGhh"],"lastQueryTime":65,"alertsLastDay":1,"alertsLastWeek":26,"alertsLastMonth":68,"inTrash":false,"createUserId":"rob@example.com","lastNotificationMillis":1551143503140,"metricsUsed":["cron.job"],"pointsScannedAtLastQuery":0,"numPointsInFailureFrame":0,"hostsUsed":["cube"],"systemOwned":false,"creatorId":"rob@example.com","updaterId":"rob@example.com","createdEpochMillis":1550569759786,"updatedEpochMillis":1550569759786,"deleted":false,"targetInfo":[{"method":"WEBHOOK","id":"CHTo47HvsPzSaGhh","name":"Slack Alerts"}],"sortAttr":830}],"offset":0,"limit":100,"totalItems":9,"moreItems":false}
@@ -0,0 +1,19 @@
1
+ identifier services@example.com
2
+ customer sysdef
3
+ groups <none>
4
+ userGroups
5
+ id 2659191e-ab35-41df-a94e-9667e1517127
6
+ name Everyone
7
+ permissions <none>
8
+ customer sysdef
9
+ properties
10
+ nameEditable false
11
+ permissionsEditable true
12
+ usersEditable false
13
+ ------------------------------------------------------
14
+ id cb61dae7-b476-43e6-a596-a6b514e71969
15
+ name normal users
16
+ permissions alerts_management
17
+ dashboard_management
18
+ events_management
19
+ customer sysdef
@@ -0,0 +1,18 @@
1
+ identifier services@example.com
2
+ customer sysdef
3
+ groups <none>
4
+ userGroups
5
+ id 2659191e-ab35-41df-a94e-9667e1517127
6
+ name Everyone
7
+ permissions <none>
8
+ customer sysdef
9
+ properties
10
+ nameEditable false
11
+ permissionsEditable true
12
+ usersEditable false
13
+ id cb61dae7-b476-43e6-a596-a6b514e71969
14
+ name normal users
15
+ permissions alerts_management
16
+ dashboard_management
17
+ events_management
18
+ customer sysdef
@@ -0,0 +1 @@
1
+ {"items":{"identifier":"services@example.com","customer":"sysdef","groups":[],"userGroups":[{"id":"2659191e-ab35-41df-a94e-9667e1517127","name":"Everyone","permissions":[],"customer":"sysdef","properties":{"nameEditable":false,"permissionsEditable":true,"usersEditable":false}},{"id":"cb61dae7-b476-43e6-a596-a6b514e71969","name":"normal users","permissions":["events_management","alerts_management","dashboard_management"],"customer":"sysdef"}]},"offset":0,"limit":4,"totalItems":4,"modeItems":false}
@@ -0,0 +1,2 @@
1
+ These are canned API responses used to check things are handled and
2
+ printed sensibly. They do not contain any real identifying data.
@@ -0,0 +1 @@
1
+ {"items":[{"created":1551222976666,"severity":"SMOKE","hidden":false,"name":"example alert","id":"1551222976666","target":"someone@example.com","minutes":5,"tags":{"customerTags":["cli","exampl"]},"status":["NO_DATA","CHECKING"],"updated":1551222976666,"deleted":false,"displayExpression":"ts(\"imaginary.series\")","conditionQBEnabled":false,"displayExpressionQBEnabled":false,"condition":"ts(\"imaginary.series\") > 10","includeObsoleteMetrics":false,"processRateMinutes":1,"lastProcessedMillis":1551223178245,"updateUserId":"someone@example.com","inMaintenanceHostLabelPairs":[],"failingHostLabelPairs":[],"activeMaintenanceWindows":[],"prefiringHostLabelPairs":[],"notificants":[],"additionalInformation":"a sample alert for CLI testing","alertsLastDay":0,"alertsLastWeek":0,"alertsLastMonth":0,"inTrash":false,"createUserId":"someone@example.com","pointsScannedAtLastQuery":0,"numPointsInFailureFrame":0,"systemOwned":false,"creatorId":"someone@example.com","updaterId":"someone@example.com","createdEpochMillis":1551222976666,"updatedEpochMillis":1551222976666,"targetInfo":[],"sortAttr":820},{"created":1551223211793,"severity":"INFO","hidden":false,"name":"another pretend alert","id":"1551223211793","target":"someone@example.com,target:Sp71L2NuJWFZt67Y,pd:123456789012345678901234567890ab","minutes":5,"tags":{"customerTags":["cli","exampl"]},"status":["NO_DATA","CHECKING"],"updated":1551223211793,"deleted":false,"displayExpression":"","conditionQBEnabled":false,"displayExpressionQBEnabled":true,"condition":"ts(\"pretend.series\") > 10","displayExpressionQBSerialization":"{\"_v\":1,\"metric\":\"\",\"filters\":[[],\"and\"],\"functions\":[]}","includeObsoleteMetrics":false,"processRateMinutes":1,"lastProcessedMillis":1551223222212,"updateUserId":"someone@example.com","inMaintenanceHostLabelPairs":[],"failingHostLabelPairs":[],"activeMaintenanceWindows":[],"prefiringHostLabelPairs":[],"notificants":["Sp71L2NuJWFZt67Y"],"additionalInformation":"another sample alert for CLI testing","alertsLastDay":0,"alertsLastWeek":0,"alertsLastMonth":0,"inTrash":false,"createUserId":"someone@example.com","pointsScannedAtLastQuery":0,"numPointsInFailureFrame":0,"systemOwned":false,"creatorId":"someone@example.com","updaterId":"someone@example.com","createdEpochMillis":1551223211793,"updatedEpochMillis":1551223211793,"targetInfo":[{"method":"EMAIL","id":"Sp71L2NuJWFZt67Y","name":"example target"}],"sortAttr":810}],"offset":0,"limit":100,"totalItems":2,"moreItems":false}
@@ -0,0 +1 @@
1
+ {"canUserModify":true,"hidden":false,"name":"backups","id":"backups","parameters":{},"customer":"sysdef","url":"backups","systemOwned":false,"updaterId":"rob@example.com","creatorId":"rob@example.com","eventFilterType":"BYCHART","sections":[{"name":"S3","rows":[{"charts":[{"base":1,"description":"","units":"","name":"S3 Bucket Sizes","interpolatePoints":false,"chartSettings":{"type":"stacked-area","expectedDataSpacing":200009,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"stackType":"zero","tagMode":"all","numTags":4,"customTags":[],"windowing":"full","autoColumnTags":false,"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MEAN","sources":[{"name":"Query","query":"ts(\"aws.s3.bucketsizebytes\")","scatterPlotSource":"Y","querybuilderSerialization":"{\"_v\":1,\"metric\":\"ts(\\\"aws.s3.bucketsizebytes\\\")\",\"filters\":[[],\"and\"],\"functions\":[]}","querybuilderEnabled":true,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false},{"base":1,"description":"","units":"","name":"S3 Objects","interpolatePoints":false,"chartSettings":{"type":"stacked-area","expectedDataSpacing":200009,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"stackType":"zero","tagMode":"all","numTags":4,"customTags":[],"windowing":"full","autoColumnTags":false,"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MEAN","sources":[{"name":"Query","query":"ts(\"aws.s3.numberofobjects\", not BucketName=sdef-cloudtrail)","scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false}],"heightFactor":100}]},{"name":"Lobster","rows":[{"charts":[{"base":1,"description":"","units":"","name":"Files Transferred","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":601,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"linear","tagMode":"all","numTags":4,"customTags":[],"windowing":"full","autoColumnTags":false,"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MAX","sources":[{"name":"transferred","query":"ts(\"backups.lobster.transferred\")","secondaryAxis":false,"scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false},{"base":1,"description":"","units":"","name":"Files Deleted","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":601,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"linear","tagMode":"all","numTags":4,"customTags":[],"windowing":"full","autoColumnTags":false,"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MEAN","sources":[{"name":"deleted","query":"ts(\"backups.lobster.deleted\")","secondaryAxis":false,"scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false}],"heightFactor":100},{"charts":[{"base":1,"description":"","units":"","name":"Successful Backups","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":601,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"linear","tagMode":"all","numTags":4,"customTags":[],"windowing":"full","autoColumnTags":false,"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MEAN","sources":[{"name":"success","query":"default(0, ts(\"backups.lobster.success\"))","secondaryAxis":false,"scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false},{"base":1,"description":"","units":"","name":"Failed Backups","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":601,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"linear","tagMode":"all","numTags":4,"customTags":[],"windowing":"full","autoColumnTags":false,"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MAX","sources":[{"name":"success","query":"default(0, ts(\"backups.lobster.failed\"))","secondaryAxis":false,"scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false}],"heightFactor":100}]},{"name":"New Section","rows":[]}],"parameterDetails":{},"displayDescription":false,"displaySectionTableOfContents":true,"displayQueryParameters":false,"viewsLastDay":0,"viewsLastWeek":0,"viewsLastMonth":0,"acl":{"canView":[],"canModify":["a7d2e651-cec1-4154-a5e8-1946f57ef5b3"]},"createdEpochMillis":1534948654948,"updatedEpochMillis":1535017421218,"deleted":false,"numFavorites":0,"favorite":false,"numCharts":6,"orphan":false}
@@ -0,0 +1 @@
1
+ {"items":[{"forceSave":false,"service":"CLOUDWATCH","inTrash":false,"creatorId":"someone@example.com","updaterId":"someone@example.com","id":"0526e19d-c6f4-417a-a2a7-312d14b4aab2","lastErrorEvent":{"startTime":1540167060324,"endTime":1540168154163,"table":"sysdef","annotations":{"severity":"warn","errorMessage":"Cannot access cloudwatch with given credentials","credentialsId":"20abcde9-abcd-1234-a2a7-3121d4b4abf2","type":"credentials-error","service":"CLOUDWATCH"},"hosts":[],"creatorId":"System Event","updaterId":"System Event","id":"1540167060324:Credentials Error: firmware-prod:1","runningState":"ENDED","canDelete":false,"canClose":false,"creatorType":["SYSTEM"],"name":"Credentials Error: firmware-prod"},"lastReceivedDataPointMs":1551228458757,"lastMetricCount":1440,"cloudWatch":{"baseCredentials":{"roleArn":"arn:aws:iam::148529622918:role/wavefront","externalId":"wave341a3452"}},"disabled":false,"createdEpochMillis":1509468433740,"updatedEpochMillis":1509468433740,"deleted":false,"name":"firmware-prod"},{"forceSave":false,"service":"EC2","inTrash":false,"creatorId":"other@example.com","updaterId":"other@example.com","id":"01234567-04e0-4d96-99f8-aa47abd6156c","lastErrorEvent":{"startTime":1540484546377,"endTime":1540484548297,"table":"sysdef","annotations":{"severity":"warn","errorMessage":"Cannot access ec2 with given credentials","credentialsId":"0f097848-5678-5678-f998-aaa47db1656c","type":"credentials-error","service":"EC2"},"hosts":[],"creatorId":"System Event","updaterId":"System Event","id":"1540682384347:Credentials Error: services-prod:1","runningState":"ENDED","canDelete":false,"canClose":false,"creatorType":["SYSTEM"],"name":"Credentials Error: services-prod"},"lastReceivedDataPointMs":1551228469907,"lastMetricCount":12,"ec2":{"baseCredentials":{"roleArn":"arn:aws:iam::152897234635:role/wavefront_integration","externalId":"waveb17c0af4"}},"disabled":false,"createdEpochMillis":1512050989878,"updatedEpochMillis":1512050989878,"deleted":false,"name":"services-prod"}],"offset":0,"limit":2,"totalItems":94,"moreItems":true}
@@ -0,0 +1 @@
1
+ {"items":[{"canUserModify":true,"name":"backups","id":"backups","parameters":{},"hidden":false,"customer":"sysdef","url":"backups","systemOwned":false,"creatorId":"someone@example.com","updaterId":"someone@example.com","eventFilterType":"BYCHART","sections":[{"name":"S3","rows":[{"heightFactor":100,"charts":[{"description":"","units":"","base":1,"name":"S3 Bucket Sizes","interpolatePoints":false,"chartSettings":{"type":"stacked-area","expectedDataSpacing":200009,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"stackType":"zero","windowing":"full","autoColumnTags":false,"tagMode":"all","numTags":4,"customTags":[],"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MEAN","sources":[{"name":"Query","query":"ts(\"aws.s3.bucketsizebytes\")","scatterPlotSource":"Y","querybuilderSerialization":"{\"_v\":1,\"metric\":\"ts(\\\"aws.s3.bucketsizebytes\\\")\",\"filters\":[[],\"and\"],\"functions\":[]}","querybuilderEnabled":true,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false},{"description":"","units":"","base":1,"name":"S3 Objects","interpolatePoints":false,"chartSettings":{"type":"stacked-area","expectedDataSpacing":200009,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"stackType":"zero","windowing":"full","autoColumnTags":false,"tagMode":"all","numTags":4,"customTags":[],"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MEAN","sources":[{"name":"Query","query":"ts(\"aws.s3.numberofobjects\", not BucketName=sdef-cloudtrail)","scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false}]}]},{"name":"Lobster","rows":[{"heightFactor":100,"charts":[{"description":"","units":"","base":1,"name":"Files Transferred","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":601,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"linear","windowing":"full","autoColumnTags":false,"tagMode":"all","numTags":4,"customTags":[],"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MAX","sources":[{"name":"transferred","query":"ts(\"backups.lobster.transferred\")","secondaryAxis":false,"scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false},{"description":"","units":"","base":1,"name":"Files Deleted","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":601,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"linear","windowing":"full","autoColumnTags":false,"tagMode":"all","numTags":4,"customTags":[],"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MEAN","sources":[{"name":"deleted","query":"ts(\"backups.lobster.deleted\")","secondaryAxis":false,"scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false}]},{"heightFactor":100,"charts":[{"description":"","units":"","base":1,"name":"Successful Backups","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":601,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"linear","windowing":"full","autoColumnTags":false,"tagMode":"all","numTags":4,"customTags":[],"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MEAN","sources":[{"name":"success","query":"default(0, ts(\"backups.lobster.success\"))","secondaryAxis":false,"scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false},{"description":"","units":"","base":1,"name":"Failed Backups","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":601,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"linear","windowing":"full","autoColumnTags":false,"tagMode":"all","numTags":4,"customTags":[],"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MAX","sources":[{"name":"success","query":"default(0, ts(\"backups.lobster.failed\"))","secondaryAxis":false,"scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false}]}]},{"name":"New Section","rows":[]}],"parameterDetails":{},"displayDescription":false,"displaySectionTableOfContents":true,"displayQueryParameters":false,"viewsLastDay":0,"viewsLastWeek":0,"viewsLastMonth":0,"acl":{"canView":[],"canModify":["fcd0b0b0-2991-4550-9e74-9beecc0ea8ce"]},"createdEpochMillis":1551229705250,"updatedEpochMillis":1551229705250,"deleted":false,"numCharts":6,"numFavorites":0,"favorite":false,"orphan":false},{"canUserModify":true,"name":"gems","id":"gems","parameters":{},"hidden":false,"customer":"sysdef","url":"gems","systemOwned":false,"creatorId":"someone@example.com","updaterId":"someone@example.com","eventFilterType":"BYCHART","sections":[{"name":"Gem Downloads","rows":[{"heightFactor":100,"charts":[{"units":"downloads","base":0,"name":"Wavefront CLI Gem downloads","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":400000,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"basis","windowing":"full","autoColumnTags":false,"tagMode":"all","numTags":4,"customTags":[],"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MEAN","sources":[{"name":"wavefront-cli","query":"ts(\"gem.downloads.wavefront-cli\")","scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false},{"description":"","units":"downloads","base":1,"name":"Wavefront SDK Gem downloads","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":400000,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"basis","windowing":"full","autoColumnTags":false,"tagMode":"all","numTags":4,"customTags":[],"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MEAN","sources":[{"name":"wavefront-sdk","query":"ts(\"gem.downloads.wavefront-sdk\")","secondaryAxis":false,"scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false},{"description":"","units":"downloads","base":1,"name":"Meetup-Generator downloads","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":400000,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"basis","windowing":"full","autoColumnTags":false,"tagMode":"all","numTags":4,"customTags":[],"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MEAN","sources":[{"name":"meetup-generator","query":"ts(\"gem.downloads.meetup-generator\")","secondaryAxis":false,"scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false}]},{"heightFactor":100,"charts":[{"base":0,"name":"rate of gem downloads","interpolatePoints":false,"chartSettings":{"type":"line","expectedDataSpacing":400000,"fixedLegendEnabled":false,"fixedLegendUseRawStats":false,"lineType":"monotone","windowing":"full","autoColumnTags":false,"tagMode":"all","numTags":4,"customTags":[],"y1Units":"","y0ScaleSIBy1024":false,"y1ScaleSIBy1024":false,"y0UnitAutoscaling":false,"y1UnitAutoscaling":false,"fixedLegendPosition":"RIGHT","fixedLegendDisplayStats":["CURRENT"],"fixedLegendFilterSort":"TOP","fixedLegendFilterLimit":5,"fixedLegendFilterField":"CURRENT"},"chartAttributes":null,"summarization":"MAX","sources":[{"name":"wavefront-cli","query":"rate(ts(\"gem.downloads.*\"))","scatterPlotSource":"Y","querybuilderEnabled":false,"sourceDescription":""}],"includeObsoleteMetrics":false,"noDefaultEvents":false}]}]}],"parameterDetails":{},"displayDescription":false,"displaySectionTableOfContents":true,"displayQueryParameters":false,"viewsLastDay":0,"viewsLastWeek":0,"viewsLastMonth":0,"acl":{"canView":[],"canModify":["fcd0b0b0-2991-4550-9e74-9beecc0ea8ce"]},"createdEpochMillis":1551223448979,"updatedEpochMillis":1551223448979,"deleted":false,"numCharts":4,"numFavorites":0,"favorite":false,"orphan":false}],"offset":0,"limit":2,"totalItems":3,"moreItems":true}
@@ -0,0 +1 @@
1
+ {"items":[{"created":1551211178661,"name":"example derived metric","id":"1551211178661","query":"aliasMetric(ts(\"gem.downloads.wavefront-cli\"), \"downloads.cli\")","minutes":5,"tags":{"customerTags":["cli","test"]},"status":["ACTIVE"],"updated":1551211178661,"includeObsoleteMetrics":false,"additionalInformation":"example derived metric for CLI testing","processRateMinutes":1,"lastProcessedMillis":1551211333145,"updateUserId":"someone@example.com","inTrash":false,"queryFailing":false,"createUserId":"someone@example.com","pointsScannedAtLastQuery":3,"metricsUsed":["gem.downloads.wavefront-cli"],"hostsUsed":["cube-cron"],"creatorId":"someone@example.com","updaterId":"other@example.com","queryQBEnabled":false,"createdEpochMillis":1551211178661,"updatedEpochMillis":1551211178661,"deleted":false}],"offset":0,"limit":100,"totalItems":1,"moreItems":false}
@@ -0,0 +1 @@
1
+ {"items":[{"table":"sysdef","startTime":1551229468000,"annotations":{"severity":"info","details":"<a class='ds-alert-link' href='https://sysdef.wavefront.com/u/jio23xqp0p'>View Alert</a><br><strong>First Affected: </strong>app-17 (~sample.cpu.loadavg.1m) [env=production][az=us-west-2]","type":"alert","created":"1540206206775","target":"success@simulator.amazonses.com"},"hosts":["app-17"],"creatorId":"System Event","updaterId":"System Event","isEphemeral":false,"id":"1551229468000:Alert test1:0","runningState":"ONGOING","canDelete":false,"canClose":false,"creatorType":["SYSTEM","ALERT"],"name":"Alert test1"},{"table":"sysdef","startTime":1551229412217,"annotations":{"severity":"warn","errorMessage":"Cannot access a single region with given credentials using roleArn: arn:aws:iam::747827923453:role/Wavefront.dev5 and externalId: wavefd483213","credentialsId":"e8f6355e-3b14-4afd-aa1a-2eaf12fdb84b","type":"credentials-error","service":"CLOUDWATCH"},"hosts":[],"creatorId":"System Event","updaterId":"System Event","isEphemeral":false,"id":"1551229412217:Credentials Error: AWS_CW_WF_T1:0","runningState":"ONGOING","canDelete":false,"canClose":false,"creatorType":["SYSTEM"],"name":"Credentials Error: AWS_CW_WF_T1"}],"limit":2,"cursor":"1551229412217:Credentials Error: AWS_CW_WF_T1:0","moreItems":true}
@@ -0,0 +1 @@
1
+ {"items":[{"icon":"./aws_dc.png","description":"Monitor AWS Direct Connect","name":"AWS Direct Connect","id":"amazon_dc","baseUrl":"https://s3-us-west-2.amazonaws.com/wavefront-application-definitions/release/current/amazon_dc/index.json","status":{"alertStatuses":{},"contentStatus":"VISIBLE","installStatus":"UNDECIDED","metricStatuses":{}},"aliasOf":"aws","dashboards":[],"deleted":false,"alerts":[]},{"icon":"./aws-beanstalk.svg","description":"Monitor AWS Elastic Beanstalk","name":"AWS Elastic Beanstalk","id":"amazon_beanstalk","baseUrl":"https://s3-us-west-2.amazonaws.com/wavefront-application-definitions/release/current/amazon_beanstalk/index.json","status":{"alertStatuses":{},"contentStatus":"VISIBLE","installStatus":"UNDECIDED","metricStatuses":{}},"aliasOf":"aws","dashboards":[],"deleted":false,"alerts":[]}],"offset":70,"limit":2,"totalItems":206,"moreItems":true}
@@ -0,0 +1 @@
1
+ {"items":[{"description":"sample link for CLI testing","name":"example link","id":"dyiiG9u4p9VcJqQt","creatorId":"someone@example.com","updaterId":"someone@example.com","template":"https://example.com?time:(from:'{{#functions.epochMillisToISO}}{{startEpochMillis}}{{/functions.epochMillisToISO}}',to:'{{#functions.epochMillisToISO}}{{endEpochMillis}}{{/functions.epochMillisToISO}}'))&{{#functions.urlEncode}}host:{{source}} AND source:\"/mnt/logs/{{service}}.log\"{{/functions.urlEncode}}'))","metricFilterRegex":"","sourceFilterRegex":"cube*","pointTagFilterRegexes":{},"createdEpochMillis":1551211359741,"updatedEpochMillis":1551211359741}],"offset":0,"limit":100,"totalItems":1,"moreItems":false}
@@ -0,0 +1 @@
1
+ {"items":[{"method":"EMAIL","description":"sample alert target for CLI testing","contentType":"","id":"Sp71L2NuJWFZt67Y","customerId":"sysdef","title":"example target","creatorId":"someone@example.com","updaterId":"someone@example.com","template":"{{reason}}\n\nAlert: {{{name}}}\nCondition: {{{condition}}}\nCreated: {{createdTime}}\n\nURL: {{{url}}}\n\n{{! Alert Opened section }}\n{{#isAlertOpened}}\nAffected since: {{{sinceTime}}}\nEvent started: {{{startedTime}}}\n\nSources/Labels Affected:\n{{{hostsFailingMessage}}}\n\nSources/Labels In Maintenance:\n{{#trimTrailingComma}}\n{{#inMaintenanceSeries}}\n{{{.}}}\\n,\n{{/inMaintenanceSeries}}\n{{/trimTrailingComma}}\n\n\n{{#additionalInformation}}\nAdditional information: {{#jsonEscape}}{{{additionalInformation}}}{{/jsonEscape}}\n{{/additionalInformation}}\n\n{{{errorMessage}}}\n{{/isAlertOpened}}\n\n\n{{! Alert Updated section }}\n{{#isAlertUpdated}}\nAffected since: {{{sinceTime}}}\nEvent started: {{{startedTime}}}\n\nSources/Labels Affected:\n {{{hostsFailingMessage}}}\n\nSources/Labels In Maintenance:\n{{#trimTrailingComma}}\n {{#inMaintenanceSeries}}\n {{{.}}},\n {{/inMaintenanceSeries}}\n{{/trimTrailingComma}}\n\n\n{{#additionalInformation}}\nAdditional information: {{#jsonEscape}}{{{additionalInformation}}}{{/jsonEscape}}\n{{/additionalInformation}}\n\n{{{errorMessage}}}\n{{/isAlertUpdated}}\n\n\n{{! Alert Resolved section }}\n{{#isAlertResolved}}\nAffected since: {{sinceTime}}\nEvent started: {{startedTime}}\nEvent ended: {{endedTime}}\n\nSources/Labels recovered:\n{{#trimTrailingComma}}\n {{#recoveredHosts}}\n {{{.}}},\n {{/recoveredHosts}}\n{{/trimTrailingComma}}\n{{/isAlertResolved}}\n\n{{! Alert Maintenance section }}\n{{#isAlertMaintenance}}\nAffected since: {{sinceTime}}\nEvent started: {{startedTime}}\nEvent suspended: {{endedTime}}\n{{/isAlertMaintenance}}\n\n{{! Alert Snooze section }}\n{{#isAlertSnoozed}}\nSNOOZED UNTIL: {{snoozedUntilTime}}\n\n{{#sinceTime}}\nAffected since: {{sinceTime}}\n{{/sinceTime}}\n{{#startedTime}}\nEvent started: {{startedTime}}\n{{/startedTime}}\n\n{{{errorMessage}}}\n{{/isAlertSnoozed}}","createdEpochMillis":1551223121102,"updatedEpochMillis":1551223121102,"triggers":["ALERT_OPENED","ALERT_RESOLVED"],"recipient":"someone@example.com","customHttpHeaders":{},"emailSubject":"[{{#severity}}{{{severity}}}{{/severity}}] {{{name}}} ({{{notificationId}}})","isHtmlContent":true}],"offset":0,"limit":100,"totalItems":1,"moreItems":false}
@@ -0,0 +1 @@
1
+ {"items":[{"version":"4.30","name":"Proxy on cube-wavefront","id":"87eca9df-fc47-4a24-88cf-6dd0bae245a9","status":"ACTIVE","hostname":"cube-wavefront","customerId":"sysdef","inTrash":false,"lastCheckInTime":1551210920677,"timeDrift":-733,"sshAgent":false,"ephemeral":false,"deleted":false,"statusCause":""}],"offset":0,"limit":100,"totalItems":1,"moreItems":false}
@@ -0,0 +1 @@
1
+ {"query":"ts(cpu.*.pc.user, source=cube)","name":"ts(cpu.*.pc.user, source=cube)","warnings":null,"granularity":60,"timeseries":[{"label":"cpu.0.pc.user","host":"cube","tags":{"env":"lab"},"data":[[1551910740,2.504564434106667],[1551910800,2.9891517718583334],[1551910860,3.0707437561699997],[1551910920,2.7356552787066666],[1551910980,2.6886552710283333],[1551911040,2.6409568914183335],[1551911100,3.243982782701666],[1551911160,11.912555162798334],[1551911220,2.9900889261216665],[1551911280,2.64154789315]]},{"label":"cpu.1.pc.user","host":"cube","tags":{"env":"lab"},"data":[[1551910740,3.1569086322766666],[1551910800,3.573992008073334],[1551910860,2.872696577093333],[1551910920,2.6814954195116667],[1551910980,2.8941730453933334],[1551911040,3.146496631885],[1551911100,3.301025665921667],[1551911160,12.772283266686669],[1551911220,2.634188217441667],[1551911280,3.34500195371]]},{"label":"cpu.2.pc.user","host":"cube","tags":{"env":"lab"},"data":[[1551910740,2.724260094425],[1551910800,3.157979061788333],[1551910860,2.564134276005],[1551910920,2.786424234806667],[1551910980,2.968879251688333],[1551911040,2.4465109245883334],[1551911100,3.4172294831799994],[1551911160,14.187844540776666],[1551911220,2.829594856145],[1551911280,3.76687273418]]},{"label":"cpu.3.pc.user","host":"cube","tags":{"env":"lab"},"data":[[1551910740,3.162232979538333],[1551910800,3.07657094536],[1551910860,2.944080557145],[1551910920,3.1263298833433333],[1551910980,2.2805898422316666],[1551911040,2.6638552606166668],[1551911100,4.14221281067],[1551911160,10.638428183793334],[1551911220,3.1089379018283334],[1551911280,2.64862037469]]}],"stats":{"keys":615,"points":814,"summaries":202,"buffer_keys":615,"compacted_keys":3,"compacted_points":202,"latency":35,"queries":12,"s3_keys":0,"cpu_ns":7025719,"skipped_compacted_keys":3,"cached_compacted_keys":0,"query_tasks":0}}
@@ -0,0 +1 @@
1
+ {"items":[{"entityType":"ALERT","query":{"CLS alerts":"{\"searchTerms\":[{\"type\":\"tagContains\",\"value\":\"CLS\"},{\"type\":\"status\",\"value\":\"FIRING\"}],\"sortOrder\":\"ascending\",\"sortField\":null,\"pageNum\":1}"},"creatorId":"rob.fisher@bgch.co.uk","updaterId":"rob.fisher@bgch.co.uk","id":"WQyBfuhh","createdEpochMillis":1522146468908,"updatedEpochMillis":1522146468908,"userId":"rob.fisher@bgch.co.uk"}],"offset":0,"limit":100,"totalItems":1,"moreItems":false}
@@ -0,0 +1 @@
1
+ {"items":[{"identifier":"dev+sysdef@wavefront.com","customer":"sysdef","lastSuccessfulLogin":1549996596333,"groups":["agent_management","alerts_management","dashboard_management","ingestion","events_management","host_tag_management","user_management","embedded_charts","metrics_management","application_management","external_links_management"]},{"identifier":"rob@somewhere.xyz","customer":"sysdef","lastSuccessfulLogin":1550676149122,"groups":["agent_management","host_tag_management","events_management","alerts_management","dashboard_management","metrics_management","embedded_charts","ingestion","user_management","application_management","external_links_management"]},{"identifier":"sam@elsewhere.net","customer":"sysdef","lastSuccessfulLogin":1541000935563,"groups":[]},{"identifier":"services@example.com","customer":"sysdef","groups":[]},{"identifier":"someone@example.com","customer":"sysdef","lastSuccessfulLogin":1535977667674,"groups":["host_tag_management","dashboard_management","embedded_charts","metrics_management","agent_management","events_management","external_links_management","alerts_management","ingestion","user_management","application_management"]}],"offset":0,"limit":5,"totalItems":5,"modeItems":false}
@@ -0,0 +1 @@
1
+ {"items":[{"userCount":5,"properties":{"nameEditable":false,"permissionsEditable":true,"usersEditable":false},"permissions":[],"name":"Everyone","id":"2659191e-aad4-4302-a94e-9667e1517127","customer":"sysdef","createdEpochMillis":1542325388698},{"userCount":1,"permissions":["host_tag_management","alerts_management"],"name":"grp1","id":"6fd972d9-9a20-4872-acf9-4ef34797f14e","customer":"sysdef","createdEpochMillis":1550677765991},{"userCount":1,"permissions":["events_management","alerts_management","dashboard_management"],"name":"normal users","id":"cb61dae7-b476-43e6-a596-a6b514e71969","customer":"sysdef","createdEpochMillis":1550685485584}],"offset":0,"limit":100,"totalItems":3,"moreItems":false}
@@ -0,0 +1 @@
1
+ {"items":[{"description":"Slack alert webhook","method":"WEBHOOK","id":"CHTo47HvsPzSaGhh","customerId":"sysdef","title":"Slack Alerts","updaterId":"someone@example.com","creatorId":"someone@example.com","createdEpochMillis":1495191144779,"updatedEpochMillis":1497372763886,"template":"{{! Stuff. }}\n{{#setDefaultIterationLimit}}500{{/setDefaultIterationLimit}}\n{{#setFailingLimit}}500{{/setFailingLimit}}\n{{#setInMaintenanceLimit}}500{{/setInMaintenanceLimit}}\n{{#setNewlyFailingLimit}}500{{/setNewlyFailingLimit}}\n{{#setRecoveredLimit}}500{{/setRecoveredLimit}}\n{\n \"attachments\": [\n {\n \"fallback\": \"{{#jsonEscape}}{{{subject}}} {{{reason}}} [{{{severity}}}] {{{name}}}{{/jsonEscape}}\",\n \"pretext\": \"{{#jsonEscape}}{{{subject}}} {{{reason}}} [{{{severity}}}] {{{name}}}{{/jsonEscape}}\",\n \"text\": \"{{#jsonEscape}}{{{subject}}} {{{reason}}} [{{{severity}}}] {{{name}}}{{/jsonEscape}}\\nFailed Sources: \\n{{#jsonEscape}}{{{hostsFailingMessage}}}{{/jsonEscape}}\\nMessage: \\n{{#jsonEscape}}{{{errorMessage}}}{{/jsonEscape}}\",\n \"mrkdwn_in\": [\n \"text\",\n \"pretext\",\n \"fields\"\n ],\n \"fields\": [\n {\n \"title\": \"Get Iteration Limit\",\n \"value\": \"defaultIterationLimit: {{{defaultIterationLimit}}}, failingLimit: {{{failingLimit}}}, inMaintenanceLimit: {{{inMaintenanceLimit}}}, newlyFailingLimit: {{{newlyFailingLimit}}}, recoveredLimit: {{{recoveredLimit}}}\",\n \"short\": false\n },\n {\n \"title\": \"Get Iteration Limit Exceed\",\n \"value\": \"failingLimitExceed: {{{failingLimitExceed}}}, inMaintenanceLimitExceed: {{{inMaintenanceLimitExceed}}}, newlyFailingLimitExceed: {{{newlyFailingLimitExceed}}}, recoveredLimitExceed: {{{recoveredLimitExceed}}}\",\n \"short\": false\n },\n {\n \"title\": \"Notification ID\",\n \"value\": \"{{#jsonEscape}}{{{notificationId}}}{{/jsonEscape}}\",\n \"short\": false\n },\n {\n \"title\": \"Reason\",\n \"value\": \"{{#jsonEscape}}{{{reason}}}{{/jsonEscape}}\",\n \"short\": true\n },\n {\n \"title\": \"Alert ID\",\n \"value\": \"{{#jsonEscape}}{{{alertId}}}{{/jsonEscape}}\",\n \"short\": true\n },\n {\n \"title\": \"Alert Tags\",\n \"value\": \"{{#jsonEscape}}{{#alertTags}}{{{.}}},{{/alertTags}}{{/jsonEscape}}\",\n \"short\": true\n },\n {\n \"title\": \"Severity\",\n \"value\": \"{{#jsonEscape}}{{{severity}}}{{/jsonEscape}}\",\n \"short\": true\n },\n {\n \"title\": \"Condition\",\n \"value\": \"{{#jsonEscape}}{{{condition}}}{{/jsonEscape}}\",\n \"short\": true\n },\n {\n \"title\": \"URL\",\n \"value\": \"<{{{url}}}>\",\n \"short\": true\n },\n {\n \"title\": \"Created Time\",\n \"value\": \"{{#jsonEscape}}{{{createdTime}}}{{/jsonEscape}}\",\n \"short\": true\n },\n {\n \"title\": \"Started Time\",\n \"value\": \"{{#jsonEscape}}{{{startedTime}}}{{/jsonEscape}}\",\n \"short\": true\n },\n {\n \"title\": \"Since Time\",\n \"value\": \"{{#jsonEscape}}{{{sinceTime}}}{{/jsonEscape}}\",\n \"short\": true\n },\n {\n \"title\": \"Ended Time\",\n \"value\": \"{{#jsonEscape}}{{{endedTime}}}{{/jsonEscape}}\",\n \"short\": true\n },\n {\n \"title\": \"Snoozed Until Time\",\n \"value\": \"{{#jsonEscape}}{{{snoozedUntilTime}}}{{/jsonEscape}}\",\n \"short\": true\n },\n {\n \"title\": \"Additional Information\",\n \"value\": \"{{#jsonEscape}}{{{additionalInformation}}}{{/jsonEscape}}\",\n \"short\": false\n },\n {\n \"title\": \"Failing Sources\",\n \"value\": \"{{#jsonEscape}}{{#failingHosts}}{{{.}}},{{/failingHosts}}{{/jsonEscape}}\",\n \"short\": false\n },\n {\n \"title\": \"In Maintenance Sources\",\n \"value\": \"{{#jsonEscape}}{{#inMaintenanceHosts}}{{{.}}},{{/inMaintenanceHosts}}{{/jsonEscape}}\",\n \"short\": false\n },\n {\n \"title\": \"Newly Failing Sources\",\n \"value\": \"{{#jsonEscape}}{{#newlyFailingHosts}}{{{.}}},{{/newlyFailingHosts}}{{/jsonEscape}}\",\n \"short\": false\n },\n {\n \"title\": \"Recovered Sources\",\n \"value\": \"{{#jsonEscape}}{{#recoveredHosts}}{{{.}}},{{/recoveredHosts}}{{/jsonEscape}}\",\n \"short\": false\n },\n {\n \"title\": \"Failing Series\",\n \"value\": \"{{#jsonEscape}}{{#failingSeries}}{{{.}}},{{/failingSeries}}{{/jsonEscape}}\",\n \"short\": false\n },\n {\n \"title\": \"In Maintenance Series\",\n \"value\": \"{{#jsonEscape}}{{#inMaintenanceSeries}}{{{.}}},{{/inMaintenanceSeries}}{{/jsonEscape}}\",\n \"short\": false\n },\n {\n \"title\": \"Newly Failing Series\",\n \"value\": \"{{#jsonEscape}}{{#newlyFailingSeries}}{{{.}}},{{/newlyFailingSeries}}{{/jsonEscape}}\",\n \"short\": false\n },\n {\n \"title\": \"Recovered Series\",\n \"value\": \"{{#jsonEscape}}{{#recoveredSeries}}{{{.}}},{{/recoveredSeries}}{{/jsonEscape}}\",\n \"short\": false\n }\n ]\n }\n ]\n}\n","triggers":["ALERT_OPENED","ALERT_SNOOZED","ALERT_RESOLVED"],"recipient":"https://hooks.slack.com/services/ABCDEFGHI/BkdkQN1F0/ZRUeWR8Dk4kVk321j52Wfijf"}],"offset":0,"limit":100,"totalItems":1,"moreItems":false}
@@ -0,0 +1 @@
1
+ {"items":[{"id":"1538845614480","reason":"CLI testing","customerId":"sysdef","relevantCustomerTags":[],"title":"test_1","startTimeInSeconds":1538848800,"endTimeInSeconds":1538849400,"relevantHostTags":["physical"],"creatorId":"someone@example.com","updaterId":"someone@example.com","createdEpochMillis":1538845614480,"updatedEpochMillis":1538845614480,"eventName":"Maintenance Window: test_1","runningState":"ENDED","sortAttr":1000000},{"id":"1538845632142","reason":"CLI testing","customerId":"sysdef","relevantCustomerTags":[],"title":"test_2","startTimeInSeconds":1538812800,"endTimeInSeconds":1538813400,"relevantHostTags":["physical"],"creatorId":"someone@example.com","updaterId":"someone@example.com","createdEpochMillis":1538845632142,"updatedEpochMillis":1538845632142,"eventName":"Maintenance Window: test_2","runningState":"ENDED","sortAttr":1000000},{"id":"1538845726401","reason":"CLI testing","customerId":"sysdef","relevantCustomerTags":[],"title":"test_3","startTimeInSeconds":1538845200,"endTimeInSeconds":1538847000,"relevantHostTags":["physical"],"creatorId":"someone@example.com","updaterId":"someone@example.com","createdEpochMillis":1538845726401,"updatedEpochMillis":1538845726401,"eventName":"Maintenance Window: test_3","runningState":"ENDED","sortAttr":1000000},{"id":"1538849825434","reason":"CLI testing","customerId":"sysdef","relevantCustomerTags":[],"title":"test_4","startTimeInSeconds":1538852400,"endTimeInSeconds":1538854200,"relevantHostTags":["physical"],"creatorId":"someone@example.com","updaterId":"someone@example.com","createdEpochMillis":1538849825434,"updatedEpochMillis":1538849825434,"eventName":"Maintenance Window: test_4","runningState":"ENDED","sortAttr":1000000},{"id":"1538849965371","reason":"CLI testing","customerId":"sysdef","relevantCustomerTags":[],"title":"test_4","startTimeInSeconds":1538852400,"endTimeInSeconds":1538854200,"relevantHostTags":["physical"],"creatorId":"someone@example.com","updaterId":"someone@example.com","createdEpochMillis":1538849965371,"updatedEpochMillis":1538849965371,"eventName":"Maintenance Window: test_4 (1)","runningState":"ENDED","sortAttr":1000000},{"id":"1538853277556","reason":"CLI testing","customerId":"sysdef","relevantCustomerTags":[],"title":"test_5","startTimeInSeconds":1538856000,"endTimeInSeconds":1538857800,"relevantHostTags":["physical"],"creatorId":"someone@example.com","updaterId":"someone@example.com","createdEpochMillis":1538853277556,"updatedEpochMillis":1538853277556,"eventName":"Maintenance Window: test_5","runningState":"ENDED","sortAttr":1000000},{"id":"1538854418453","reason":"CLI testing","customerId":"sysdef","relevantCustomerTags":[],"title":"test_6","startTimeInSeconds":1538863200,"endTimeInSeconds":1538865000,"relevantHostTags":["physical"],"creatorId":"someone@example.com","updaterId":"someone@example.com","createdEpochMillis":1538854418453,"updatedEpochMillis":1538854418453,"eventName":"Maintenance Window: test_6","runningState":"ENDED","sortAttr":1000000},{"id":"1538854420284","reason":"CLI testing","customerId":"sysdef","relevantCustomerTags":[],"title":"test_6","startTimeInSeconds":1538863200,"endTimeInSeconds":1538865000,"relevantHostTags":["physical"],"creatorId":"someone@example.com","updaterId":"someone@example.com","createdEpochMillis":1538854420284,"updatedEpochMillis":1538854420284,"eventName":"Maintenance Window: test_6 (1)","runningState":"ENDED","sortAttr":1000000},{"id":"1538854432488","reason":"CLI testing","customerId":"sysdef","relevantCustomerTags":[],"title":"test_8","startTimeInSeconds":1538852400,"endTimeInSeconds":1538854800,"relevantHostTags":["physical"],"creatorId":"someone@example.com","updaterId":"someone@example.com","createdEpochMillis":1538854432488,"updatedEpochMillis":1538854432488,"eventName":"Maintenance Window: test_8","runningState":"ENDED","sortAttr":1000000}],"offset":0,"limit":100,"totalItems":9,"moreItems":false}
@@ -25,4 +25,5 @@ describe "#{word} command" do
25
25
  matchingMethod: 'CONTAINS' }],
26
26
  sort: { field: 'id', ascending: true } },
27
27
  headers: JSON_POST_HEADERS }, WavefrontCli::SavedSearch)
28
+ test_list_output(word, k)
28
29
  end
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../spec_helper'
4
+ require_relative '../../lib/wavefront-cli/settings'
5
+
6
+ word = 'settings'
7
+
8
+ describe "#{word} command" do
9
+ missing_creds(word, ['list permissions', 'show preferences',
10
+ 'default usergroups'])
11
+ cmd_to_call(word, 'list permissions',
12
+ path: '/api/v2/customer/permissions')
13
+
14
+ cmd_to_call(word, 'show preferences',
15
+ path: '/api/v2/customer/preferences')
16
+
17
+ cmd_to_call(word, 'default usergroups',
18
+ path: '/api/v2/customer/preferences/defaultUserGroups')
19
+ end
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../../../lib/wavefront-cli/stdlib/array'
4
+
5
+ # Test extensions to stlib Array
6
+ #
7
+ class TestArray < MiniTest::Test
8
+ def test_max_length
9
+ assert_equal(7, %w[short longer longest].max_length)
10
+ assert_equal(7, %i[short longer longest].max_length)
11
+ assert_equal(0, [].max_length)
12
+ end
13
+
14
+ def test_longest_value_of
15
+ input = [{ a: 'abc', b: 'def' }, { a: 'g', b: 'hjkl' }]
16
+ assert_equal(3, input.longest_value_of(:a))
17
+ assert_equal(4, input.longest_value_of(:b))
18
+ assert_equal(0, input.longest_value_of(:c))
19
+ end
20
+ end
@@ -8,7 +8,8 @@ require_relative '../../../lib/wavefront-cli/commands/base'
8
8
  #
9
9
  class StringTest < MiniTest::Test
10
10
  def test_cmd_fold
11
- str = "command subcommand #{CMN} [-a alpha] [-b beta] [-c gamma] <id>"
11
+ cmn = '[-DnV] [-c file] [-P profile] [-E endpoint] [-t token]'
12
+ str = "command subcommand #{cmn} [-a alpha] [-b beta] [-c gamma] <id>"
12
13
  assert_equal(str.cmd_fold,
13
14
  'command subcommand [-DnV] [-c file] [-P profile] ' \
14
15
  "[-E endpoint]\n [-t token] [-a alpha] " \
@@ -66,4 +67,15 @@ class StringTest < MiniTest::Test
66
67
  assert_equal('unchanged', 'unchanged'.to_snake)
67
68
  assert_equal('Unchanged', 'Unchanged'.to_snake)
68
69
  end
70
+
71
+ def test_value_fold
72
+ input = 'A reasonably long string which might for instance be a ' \
73
+ 'descripton of an alert. Perhaps an embedded runbook.'
74
+
75
+ expected = 'A reasonably long string which might for
76
+ instance be a descripton of an alert.
77
+ Perhaps an embedded runbook.'
78
+
79
+ assert_equal(expected, input.value_fold(38))
80
+ end
69
81
  end
@@ -115,4 +115,5 @@ describe "#{word} command" do
115
115
  ["GET https://metrics.wavefront.com/api/v2/#{word}"])
116
116
  cmd_noop(word, 'describe rob@a.com',
117
117
  ["GET https://metrics.wavefront.com/api/v2/#{word}/rob@a.com"])
118
+ test_list_output(word)
118
119
  end
@@ -107,4 +107,5 @@ describe "#{word} command" do
107
107
  ["GET https://metrics.wavefront.com/api/v2/#{word}"], k)
108
108
  cmd_noop(word, "describe #{gid1}",
109
109
  ["GET https://metrics.wavefront.com/api/v2/#{word}/#{gid1}"], k)
110
+ test_list_output(word, k)
110
111
  end
@@ -24,4 +24,5 @@ describe "#{word} command" do
24
24
  matchingMethod: 'CONTAINS' }],
25
25
  sort: { field: 'id', ascending: true } },
26
26
  headers: JSON_POST_HEADERS)
27
+ test_list_output(word)
27
28
  end
@@ -12,10 +12,177 @@ class WavefrontCliWriteTest < MiniTest::Test
12
12
  @wf = WavefrontCli::Write.new({})
13
13
  end
14
14
 
15
+ def test_validate_opts
16
+ assert WavefrontCli::Write.new(using: 'unix',
17
+ socket: '/tmp/sock').validate_opts
18
+ assert WavefrontCli::Write.new(proxy: 'wavefront').validate_opts
19
+ assert_raises 'WavefrontCli::Exception::CredentialError' do
20
+ WavefrontCli::Write.new.validate_opts
21
+ end
22
+
23
+ assert_raises 'WavefrontCli::Exception::CredentialError' do
24
+ WavefrontCli::Write.new(using: 'unix').validate_opts
25
+ end
26
+ end
27
+
28
+ def test_validate_opts_file
29
+ assert WavefrontCli::Write.new(
30
+ proxy: 'wavefront', metric: 'metric.path'
31
+ ).validate_opts_file
32
+
33
+ assert WavefrontCli::Write.new(
34
+ proxy: 'wavefront', infileformat: 'fmv'
35
+ ).validate_opts_file
36
+
37
+ assert_raises 'WavefrontCli::Exception::InsufficientData' do
38
+ WavefrontCli::Write.new(proxy: 'wavefront').validate_opts_file
39
+ end
40
+
41
+ assert_raises 'WavefrontCli::Exception::InsufficientData' do
42
+ WavefrontCli::Write.new(
43
+ proxy: 'wavefront', infileformat: 'fv'
44
+ ).validate_opts_file
45
+ end
46
+ end
47
+
48
+ def test_process_line
49
+ assert wf.process_line('')
50
+
51
+ wf1 = WavefrontCli::Write.new(tag: ['t1=v1'])
52
+ wf1.setup_fmt('mv')
53
+
54
+ assert_equal({ path: 'my.path', tags: { t1: 'v1' }, value: 1.23 },
55
+ wf1.process_line('my.path 1.23'))
56
+
57
+ assert_raises('WavefrontCli::Exception::UnparseableInput') do
58
+ wf1.process_line('10')
59
+ end
60
+
61
+ assert_raises('WavefrontCli::Exception::UnparseableInput') do
62
+ wf1.process_line('my.path 10 t2=v2')
63
+ end
64
+
65
+ wf2 = WavefrontCli::Write.new({})
66
+ wf2.setup_fmt('tmvT')
67
+
68
+ assert_equal({ path: 'my.path',
69
+ value: 1.23,
70
+ ts: 1_553_269_739,
71
+ tags: { k1: 'value 1' } },
72
+ wf2.process_line('1553269739 my.path 1.23 k1="value 1"'))
73
+ end
74
+
75
+ def test_extract_tags
76
+ assert_equal({ k1: 'v1' },
77
+ wf.extract_tags(['path', '10', 'k1=v1']))
78
+
79
+ assert_equal({ k1: 'v1', k2: 'v2' },
80
+ wf.extract_tags(['path', '10', 'k1=v1 k2=v2']))
81
+
82
+ assert_equal({ k1: 'val 1', k2: 'val 2' },
83
+ wf.extract_tags(['path', '10', 'k1="val 1" k2="val 2"']))
84
+
85
+ assert_equal({}, wf.extract_tags(%w[path 10]))
86
+ end
87
+
88
+ def test_tags_to_hash
89
+ assert_nil wf.tags_to_hash(nil)
90
+ assert_equal({ k1: 'v1', k2: 'v2' }, wf.tags_to_hash(%w[k1=v1 k2=v2]))
91
+ assert_equal({ k1: 'v1', k2: 'v2' }, wf.tags_to_hash(%w[k1=v1 junk k2=v2]))
92
+ assert_equal({ 'key 1': 'value 1', k2: 'v2' },
93
+ wf.tags_to_hash(['"key 1"="value 1"', 'k2=v2']))
94
+ assert_equal({ 'key 1': 'value 1', k2: 'v2' },
95
+ wf.tags_to_hash(["'key 1'='value 1'", 'k2=v2']))
96
+ assert_equal({ k1: 'v1', k2: '' }, wf.tags_to_hash(%w[k1=v1 k2=]))
97
+ assert_equal({ k1: 'v1', k2: 'v2' }, wf.tags_to_hash([%w[k1=v1 k2=v2]]))
98
+ end
99
+
100
+ def test_valid_format?
101
+ %w[v mv vm tmv mtv mvT msvT tmvT].each do |str|
102
+ assert wf.valid_format?(str)
103
+ end
104
+
105
+ e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
106
+ wf.valid_format?('mvd')
107
+ end
108
+ assert_equal("'v' and 'd' are mutually exclusive", e.message)
109
+
110
+ e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
111
+ wf.valid_format?('mtT')
112
+ end
113
+ assert_equal("format string must include 'v' or 'd'", e.message)
114
+
115
+ e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
116
+ wf.valid_format?('mxvT')
117
+ end
118
+ assert_equal('unsupported field in format string', e.message)
119
+
120
+ e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
121
+ wf.valid_format?('mvvT')
122
+ end
123
+ assert_equal('repeated field in format string', e.message)
124
+
125
+ e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
126
+ wf.valid_format?('mTv')
127
+ end
128
+ assert_equal("if used, 'T' must come at end of format string",
129
+ e.message)
130
+ end
131
+
132
+ def test_enough_fields?
133
+ wf1 = WavefrontCli::Write.new({})
134
+ wf1.setup_fmt('mv')
135
+
136
+ assert wf1.enough_fields?('metric 100')
137
+ e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
138
+ wf1.enough_fields?('100')
139
+ end
140
+ assert_equal('Expected 2 fields, got 1', e.message)
141
+
142
+ e = assert_raises('WavefrontCli::Exception::UnparseableInput') do
143
+ wf1.enough_fields?('metric 100 key="my value"')
144
+ end
145
+ assert_equal('Expected 2 fields, got 3', e.message)
146
+ end
147
+
148
+ def test_valid_timestamp?
149
+ assert wf.valid_timestamp?(Time.now.to_i)
150
+ refute wf.valid_timestamp?(Time.new(1999, 11, 30).to_i)
151
+ refute wf.valid_timestamp?(Time.now.to_i + 367 * 24 * 60 * 60)
152
+ end
153
+
154
+ def test__sdk_class_and_default_port
155
+ assert_equal('Wavefront::Write', wf._sdk_class)
156
+ assert_equal(2878, wf.default_port)
157
+ wf1 = WavefrontCli::Write.new(infileformat: 'mdT')
158
+ assert_equal('Wavefront::Distribution', wf1._sdk_class)
159
+ assert_equal(40_000, wf1.default_port)
160
+ wf2 = WavefrontCli::Write.new(distribution: true)
161
+ assert_equal('Wavefront::Distribution', wf2._sdk_class)
162
+ assert_equal(40_000, wf2.default_port)
163
+ end
164
+
165
+ def test_process_input_file
166
+ wf1 = WavefrontCli::Write.new({})
167
+ wf1.setup_fmt('mv')
168
+ d1 = ['my.path 1', 'my.path 2', 'my.path 3']
169
+ assert_equal([{ path: 'my.path', value: 1.0 },
170
+ { path: 'my.path', value: 2.0 },
171
+ { path: 'my.path', value: 3.0 }],
172
+ wf1.process_input_file(d1))
173
+ end
174
+
15
175
  def test_expand_dist
16
176
  assert_equal(wf.expand_dist([1, 1, 1]), [1, 1, 1])
17
177
  assert_equal(wf.expand_dist(['3x1']), [1, 1, 1])
18
178
  assert_equal(wf.expand_dist(%w[3x1 1x4]), [1, 1, 1, 4])
19
179
  assert_equal(wf.expand_dist([1, 1, 1, '2x2']).sort, [2, 2, 1, 1, 1].sort)
20
180
  end
181
+
182
+ def test_distribution?
183
+ assert WavefrontCli::Write.new(distribution: true).distribution?
184
+ assert WavefrontCli::Write.new(infileformat: 'fmd').distribution?
185
+ refute WavefrontCli::Write.new(infileformat: 'fma').distribution?
186
+ refute WavefrontCli::Write.new({}).distribution?
187
+ end
21
188
  end