cdn_manager_pcache_probe 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5c18455fdc55f89cc92409b0125585c42d3a448
|
4
|
+
data.tar.gz: 7114fbb968368c42b6a1412193e3b864197a909c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 479d811d64090730fae41096b3c79c5c802c8dd1a27c361b6e60f0dd1a3508c03de8edc5124130642eb9103f0f045074a0aca09f2e54100527df4fa1bc2f030b
|
7
|
+
data.tar.gz: faada5c2926833d5053384aeb342136ab2546fda9279b0b4e98586bff33c23f6b3479ca770a95914405de299f05f987778017513cc556af82d018242c794d9df
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cdn_manager_pcache_probe (0.
|
4
|
+
cdn_manager_pcache_probe (0.5)
|
5
5
|
multi_json (~> 1.11)
|
6
6
|
rest-client (~> 1.8)
|
7
7
|
thor (~> 0.19)
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
mime-types (2.99)
|
17
17
|
multi_json (1.11.2)
|
18
18
|
netrc (0.11.0)
|
19
|
-
rake (10.
|
19
|
+
rake (10.5.0)
|
20
20
|
rest-client (1.8.0)
|
21
21
|
http-cookie (>= 1.0.2, < 2.0)
|
22
22
|
mime-types (>= 1.16, < 3.0)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "thor"
|
2
|
+
require "rest-client"
|
2
3
|
require "cdn_manager_pcache_probe/version"
|
3
4
|
require "cdn_manager_pcache_probe/connector"
|
4
5
|
|
@@ -44,12 +45,29 @@ module CdnManagerPcacheProbe
|
|
44
45
|
option :debug,
|
45
46
|
desc: "print debug output",
|
46
47
|
type: :boolean
|
48
|
+
option :api_base_url,
|
49
|
+
desc: "cdn-manager-api base url to HTTP-POST result to"
|
50
|
+
option :api_key,
|
51
|
+
desc: "cdn-manager-api key"
|
52
|
+
option :service_name,
|
53
|
+
desc: "cdn-manager service name"
|
54
|
+
option :metric_name,
|
55
|
+
desc: "cdn-manager service name",
|
56
|
+
default: "pcache_total_bw"
|
47
57
|
def collect
|
48
58
|
bytes_sent = CdnManagerPcacheProbe::Connector.new(
|
49
59
|
options[:url]
|
50
60
|
).get_probe(options)
|
51
|
-
|
52
61
|
usage = (bytes_sent / (options[:interval] * 60) * 8 / 1024**2).round(3)
|
62
|
+
|
63
|
+
# post result to the cdn-manager-api
|
64
|
+
if options[:api_base_url]
|
65
|
+
RestClient.post(
|
66
|
+
File.join(options[:api_base_url], "services", options[:service_name], "metric", options[:metric_name], usage),
|
67
|
+
params: { key: options[:api_key] }
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
53
71
|
if options[:quiet]
|
54
72
|
puts usage.round(0)
|
55
73
|
else
|
@@ -65,6 +83,8 @@ module CdnManagerPcacheProbe
|
|
65
83
|
end
|
66
84
|
end
|
67
85
|
|
86
|
+
|
87
|
+
|
68
88
|
end # class
|
69
89
|
|
70
90
|
end # module cli
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cdn_manager_pcache_probe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- niwo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.5.1
|
121
|
+
rubygems_version: 2.4.5.1
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Pcache load probe for cdn-manager.
|