auser-poolparty 1.3.5 → 1.3.6

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.
Files changed (47) hide show
  1. data/Rakefile +2 -2
  2. data/VERSION.yml +1 -1
  3. data/bin/cloud-misc +34 -0
  4. data/bin/{poolparty-setup → cloud-setup} +0 -0
  5. data/bin/cloud-ssh +4 -1
  6. data/config/jeweler.rb +4 -3
  7. data/examples/monitored_cloud.rb +1 -1
  8. data/examples/thrift/thrift_example.rb +5 -3
  9. data/examples/vmware.rb +10 -0
  10. data/lib/cloud_providers/cloud_provider_instance.rb +13 -4
  11. data/lib/cloud_providers/connections.rb +1 -1
  12. data/lib/core/file.rb +12 -0
  13. data/lib/dependency_resolvers/base.rb +1 -1
  14. data/lib/dependency_resolvers/chef.rb +7 -5
  15. data/lib/dependency_resolvers/proxy_object.rb +11 -3
  16. data/lib/poolparty.rb +3 -1
  17. data/lib/poolparty/base.rb +1 -2
  18. data/lib/poolparty/cloud.rb +20 -5
  19. data/lib/poolparty/default.rb +1 -0
  20. data/lib/poolparty/plugin.rb +1 -5
  21. data/lib/poolparty/plugins/apache.rb +8 -6
  22. data/lib/poolparty/plugins/collectd.rb +24 -0
  23. data/lib/poolparty/plugins/collectd/templates/collectd.conf.erb +369 -0
  24. data/lib/poolparty/plugins/hermes.rb +89 -0
  25. data/lib/poolparty/pool.rb +26 -3
  26. data/lib/poolparty/resource.rb +12 -11
  27. data/lib/poolparty/resources/line.rb +2 -2
  28. data/lib/poolparty/resources/variable.rb +4 -3
  29. data/lib/proto/command_interface_handler.rb +17 -1
  30. data/lib/proto/gen-py/cloudthrift/CommandInterface.pyc +0 -0
  31. data/lib/proto/gen-py/cloudthrift/__init__.pyc +0 -0
  32. data/lib/proto/gen-py/cloudthrift/constants.pyc +0 -0
  33. data/lib/proto/gen-py/cloudthrift/ttypes.pyc +0 -0
  34. data/lib/proto/gen-py/thrift/Thrift.pyc +0 -0
  35. data/lib/proto/gen-py/thrift/__init__.pyc +0 -0
  36. data/lib/proto/gen-py/thrift/protocol/TBinaryProtocol.pyc +0 -0
  37. data/lib/proto/gen-py/thrift/protocol/TProtocol.pyc +0 -0
  38. data/lib/proto/gen-py/thrift/protocol/__init__.pyc +0 -0
  39. data/lib/proto/gen-py/thrift/transport/TSocket.pyc +0 -0
  40. data/lib/proto/gen-py/thrift/transport/TTransport.pyc +0 -0
  41. data/lib/proto/gen-py/thrift/transport/__init__.pyc +0 -0
  42. data/test/lib/dependency_resolvers/chef_test.rb +92 -100
  43. data/test/lib/poolparty/cloud_test.rb +50 -2
  44. data/test/lib/poolparty/monitor_test.rb +2 -2
  45. data/test/lib/poolparty/resource_test.rb +5 -0
  46. data/test/lib/poolparty/resources/variable_test.rb +33 -10
  47. metadata +11 -4
@@ -0,0 +1,369 @@
1
+ # Config file for collectd(1).
2
+ #
3
+ # Some plugins need additional configuration and are disabled by default.
4
+ # Please read collectd.conf(5) for details.
5
+ #
6
+ # You should also read /usr/share/doc/collectd/README.Debian.plugins before
7
+ # enabling any more plugins.
8
+
9
+ #Hostname "localhost"
10
+ FQDNLookup true
11
+ #BaseDir "/var/lib/collectd"
12
+ #PluginDir "/usr/lib/collectd"
13
+ #TypesDB "/usr/lib/collectd/types.db" "/etc/collectd/my_types.db"
14
+ #Interval 10
15
+ #ReadThreads 5
16
+
17
+ #LoadPlugin logfile
18
+ LoadPlugin syslog
19
+
20
+ #<Plugin logfile>
21
+ # LogLevel "info"
22
+ # File STDOUT
23
+ # Timestamp true
24
+ #</Plugin>
25
+
26
+ <Plugin syslog>
27
+ LogLevel info
28
+ </Plugin>
29
+
30
+ #LoadPlugin apache
31
+ #LoadPlugin apcups
32
+ #LoadPlugin ascent
33
+ #LoadPlugin battery
34
+ LoadPlugin cpu
35
+ #LoadPlugin cpufreq
36
+ LoadPlugin csv
37
+ # LoadPlugin df
38
+ LoadPlugin disk
39
+ #LoadPlugin dns
40
+ #LoadPlugin email
41
+ #LoadPlugin entropy
42
+ #LoadPlugin exec
43
+ #LoadPlugin hddtemp
44
+ LoadPlugin interface
45
+ #LoadPlugin ipmi
46
+ LoadPlugin iptables
47
+ #LoadPlugin ipvs
48
+ #LoadPlugin irq
49
+ LoadPlugin libvirt
50
+ LoadPlugin load
51
+ #LoadPlugin mbmon
52
+ #LoadPlugin memcached
53
+ LoadPlugin memory
54
+ #LoadPlugin multimeter
55
+ #LoadPlugin mysql
56
+ #LoadPlugin netlink
57
+ LoadPlugin network
58
+ # LoadPlugin nfs
59
+ #LoadPlugin nginx
60
+ #LoadPlugin ntpd
61
+ #LoadPlugin nut
62
+ #LoadPlugin perl
63
+ #LoadPlugin ping
64
+ #LoadPlugin powerdns
65
+ # LoadPlugin processes
66
+ LoadPlugin rrdtool
67
+ #LoadPlugin sensors
68
+ #LoadPlugin serial
69
+ #LoadPlugin snmp
70
+ # LoadPlugin swap
71
+ #LoadPlugin tail
72
+ LoadPlugin tcpconns
73
+ #LoadPlugin teamspeak2
74
+ #LoadPlugin unixsock
75
+ LoadPlugin users
76
+ LoadPlugin uuid
77
+ #LoadPlugin vmem
78
+ #LoadPlugin vserver
79
+ #LoadPlugin wireless
80
+
81
+ #<Plugin apache>
82
+ # URL "http://localhost/status?auto"
83
+ # User "www-user"
84
+ # Password "secret"
85
+ # VerifyPeer false
86
+ # VerifyHost false
87
+ # CACert "/etc/ssl/ca.crt"
88
+ #</Plugin>
89
+
90
+ #<Plugin apcups>
91
+ # Host "localhost"
92
+ # Port "3551"
93
+ #</Plugin>
94
+
95
+ #<Plugin ascent>
96
+ # URL "http://localhost/ascent/status/"
97
+ # User "www-user"
98
+ # Password "secret"
99
+ # CACert "/etc/ssl/ca.crt"
100
+ #</Plugin>
101
+
102
+ #<Plugin csv>
103
+ # DataDir "/var/lib/collectd/csv"
104
+ # StoreRates false
105
+ #</Plugin>
106
+
107
+ #<Plugin df>
108
+ # Device "/dev/sda1"
109
+ # Device "192.168.0.2:/mnt/nfs"
110
+ # MountPoint "/home/eucalyptus"
111
+ # FSType "ext3"
112
+ # IgnoreSelected false
113
+ # </Plugin>
114
+
115
+ #<Plugin disk>
116
+ # Disk "hda"
117
+ # Disk "/sda[23]/"
118
+ # IgnoreSelected false
119
+ #</Plugin>
120
+
121
+ #<Plugin dns>
122
+ # Interface "eth0"
123
+ # IgnoreSource "192.168.0.1"
124
+ #</Plugin>
125
+
126
+ #<Plugin email>
127
+ # SocketGroup "collectd"
128
+ # SocketPerms "0770"
129
+ # MaxConns 5
130
+ #</Plugin>
131
+
132
+ #<Plugin exec>
133
+ # Exec user "/path/to/exec"
134
+ # Exec "user:group" "/path/to/exec"
135
+ # NotificationExec user "/path/to/exec"
136
+ #</Plugin>
137
+
138
+ #<Plugin hddtemp>
139
+ # Host "127.0.0.1"
140
+ # Port 7634
141
+ # TranslateDevicename false
142
+ #</Plugin>
143
+
144
+ #<Plugin interface>
145
+ # Interface "eth0"
146
+ # IgnoreSelected false
147
+ #</Plugin>
148
+
149
+ #<Plugin iptables>
150
+ # Chain "table" "chain"
151
+ #</Plugin>
152
+
153
+ #<Plugin irq>
154
+ # Irq 7
155
+ # Irq 8
156
+ # Irq 9
157
+ # IgnoreSelected true
158
+ #</Plugin>
159
+
160
+ <Plugin libvirt>
161
+ Connection "qemu:///system"
162
+ # Connection "xen:///"
163
+ RefreshInterval 10
164
+ # Domain "name"
165
+ # BlockDevice "name:device"
166
+ # InterfaceDevice "name:device"
167
+ # IgnoreSelected false
168
+ HostnameFormat hostname name
169
+ </Plugin>
170
+
171
+ #<Plugin mbmon>
172
+ # Host "127.0.0.1"
173
+ # Port 411
174
+ #</Plugin>
175
+
176
+ #<Plugin memcached>
177
+ # Host "127.0.0.1"
178
+ # Port "11211"
179
+ #</Plugin>
180
+
181
+ #<Plugin mysql>
182
+ # Host "database.serv.er"
183
+ # User "db_user"
184
+ # Password "secret"
185
+ # Database "db_name"
186
+ #</Plugin>
187
+
188
+ #<Plugin netlink>
189
+ # Interface "All"
190
+ # VerboseInterface "All"
191
+ # QDisc "eth0" "pfifo_fast-1:0"
192
+ # Class "ppp0" "htb-1:10"
193
+ # Filter "ppp0" "u32-1:0"
194
+ # IgnoreSelected false
195
+ #</Plugin>
196
+
197
+ <Plugin network>
198
+ <%= "Server #{@node[:collectd][:server]}" %>
199
+ Listen "<%= @node.ipaddress %>"
200
+ # Server "ff18::efc0:4a42" "25826"
201
+ # Server "239.192.74.66" "25826"
202
+ # Listen "ff18::efc0:4a42" "25826"
203
+ # Listen "239.192.74.66" "25826"
204
+ # TimeToLive "128"
205
+ # Forward false
206
+ # CacheFlush 1800
207
+ </Plugin>
208
+
209
+ #<Plugin nginx>
210
+ # URL "http://localhost/status?auto"
211
+ # User "www-user"
212
+ # Password "secret"
213
+ # VerifyPeer false
214
+ # VerifyHost false
215
+ # CACert "/etc/ssl/ca.crt"
216
+ #</Plugin>
217
+
218
+ #<Plugin ntpd>
219
+ # Host "localhost"
220
+ # Port 123
221
+ # ReverseLookups false
222
+ #</Plugin>
223
+
224
+ #<Plugin nut>
225
+ # UPS "upsname@hostname:port"
226
+ #</Plugin>
227
+
228
+ #<Plugin perl>
229
+ # IncludeDir "/my/include/path"
230
+ # BaseName "Collectd::Plugin"
231
+ # EnableDebugger ""
232
+ # LoadPlugin "foo"
233
+ # LoadPlugin "bar"
234
+ #</Plugin>
235
+
236
+ #<Plugin ping>
237
+ # Host "host.foo.bar"
238
+ # Host "host.baz.qux"
239
+ # TTL 255
240
+ #</Plugin>
241
+
242
+ #<Plugin powerdns>
243
+ # <Server "server_name">
244
+ # Collect "latency"
245
+ # Collect "udp-answers" "udp-queries"
246
+ # Socket "/var/run/pdns.controlsocket"
247
+ # </Server>
248
+ # <Recursor "recursor_name">
249
+ # Collect "questions"
250
+ # Collect "cache-hits" "cache-misses"
251
+ # Socket "/var/run/pdns_recursor.controlsocket"
252
+ # </Recursor>
253
+ # LocalSocket "/opt/collectd/var/run/collectd-powerdns"
254
+ #</Plugin>
255
+
256
+ #<Plugin processes>
257
+ # Process "name"
258
+ #</Plugin>
259
+
260
+ <Plugin rrdtool>
261
+ DataDir "/var/lib/collectd/rrd"
262
+ # CacheTimeout 120
263
+ # CacheFlush 900
264
+ #
265
+ # The following settings are rather advanced
266
+ # and should usually not be touched:
267
+ # StepSize 10
268
+ # HeartBeat 20
269
+ # RRARows 1200
270
+ # RRATimespan 158112000
271
+ # XFF 0.1
272
+ </Plugin>
273
+
274
+ #<Plugin sensors>
275
+ # Sensor "it8712-isa-0290/temperature-temp1"
276
+ # Sensor "it8712-isa-0290/fanspeed-fan3"
277
+ # Sensor "it8712-isa-0290/voltage-in8"
278
+ # IgnoreSelected false
279
+ #</Plugin>
280
+
281
+ # See /usr/share/doc/collectd/examples/snmp-data.conf.gz for a
282
+ # comprehensive sample configuration.
283
+ #<Plugin snmp>
284
+ # <Data "powerplus_voltge_input">
285
+ # Type "voltage"
286
+ # Table false
287
+ # Instance "input_line1"
288
+ # Values "SNMPv2-SMI::enterprises.6050.5.4.1.1.2.1"
289
+ # </Data>
290
+ # <Data "hr_users">
291
+ # Type "users"
292
+ # Table false
293
+ # Instance ""
294
+ # Values "HOST-RESOURCES-MIB::hrSystemNumUsers.0"
295
+ # </Data>
296
+ # <Data "std_traffic">
297
+ # Type "if_octets"
298
+ # Table true
299
+ # Instance "IF-MIB::ifDescr"
300
+ # Values "IF-MIB::ifInOctets" "IF-MIB::ifOutOctets"
301
+ # </Data>
302
+ #
303
+ # <Host "some.switch.mydomain.org">
304
+ # Address "192.168.0.2"
305
+ # Version 1
306
+ # Community "community_string"
307
+ # Collect "std_traffic"
308
+ # Inverval 120
309
+ # </Host>
310
+ # <Host "some.server.mydomain.org">
311
+ # Address "192.168.0.42"
312
+ # Version 2
313
+ # Community "another_string"
314
+ # Collect "std_traffic" "hr_users"
315
+ # </Host>
316
+ # <Host "some.ups.mydomain.org">
317
+ # Address "192.168.0.3"
318
+ # Version 1
319
+ # Community "more_communities"
320
+ # Collect "powerplus_voltge_input"
321
+ # Interval 300
322
+ # </Host>
323
+ #</Plugin>
324
+
325
+ #<Plugin "tail">
326
+ # <File "/var/log/exim4/mainlog">
327
+ # Instance "exim"
328
+ # <Match>
329
+ # Regex "S=([1-9][0-9]*)"
330
+ # DSType "CounterAdd"
331
+ # Type "ipt_bytes"
332
+ # Instance "total"
333
+ # </Match>
334
+ # <Match>
335
+ # Regex "\\<R=local_user\\>"
336
+ # DSType "CounterInc"
337
+ # Type "counter"
338
+ # Instance "local_user"
339
+ # </Match>
340
+ # </File>
341
+ #</Plugin>
342
+
343
+ #<Plugin tcpconns>
344
+ # ListeningPorts false
345
+ # LocalPort "25"
346
+ # RemotePort "25"
347
+ #</Plugin>
348
+
349
+ #<Plugin teamspeak2>
350
+ # Host "127.0.0.1"
351
+ # Port "51234"
352
+ # Server "8767"
353
+ #</Plugin>
354
+
355
+ #<Plugin unixsock>
356
+ # SocketFile "/var/run/collectd-unixsock"
357
+ # SocketGroup "collectd"
358
+ # SocketPerms "0660"
359
+ #</Plugin>
360
+
361
+ #<Plugin uuid>
362
+ # UUIDFile "/etc/uuid"
363
+ #</Plugin>
364
+
365
+ #<Plugin vmem>
366
+ # Verbose false
367
+ #</Plugin>
368
+
369
+ Include "/etc/collectd/thresholds.conf"
@@ -0,0 +1,89 @@
1
+ =begin rdoc
2
+ =end
3
+
4
+ module PoolParty
5
+ module Resources
6
+
7
+ class Hermes < Resource
8
+
9
+ default_options(
10
+ :name => nil
11
+ )
12
+
13
+ def after_loaded
14
+ add_unpack
15
+ run_if_needed
16
+ end
17
+
18
+ def after_compile
19
+ run_dependencies
20
+ build_rsync_directory
21
+ end
22
+
23
+ def run_dependencies
24
+ case cloud.platform
25
+ when false
26
+ else
27
+ has_package "erlang-nox"
28
+ has_package "erlang-dev"
29
+ has_package "rrdtool"
30
+ end
31
+ end
32
+
33
+ def build_rsync_directory
34
+ hermes_dir = cloud.tmp_path + "/tmp/hermes"
35
+ FileUtils.mkdir_p(hermes_dir)
36
+ FileUtils.cp(hermes_release_tar_gz, hermes_dir)
37
+ FileUtils.cp(target_system_file, hermes_dir)
38
+ build_nodes_config
39
+ end
40
+
41
+ # write out a conf file listing all of the seed nodes based on the nodes in the cluster
42
+ def build_nodes_config
43
+ etc_poolparty = cloud.tmp_path + "/etc/poolparty"
44
+ FileUtils.mkdir_p(etc_poolparty)
45
+ node_names = cloud.nodes.collect{|n| n.internal_ip || n.dns_name}.compact.collect{|n| "hermes@#{n}"}
46
+ contents = node_names.collect{|n| %Q{"#{n}".}}.join("\n")
47
+ File.open(etc_poolparty + "/seeds.conf", "w") {|f| f.puts contents}
48
+ end
49
+
50
+ def add_unpack
51
+ has_exec "cd /tmp/hermes && escript target_system install hermes-#{hermes_release_version} #{remote_hermes_deployed_dir}",
52
+ :creates => "#{remote_hermes_deployed_dir}/releases/#{hermes_release_version}"
53
+ end
54
+
55
+ def run_if_needed
56
+ has_exec "env GEN_CLUSTER_SEED_CONFIG=/etc/poolparty/seeds.conf #{remote_hermes_deployed_dir}/bin/erl -boot #{remote_hermes_deployed_dir}/releases/#{hermes_release_version}/start -noshell -detached",
57
+ :not_if => "ps aux | grep -v grep | grep hermes | grep beam"
58
+ end
59
+
60
+ private
61
+
62
+ def hermes_release_tar_gz
63
+ `#{hermes_dir}/scripts/most_recent_release tar.gz`.strip
64
+ end
65
+
66
+ def target_system_file
67
+ "#{hermes_dir}/scripts/target_system"
68
+ end
69
+
70
+ def hermes_dir
71
+ PoolParty.lib_dir + "/vendor/erlang/hermes"
72
+ end
73
+
74
+ def remote_hermes_deployed_dir
75
+ "/var/poolparty/hermes"
76
+ end
77
+
78
+ def hermes_release_version
79
+ File.basename(hermes_release_tar_gz).gsub(/hermes-(.*?)\.tar\.gz/, '\1')
80
+ end
81
+
82
+ end
83
+ end
84
+ end
85
+
86
+ # == install
87
+ # upload tar.gz & target_system
88
+ # run target_system unless VERSION exists
89
+ # run erlang: /usr/local/erl-target/bin/erl -boot /usr/local/erl-target/releases/FIRST/start _unless_ already running