echo_cli 0.6.23 → 0.6.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -5
- data/lib/echo_cli/cli.rb +15 -4
- data/lib/echo_cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 537ec20884b3c05147674526146f25b8ebf0474a
|
4
|
+
data.tar.gz: c7ad1453a7a2d869b9ab9e29c930c64d0dceff54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75ba0d042d62907438458afc289eb810d82550f07db4a6b6a72e418e0354502ae2f50adac75f7fad5803cb0ee88a5207f54f1a53beb88282d13ba9c699031ce3
|
7
|
+
data.tar.gz: ad9060d4d8e05373016b23c3990863f9146e01dbfea0a4dcbeef944d67f92f350f640d880e1cbb39fb1036e7ba994937319ab5551a8cb71d51815bb4c9bf3ec1
|
data/README.md
CHANGED
@@ -48,7 +48,7 @@ Test the installation to ensure it is working properly (no errors should occur i
|
|
48
48
|
$ echo_cli
|
49
49
|
```
|
50
50
|
|
51
|
-
Finally, export the environment variable "ECHO_CLI_HOST", and set this value to be the IP of the Echo instance you would like to use (e.g. export ECHO_CLI_HOST=
|
51
|
+
Finally, export the environment variable "ECHO_CLI_HOST", and set this value to be the IP of the Echo instance you would like to use (e.g. export ECHO_CLI_HOST=XX.XXX.XXX.XXX). This environment variable can be set inside your .bashrc file to ensure ease of use of the Echo CLI every time you create a new bash environment.
|
52
52
|
|
53
53
|
## Metrics Explained
|
54
54
|
|
@@ -154,7 +154,7 @@ $ echo_cli now
|
|
154
154
|
|
155
155
|
#### post
|
156
156
|
```bash
|
157
|
-
$ echo_cli post '<metric>' {number} {-q}
|
157
|
+
$ echo_cli post '<metric>' {number} {-q} {-v}
|
158
158
|
```
|
159
159
|
Parameters:
|
160
160
|
|
@@ -162,13 +162,15 @@ Parameters:
|
|
162
162
|
|
163
163
|
`{number}`: (optional) the number of posts to occur, e.g. a number value of '10' would post the metric 10 times to the StatsD server
|
164
164
|
|
165
|
-
`{-q}`: (optional) does an automatic query of OpenTSDB immediately following the successful post of the metric to ensure the data transfer between StatsD and OpenTSDB. This option requires approx. 15 seconds to complete, as data flush and HA require ~15 seconds to occur
|
165
|
+
`{-q}`: (optional) does an automatic query of OpenTSDB immediately following the successful post of the metric to ensure the data transfer between StatsD and OpenTSDB. This option requires approx. 15 seconds to complete, as data flush and HA require ~15 seconds to occur.
|
166
|
+
|
167
|
+
`{-v}`: (optional) continuously output a 'successfully posted' message, with updated start and end times, to the command line.
|
166
168
|
|
167
169
|
Example:
|
168
170
|
```bash
|
169
|
-
$ echo_cli 'sample.post.here:1|c' 10 -q
|
171
|
+
$ echo_cli 'sample.post.here:1|c' 10 -q -v
|
170
172
|
```
|
171
|
-
The previous example would post the application name 'sample' with tags 'post' and 'here' with data value '1' and with data type 'c' (for count). This information would be posted to the instance of StatsD, and it would be posted 10 times. Additionally, because of the '-q' specified option, OpenTSDB will be queried immediately after the post to StatsD, to verify it has been received by Echo's instance of OpenTSDB.
|
173
|
+
The previous example would post the application name 'sample' with tags 'post' and 'here' with data value '1' and with data type 'c' (for count). This information would be posted to the instance of StatsD, and it would be posted 10 times. Additionally, because of the '-q' specified option, OpenTSDB will be queried immediately after the post to StatsD, to verify it has been received by Echo's instance of OpenTSDB. The '-v' option will cause the CLI to continuously output a "Successfully posted" message each time a data point is sent.
|
172
174
|
|
173
175
|
#### query
|
174
176
|
```bash
|
@@ -220,6 +222,8 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
220
222
|
|
221
223
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
222
224
|
|
225
|
+
***Be sure to delete any old echo_cli-gem files before committing***
|
226
|
+
|
223
227
|
```bash
|
224
228
|
$ bundle install
|
225
229
|
|
data/lib/echo_cli/cli.rb
CHANGED
@@ -9,9 +9,10 @@ require 'openssl'
|
|
9
9
|
|
10
10
|
module Echo_cli
|
11
11
|
class Echo < Thor
|
12
|
-
desc "post", "Post metrics to Echo. Use \"echo_cli post '<metric>' {number} {-q}\""
|
12
|
+
desc "post", "Post metrics to Echo. Use \"echo_cli post '<metric>' {number} {-q} {-v}\""
|
13
13
|
|
14
14
|
option :q
|
15
|
+
option :v
|
15
16
|
|
16
17
|
long_desc <<-LONGDESC
|
17
18
|
`echo_cli post` will post a metric directly to Echo's StatsD server.
|
@@ -22,7 +23,9 @@ module Echo_cli
|
|
22
23
|
|
23
24
|
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.
|
24
25
|
|
25
|
-
|
26
|
+
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.
|
27
|
+
|
28
|
+
> $ echo_cli post 'example.post:1|c' {10} {-q} {-v}
|
26
29
|
LONGDESC
|
27
30
|
|
28
31
|
def post(metric, num = 0)
|
@@ -45,13 +48,21 @@ module Echo_cli
|
|
45
48
|
time_start = Time.new.to_i.to_s
|
46
49
|
|
47
50
|
for i in 1..num.to_i
|
51
|
+
time_temp_start = Time.new.to_i.to_s
|
52
|
+
|
48
53
|
response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
|
49
54
|
http.request(request)
|
50
55
|
end
|
56
|
+
|
57
|
+
time_temp_end = Time.new.to_i.to_s
|
58
|
+
|
51
59
|
if response.code != '200'
|
52
60
|
puts "Final run at: " + i + " of " + num
|
53
61
|
raise
|
54
62
|
end
|
63
|
+
if(options[:v] && response.code == '200')
|
64
|
+
puts "\nSuccessfully posted ".green + request.body.yellow + " to ".green + statsd_uri.blue + "\nTime start: ".green + time_temp_start.yellow + ", Time end: ".green + time_temp_end.yellow + "\n"
|
65
|
+
end
|
55
66
|
end
|
56
67
|
|
57
68
|
if options[:q]
|
@@ -63,7 +74,7 @@ module Echo_cli
|
|
63
74
|
|
64
75
|
if options[:q]
|
65
76
|
opentsdb_uri = statsd_uri[0..statsd_uri.index(':8125')-1] + ":4242/api/query"
|
66
|
-
query(
|
77
|
+
query(request.body[0..request.body.index(":")-1], time_start, time_end)
|
67
78
|
end
|
68
79
|
|
69
80
|
rescue
|
@@ -89,7 +100,7 @@ module Echo_cli
|
|
89
100
|
|
90
101
|
if options[:q]
|
91
102
|
opentsdb_uri = statsd_uri[0..statsd_uri.index(':8125')-1] + ":4242/api/query"
|
92
|
-
query(
|
103
|
+
query(request.body[0..request.body.index(":")-1], time_start, time_end)
|
93
104
|
end
|
94
105
|
end
|
95
106
|
rescue
|
data/lib/echo_cli/version.rb
CHANGED
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.
|
4
|
+
version: 0.6.24
|
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-
|
11
|
+
date: 2017-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|