cloudstack_stats 0.1.0 → 0.2.0
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/lib/cloudstack_stats/cli.rb +17 -4
- data/lib/cloudstack_stats/collect.rb +12 -1
- data/lib/cloudstack_stats/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: 7380aa220221f5e9a48daf2cea757561481f372c
|
|
4
|
+
data.tar.gz: 67786231341e6bff18d840abe738f664f8c132de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b4afdda6535f18a6ca74ddc0dd3360ca21bba27a7337f009db019fef8f459cebb44bcd2a54216c43e6474fd8e974b3c9a550cfbb0a64fef3595593aff7ae0bc4
|
|
7
|
+
data.tar.gz: 50211c52ca720920542433c8922f6309b44c2002dbda3b98fa99c8e790ed1c733cb3ddf134aea688d6726f5b98bfb743a744d4122802d7a4e6ac3082199b53ae
|
data/lib/cloudstack_stats/cli.rb
CHANGED
|
@@ -9,7 +9,20 @@ module CloudstackStats
|
|
|
9
9
|
|
|
10
10
|
package_name "cloudstack_stats"
|
|
11
11
|
|
|
12
|
-
class_option :
|
|
12
|
+
class_option :cloudstack_url,
|
|
13
|
+
default: "http://localhost:8080/client",
|
|
14
|
+
aliases: '-A',
|
|
15
|
+
desc: 'CloudStack API URL'
|
|
16
|
+
|
|
17
|
+
class_option :cloudstack_api_key,
|
|
18
|
+
aliases: '-k',
|
|
19
|
+
desc: 'CloudStack API Key'
|
|
20
|
+
|
|
21
|
+
class_option :cloudstack_api_secret,
|
|
22
|
+
aliases: '-s',
|
|
23
|
+
desc: 'CloudStack API Secret'
|
|
24
|
+
|
|
25
|
+
class_option :cloudstack_config,
|
|
13
26
|
default: File.join(Dir.home, '.cloudstack-cli.yml'),
|
|
14
27
|
aliases: '-C',
|
|
15
28
|
desc: 'Location of your cloudstack-cli configuration file'
|
|
@@ -84,9 +97,9 @@ module CloudstackStats
|
|
|
84
97
|
stats = Collect.new(options).account_stats
|
|
85
98
|
say "Write stats to influxdb...", :yellow
|
|
86
99
|
Feed.new(options).write(stats) {|stat, res| print_status(stat, res)}
|
|
87
|
-
rescue => e
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
# rescue => e
|
|
101
|
+
# say "ERROR: ", :red
|
|
102
|
+
# puts e.message
|
|
90
103
|
end
|
|
91
104
|
|
|
92
105
|
no_commands do
|
|
@@ -7,7 +7,18 @@ module CloudstackStats
|
|
|
7
7
|
|
|
8
8
|
def initialize(settings)
|
|
9
9
|
@settings = settings.dup
|
|
10
|
-
@config
|
|
10
|
+
@config = if @settings[:cloudstack_url] &&
|
|
11
|
+
@settings[:cloudstack_api_key] &&
|
|
12
|
+
@settings[:cloudstack_secret_key]
|
|
13
|
+
{
|
|
14
|
+
url: @settings[:cloudstack_url],
|
|
15
|
+
api_key: @settings[:cloudstack_api_key],
|
|
16
|
+
secret_key: @settings[:cloudstack_secret_key]
|
|
17
|
+
}
|
|
18
|
+
else
|
|
19
|
+
@settings[:config_file] = @settings[:cloudstack_config]
|
|
20
|
+
CloudstackClient::Configuration.load(@settings)
|
|
21
|
+
end
|
|
11
22
|
@cs ||= CloudstackClient::Client.new(
|
|
12
23
|
@config[:url],
|
|
13
24
|
@config[:api_key],
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cloudstack_stats
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- niwo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-05-
|
|
11
|
+
date: 2017-05-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|