fluent-plugin-cloudstack 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.textile +8 -7
- data/VERSION +1 -1
- data/lib/fluent/plugin/in_cloudstack.rb +29 -24
- 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: d9a3b997bae08e9b069c03ad5cfa34461ff6a104
|
4
|
+
data.tar.gz: 1814c3cbc8c8c8d4fe735d20187c4c030df69c65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00b67f6b78dea69ca5f84b31f43f7d3c372d569d132b986db4217e683fcfa72462ea5d0abd27e1a3b1ceea6f5112d1bf22e96a404f5dc61f9c288a98c4348fd5
|
7
|
+
data.tar.gz: 3f2f8665a01982c381e42c4c4112d573ac39e7deb0087b52ce6cd17fe07cd8fd230492d343fdd88ae2a0b99d47d20550e7008340ee7d7145a56604498a476ad7
|
data/README.textile
CHANGED
@@ -72,12 +72,13 @@ h2. Data Example
|
|
72
72
|
"state":"Completed",
|
73
73
|
"parentid":"0"}
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
75
|
+
20131028T133511+0000 cloudstack.usages {"vm_usage":1,
|
76
|
+
"memory_usage":512,
|
77
|
+
"cpu_usage":1,
|
78
|
+
"root_volume_usage":16106127360,
|
79
|
+
"data_volume_usage":42949672960,
|
80
|
+
"t1.micro":1,
|
81
|
+
"Datadisk_40GB":1}
|
82
|
+
|
82
83
|
</pre>
|
83
84
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -2,7 +2,7 @@ module Fluent
|
|
2
2
|
class CloudStackInput < Input
|
3
3
|
Fluent::Plugin.register_input("cloudstack", self)
|
4
4
|
|
5
|
-
INTERVAL_MIN =
|
5
|
+
INTERVAL_MIN = 10
|
6
6
|
|
7
7
|
config_param :host
|
8
8
|
config_param :path, :default =>'/client/api'
|
@@ -80,15 +80,7 @@ module Fluent
|
|
80
80
|
usages = get_usages
|
81
81
|
time = Engine.now
|
82
82
|
output_tag = "#{@tag}.usages"
|
83
|
-
|
84
|
-
if value.class == Hash
|
85
|
-
value.each do |key2, value2|
|
86
|
-
Engine.emit("#{output_tag}.#{key}.#{key2}", time, value2)
|
87
|
-
end
|
88
|
-
else
|
89
|
-
Engine.emit("#{output_tag}.#{key}", time, value)
|
90
|
-
end
|
91
|
-
end
|
83
|
+
Engine.emit("#{output_tag}", time, usages)
|
92
84
|
end
|
93
85
|
|
94
86
|
def get_new_events
|
@@ -123,32 +115,45 @@ module Fluent
|
|
123
115
|
|
124
116
|
vms_responses = cs.list_virtual_machines(:domainid=>@domain_id)
|
125
117
|
vms = vms_responses["listvirtualmachinesresponse"]["virtualmachine"]
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
118
|
+
|
119
|
+
if vms
|
120
|
+
vms.each do |vm|
|
121
|
+
memory_usage += vm["memory"].to_i
|
122
|
+
cpu_usage += vm["cpunumber"].to_i
|
123
|
+
usages_per_service_offering[vm["serviceofferingname"]] += 1
|
124
|
+
end
|
130
125
|
end
|
131
126
|
|
132
127
|
volumes_responses = cs.list_volumes(:domainid=>@domain_id)
|
133
128
|
volumes = volumes_responses["listvolumesresponse"]["volume"]
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
129
|
+
|
130
|
+
if volumes
|
131
|
+
volumes.each do |volume|
|
132
|
+
case volume["type"]
|
133
|
+
when "ROOT"
|
134
|
+
root_volume_usage += volume["size"]
|
135
|
+
when "DATADISK"
|
136
|
+
data_volume_usage += volume["size"]
|
137
|
+
usages_per_disk_offering[volume["diskofferingname"].gsub(' ','_')] += 1
|
138
|
+
end
|
141
139
|
end
|
142
140
|
end
|
143
141
|
|
144
|
-
results = {:vm_usage
|
142
|
+
results = {:vm_usage => vms.size,
|
145
143
|
:memory_usage => memory_usage,
|
146
144
|
:cpu_usage => cpu_usage,
|
147
145
|
:root_volume_usage => root_volume_usage,
|
148
146
|
:data_volume_usage => data_volume_usage,
|
149
|
-
:usages_per_service_offering => usages_per_service_offering,
|
150
|
-
:usages_per_disk_offering => usages_per_disk_offering,
|
151
147
|
}
|
148
|
+
|
149
|
+
usages_per_service_offering.each do |key,value|
|
150
|
+
results[key] = value
|
151
|
+
end
|
152
|
+
usages_per_disk_offering.each do |key,value|
|
153
|
+
results[key] = value
|
154
|
+
end
|
155
|
+
|
156
|
+
results
|
152
157
|
end
|
153
158
|
|
154
159
|
def cs
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-cloudstack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuichi UEMURA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|