cdn_manager_pcache_probe 0.4 → 0.5

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: 64b966db0cd13b998c92873f7f91826833ba7e1a
4
- data.tar.gz: 2870cd90b2129a8088d6a488893206b43146821d
3
+ metadata.gz: b5c18455fdc55f89cc92409b0125585c42d3a448
4
+ data.tar.gz: 7114fbb968368c42b6a1412193e3b864197a909c
5
5
  SHA512:
6
- metadata.gz: 4eac5e1cfedc6efab7c8a3e3ca5ba1f8f661e544493fb21ef2fac86af06ca9b6c2a1da9f03f29cb36e659871aeeb53cfea6d411eb0a7f4aeaa5a07d8598f3c96
7
- data.tar.gz: ca8df6adabd3736c205913cd4fedbc647a52b90d969df893d71f0a78ebcaeb55503be1697de5b3cb6a673d5a1f295a7662b2a0ecb8474de91a4fc5f305743a46
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)
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.4.2)
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
@@ -1,5 +1,5 @@
1
- require 'rest-client'
2
- require 'multi_json'
1
+ require "rest-client"
2
+ require "multi_json"
3
3
 
4
4
  module CdnManagerPcacheProbe
5
5
  class Connector
@@ -1,3 +1,3 @@
1
1
  module CdnManagerPcacheProbe
2
- VERSION = "0.4"
2
+ VERSION = "0.5"
3
3
  end
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'
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-05 00:00:00.000000000 Z
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.