echo_cli 0.6.24 → 0.6.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 537ec20884b3c05147674526146f25b8ebf0474a
4
- data.tar.gz: c7ad1453a7a2d869b9ab9e29c930c64d0dceff54
3
+ metadata.gz: bf3652734735f3b562afe8c8036c6a0bee734280
4
+ data.tar.gz: 753163b93233f69e2d3001d1ad20daf3c5c4776a
5
5
  SHA512:
6
- metadata.gz: 75ba0d042d62907438458afc289eb810d82550f07db4a6b6a72e418e0354502ae2f50adac75f7fad5803cb0ee88a5207f54f1a53beb88282d13ba9c699031ce3
7
- data.tar.gz: ad9060d4d8e05373016b23c3990863f9146e01dbfea0a4dcbeef944d67f92f350f640d880e1cbb39fb1036e7ba994937319ab5551a8cb71d51815bb4c9bf3ec1
6
+ metadata.gz: 2a8ca42b69ef97783cc919d1c8859a40dd6abada247cc8667ddc4f434473b9369d12fdde523add83c662917b2be0083307638d3d80369bbb14b9246546504dc8
7
+ data.tar.gz: 4691ad7376667dcc69ddd2cb5f389b1c04f8817207a6d81ade8330a5e70ca32e51a04f0a160156e9165e19f4744c91ad8fff5394bcdf89aeb911eb44e041c98c
data/lib/echo_cli/cli.rb CHANGED
@@ -21,6 +21,8 @@ module Echo_cli
21
21
 
22
22
  Ensure single-quotes surround the metric.
23
23
 
24
+ Ensure the environment variable 'ECHO_CLI_HOST' is set to the correct IP.
25
+
24
26
  With -q (query-verify) option, post will perform a query of previously posted metric in Echo's instance of OpenTSDB, and provide a message verifying the datapoint exists.
25
27
 
26
28
  With -v (verbose) option, post will continuously output a 'successfully posted' message, with updated times, to the command line, if the 'number' argument is specified.
@@ -29,6 +31,7 @@ module Echo_cli
29
31
  LONGDESC
30
32
 
31
33
  def post(metric, num = 0)
34
+ Helper.new.check_for_IP()
32
35
  statsd_uri = "https://" + ENV["ECHO_CLI_HOST"] + ":8125/metrix"
33
36
 
34
37
  Helper.new.set_envs()
@@ -124,6 +127,8 @@ module Echo_cli
124
127
 
125
128
  Ensure single-quotes surround the metric.
126
129
 
130
+ Ensure the environment variable 'ECHO_CLI_HOST' is set to the correct IP.
131
+
127
132
  With -v (verbose) option, cpost will continuously output a 'successfully posted' message, with updated times, to the command line.
128
133
 
129
134
  With -z (zombie) option, cpost will continuously send posts to Echo in the background, and return its PID for future removal. Use "$ kill -9 <PID>" to kill the zombie process. Specifying this option will override the '-v' option.
@@ -132,6 +137,8 @@ module Echo_cli
132
137
  LONGDESC
133
138
 
134
139
  def cpost(metric, num = 0)
140
+ Helper.new.check_for_IP()
141
+
135
142
  statsd_uri = "https://" + ENV["ECHO_CLI_HOST"] + ":8125/metrix"
136
143
 
137
144
  Helper.new.set_envs()
@@ -200,6 +207,8 @@ module Echo_cli
200
207
 
201
208
  Ensure single-quotes surround the metric.
202
209
 
210
+ Ensure the environment variable 'ECHO_CLI_HOST' is set to the correct IP.
211
+
203
212
  Unlike the echo_cli post command, query does not require the data value nor the data type (e.g. remove ':1|c' from 'example.post:1|c' and your query will still work).
204
213
 
205
214
  With -v (verbose) option, query will print the status code and response body upon completion of the request.
@@ -212,6 +221,8 @@ module Echo_cli
212
221
  LONGDESC
213
222
 
214
223
  def query(metric, time_start, time_end)
224
+ Helper.new.check_for_IP()
225
+
215
226
  opentsdb_uri = "https://" + ENV["ECHO_CLI_HOST"] + ":4242/api/query"
216
227
 
217
228
  metric = Helper.new.get_metric(metric)
@@ -290,6 +301,8 @@ module Echo_cli
290
301
 
291
302
  Ensure single-quotes surround the metric.
292
303
 
304
+ Ensure the environment variable 'ECHO_CLI_HOST' is set to the correct IP.
305
+
293
306
  Unlike the echo_cli post command, fquery does not require the data value nor the data type (e.g. remove ':1|c' from 'example.post:1|c' and your query will still work).
294
307
 
295
308
  The <range> parameter is defined in seconds, and is used to query the metric from the current time.
@@ -304,6 +317,8 @@ module Echo_cli
304
317
  LONGDESC
305
318
 
306
319
  def fquery(metric, range)
320
+ Helper.new.check_for_IP()
321
+
307
322
  opentsdb_uri = "https://" + ENV["ECHO_CLI_HOST"] + ":4242/api/query"
308
323
 
309
324
  time_end = Time.new.to_i
@@ -491,5 +506,11 @@ module Echo_cli
491
506
  ENV["https_proxy"] = ENV[""]
492
507
  end
493
508
 
509
+ def check_for_IP
510
+ if !ENV["ECHO_CLI_HOST"] || ENV["ECHO_CLI_HOST"] == ''
511
+ puts "\nFailed to find IP or URL. Please set the environment variable: ".red + "'ECHO_CLI_HOST'".yellow + " to continue.".red
512
+ exit
513
+ end
514
+ end
494
515
  end
495
516
  end
@@ -1,3 +1,3 @@
1
1
  module Echo_cli
2
- VERSION = "0.6.24"
2
+ VERSION = "0.6.25"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: echo_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.24
4
+ version: 0.6.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Raphael
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-24 00:00:00.000000000 Z
11
+ date: 2017-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor