cloudscale 0.0.8 → 0.0.9

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cloudscale +5 -0
  3. data/lib/cloudscale/monitor/agent/agent.rb +8 -2
  4. data/lib/cloudscale/monitor/reporter/influxdb_reporter.rb +29 -5
  5. data/lib/cloudscale/plugins/mongo/preops/mongodb_preop.rb +12 -4
  6. data/lib/cloudscale/plugins/mysql/data/mysql_chart.json +506 -0
  7. data/lib/cloudscale/plugins/mysql/data/mysql_menu.json +35 -0
  8. data/lib/cloudscale/plugins/mysql/mysql_counters.rb +90 -0
  9. data/lib/cloudscale/plugins/mysql/mysql_general_status.rb +119 -0
  10. data/lib/cloudscale/plugins/mysql/mysql_innodb.rb +113 -0
  11. data/lib/cloudscale/plugins/mysql/mysql_querycache.rb +59 -0
  12. data/lib/cloudscale/plugins/mysql/preops/mysql_preop.rb +95 -0
  13. data/lib/cloudscale/plugins/postgres/preops/postgres_preop.rb +12 -4
  14. data/lib/cloudscale/plugins/redis/data/redis_chart.json +110 -0
  15. data/lib/cloudscale/plugins/redis/data/redis_menu.json +17 -0
  16. data/lib/cloudscale/plugins/redis/preops/redis_preop.rb +117 -0
  17. data/lib/cloudscale/plugins/redis/redis_server_status.rb +227 -0
  18. data/lib/cloudscale/rest/rest_client.rb +14 -8
  19. data/lib/cloudscale/rest/rest_client_helper.rb +23 -16
  20. data/lib/cloudscale/schedule.rb +1 -0
  21. data/lib/cloudscale/store/agent/agent.store +1 -1
  22. data/lib/cloudscale/store/agent/agent_instance.store +11 -0
  23. data/lib/cloudscale/store/agent/influxdb.store +1 -1
  24. data/lib/cloudscale/version.rb +1 -1
  25. data/lib/store/plugin/host +1 -0
  26. data/lib/store/plugin/mongo-connect-timeout +1 -0
  27. data/lib/store/plugin/mongo-db +1 -0
  28. data/lib/store/plugin/mongo-host +1 -0
  29. data/lib/store/plugin/mongo-op-timeout +1 -0
  30. data/lib/store/plugin/mongo-password +1 -0
  31. data/lib/store/plugin/mongo-port +2 -0
  32. data/lib/store/plugin/mongo-ssl +2 -0
  33. data/lib/store/plugin/mongo-username +1 -0
  34. data/lib/store/plugin/mysql-db +0 -0
  35. data/lib/store/plugin/mysql-host +0 -0
  36. data/lib/store/plugin/mysql-password +0 -0
  37. data/lib/store/plugin/mysql-port +1 -0
  38. data/lib/store/plugin/mysql-username +0 -0
  39. data/lib/store/plugin/port +1 -0
  40. data/lib/store/plugin/postgres-db +0 -0
  41. data/lib/store/plugin/postgres-host +0 -0
  42. data/lib/store/plugin/postgres-password +0 -0
  43. data/lib/store/plugin/postgres-port +1 -0
  44. data/lib/store/plugin/postgres-username +0 -0
  45. data/lib/store/plugin/redis-db +0 -0
  46. data/lib/store/plugin/redis-host +0 -0
  47. data/lib/store/plugin/redis-password +0 -0
  48. data/lib/store/plugin/redis-port +1 -0
  49. data/lib/store/plugin/redis-reconnect-attempts +1 -0
  50. data/lib/store/plugin/redis-timeout +1 -0
  51. data/lib/store/plugin/redis-username +0 -0
  52. data/lib/store/plugin/token +1 -0
  53. metadata +45 -11
  54. data/bin/autospec +0 -16
  55. data/bin/bundler +0 -16
  56. data/bin/htmldiff +0 -16
  57. data/bin/ldiff +0 -16
  58. data/bin/monitor +0 -16
  59. data/bin/rake +0 -16
  60. data/bin/restclient +0 -16
  61. data/bin/rspec +0 -16
@@ -42,7 +42,12 @@ class RestClientWrapper < RestClientHelper
42
42
  end
43
43
 
44
44
  def get(entity, id)
45
- uri = uriWithId(entity, id)
45
+ uri = uri_with_id(entity, id)
46
+ load(uri)
47
+ end
48
+
49
+ def get_with_path(entity, id, path)
50
+ uri = uri_with_id_and_path(entity, id, path)
46
51
  load(uri)
47
52
  end
48
53
 
@@ -69,9 +74,8 @@ class RestClientWrapper < RestClientHelper
69
74
  RestClient.get(searchQuery, header) { | response, request, result |
70
75
  case response.code
71
76
  when 200
72
- responseBody = JSON.parse(response.body)
73
- if (responseBody["content"].length == 1)
74
- return responseBody["content"][0]
77
+ if (!response.body.empty?)
78
+ return JSON.parse(response.body)
75
79
  end
76
80
  else
77
81
  puts request.to_yaml
@@ -91,7 +95,9 @@ class RestClientWrapper < RestClientHelper
91
95
  RestClient.get(searchQuery, header) { | response, request, result |
92
96
  case response.code
93
97
  when 200
94
- return JSON.parse(response.body)
98
+ if (!response.body.empty?)
99
+ return JSON.parse(response.body)
100
+ end
95
101
  else
96
102
  puts request.to_yaml
97
103
  puts response.code
@@ -127,7 +133,7 @@ class RestClientWrapper < RestClientHelper
127
133
  hash = value.to_dh
128
134
  end
129
135
 
130
- RestClient.put(uriWithId(entity, id), hash.to_json, header) { | response, request, result |
136
+ RestClient.put(uri_with_id(entity, id), hash.to_json, header) { | response, request, result |
131
137
  case response.code
132
138
  when 200, 204
133
139
  if (response.body != nil && response.body.length > 2)
@@ -148,7 +154,7 @@ class RestClientWrapper < RestClientHelper
148
154
  hash = value.to_dh
149
155
  end
150
156
 
151
- RestClient.patch(uriWithId(entity, id), hash.to_json, header) { | response, request, result |
157
+ RestClient.patch(uri_with_id(entity, id), hash.to_json, header) { | response, request, result |
152
158
  case response.code
153
159
  when 200, 204
154
160
  if (response.body != nil && response.body.length > 2)
@@ -165,7 +171,7 @@ class RestClientWrapper < RestClientHelper
165
171
  def delete(entity, id)
166
172
  id = id.to_s.gsub('{?projection}','')
167
173
 
168
- RestClient.delete(uriWithId(entity, id), header) { | response, request, result |
174
+ RestClient.delete(uri_with_id(entity, id), header) { | response, request, result |
169
175
  case response.code
170
176
  when 200, 204
171
177
  else
@@ -5,66 +5,73 @@
5
5
  #
6
6
  ##
7
7
  class RestClientHelper
8
-
8
+
9
9
  def load_token(token)
10
10
  db = FSDB::Database.new("#{File.dirname(__FILE__)}/../store/plugin/")
11
11
  return db[token]
12
12
  end
13
-
13
+
14
14
  def uri(entity)
15
15
  if (!endpoint.to_s.end_with? '/')
16
16
  @endpoint << '/'
17
17
  end
18
18
  String::new(@endpoint + entity)
19
19
  end
20
-
20
+
21
21
  def uri_with_params(entity, params)
22
22
  if (!endpoint.to_s.end_with? '/')
23
23
  @endpoint << '/'
24
24
  end
25
-
25
+
26
26
  uri = String::new(@endpoint + entity)
27
27
  if (params.is_a?(Hash))
28
28
  uri << '?'
29
29
  params.each { | key, value|
30
- uri += key.to_s + '=' + value.to_s + '&'
30
+ uri += key.to_s + '=' + value.to_s + '&'
31
31
  }
32
32
  end
33
33
  return uri
34
34
  end
35
-
36
- def uriWithId(entity, id)
35
+
36
+ def uri_with_id(entity, id)
37
37
  if (!endpoint.to_s.end_with? '/')
38
38
  @endpoint << '/'
39
39
  end
40
- String::new(@endpoint + entity + '/' + id.to_s)
40
+ String::new(@endpoint + entity + '/' + id.to_s)
41
41
  end
42
-
42
+
43
+ def uri_with_id_and_path(entity, id, path)
44
+ if (!endpoint.to_s.end_with? '/')
45
+ @endpoint << '/'
46
+ end
47
+ String::new(@endpoint + entity + '/' + id.to_s + '/' + path)
48
+ end
49
+
43
50
  def self.load_entity_id(entity)
44
51
  if (entity != nil && entity["links"].is_a?(Array))
45
52
  entity["links"].each { | link |
46
53
  if (link["rel"] == "self")
47
54
  return link["href"][link["href"].rindex('/') + 1, link["href"].length]
48
- end
55
+ end
49
56
  }
50
57
  end
51
58
  end
52
-
59
+
53
60
  def self.load_entity_ref(entity)
54
61
  if (entity != nil && entity["links"].is_a?(Array))
55
62
  entity["links"].each { | link |
56
63
  if (link["rel"] == "self")
57
64
  return link
58
- end
65
+ end
59
66
  }
60
67
  end
61
68
  end
62
-
69
+
63
70
  def removeLinks(hash, key)
64
71
  if (hash.key?(key))
65
72
  hash.tap { | x |
66
- x.delete(key)
67
- }
73
+ x.delete(key)
74
+ }
68
75
  end
69
- end
76
+ end
70
77
  end
@@ -22,6 +22,7 @@ module Cloudscale
22
22
  end
23
23
  end
24
24
 
25
+ Monitor::Agent.alive(agentInstanceId)
25
26
  Monitor::InfluxDbReporter.instance.report(registry.metrics)
26
27
  end
27
28
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- agentId: 32093209323
2
+ agentId: 1395477369084
3
3
  host: localhost
4
4
  path: "/service"
5
5
  port: '8080'
@@ -0,0 +1,11 @@
1
+ ---
2
+ agent: http://localhost:8080/service/agents/5315cf2d4d1a44fb9d21b1f9
3
+ agentInstanceId: c7f9c3c2dc4d6f3e4cd46b4dda714115
4
+ token: e2FsZz1IUzI1NiwgdHlwPUNUfQ.e3Y9MCwgZD1tb25pdG9yaW5nLCBpYXQ9MTQwNDc1NzMyNH0.rG0biCuH_-X1vulEr19H2m42i4DGRR8PGwgXastyk3Q
5
+ server: jhiemer-evoila.fritz.box
6
+ settings: !ruby/object:Cloudscale::Monitor::Settings
7
+ measurementCollectionInterval: 15
8
+ coredataCollectionInterval: 0
9
+ tableCollectionInterval: 1500
10
+ reportingInterval: 5
11
+ started: 1442172827000
@@ -1,5 +1,5 @@
1
1
  ---
2
- host: 88.198.249.58
2
+ host: 88.198.249.61
3
3
  port: 8086
4
4
  database: monitoring
5
5
  username: monitoring
@@ -4,5 +4,5 @@
4
4
  #
5
5
  ##
6
6
  module Cloudscale
7
- VERSION = "0.0.8" unless const_defined?(:VERSION)
7
+ VERSION = "0.0.9" unless const_defined?(:VERSION)
8
8
  end
@@ -0,0 +1 @@
1
+ I"localhost:ET
@@ -0,0 +1 @@
1
+ I"30:EF
@@ -0,0 +1 @@
1
+ I"cloudscale:ET
@@ -0,0 +1 @@
1
+ I"172.16.248.144:ET
@@ -0,0 +1 @@
1
+ I"30:EF
@@ -0,0 +1 @@
1
+ I"cloudscale:ET
@@ -0,0 +1,2 @@
1
+ I"
2
+ 27017:EF
@@ -0,0 +1,2 @@
1
+ I"
2
+ false:EF
@@ -0,0 +1 @@
1
+ I"cloudscale:ET
Binary file
@@ -0,0 +1 @@
1
+ I" 3306:EF
@@ -0,0 +1 @@
1
+ I" 8080:ET
@@ -0,0 +1 @@
1
+ I" 5432:EF
Binary file
@@ -0,0 +1 @@
1
+ I" 6379:EF
@@ -0,0 +1 @@
1
+ I"5:EF
@@ -0,0 +1 @@
1
+ I"30:EF
@@ -0,0 +1 @@
1
+ I"{e2FsZz1IUzI1NiwgdHlwPUNUfQ.e3Y9MCwgZD1tb25pdG9yaW5nLCBpYXQ9MTQwNDc1NzMyNH0.rG0biCuH_-X1vulEr19H2m42i4DGRR8PGwgXastyk3Q:ET
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudscale
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Hiemer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-23 00:00:00.000000000 Z
11
+ date: 2015-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -195,20 +195,14 @@ dependencies:
195
195
  description: A Monitoring Client for Cloud Infrastructure provided by evoila.de
196
196
  email:
197
197
  - jhiemer@cloudscale.de
198
- executables: []
198
+ executables:
199
+ - cloudscale
199
200
  extensions: []
200
201
  extra_rdoc_files: []
201
202
  files:
202
203
  - LICENSE.txt
203
204
  - README.md
204
- - bin/autospec
205
- - bin/bundler
206
- - bin/htmldiff
207
- - bin/ldiff
208
- - bin/monitor
209
- - bin/rake
210
- - bin/restclient
211
- - bin/rspec
205
+ - bin/cloudscale
212
206
  - lib/cloudscale.rb
213
207
  - lib/cloudscale/monitor/agent/agent.rb
214
208
  - lib/cloudscale/monitor/model/agent/agent_instance.rb
@@ -228,6 +222,13 @@ files:
228
222
  - lib/cloudscale/plugins/mongo/mongo_replica_status.rb
229
223
  - lib/cloudscale/plugins/mongo/mongo_server_status.rb
230
224
  - lib/cloudscale/plugins/mongo/preops/mongodb_preop.rb
225
+ - lib/cloudscale/plugins/mysql/data/mysql_chart.json
226
+ - lib/cloudscale/plugins/mysql/data/mysql_menu.json
227
+ - lib/cloudscale/plugins/mysql/mysql_counters.rb
228
+ - lib/cloudscale/plugins/mysql/mysql_general_status.rb
229
+ - lib/cloudscale/plugins/mysql/mysql_innodb.rb
230
+ - lib/cloudscale/plugins/mysql/mysql_querycache.rb
231
+ - lib/cloudscale/plugins/mysql/preops/mysql_preop.rb
231
232
  - lib/cloudscale/plugins/os/data/os_chart.json
232
233
  - lib/cloudscale/plugins/os/data/os_menu.json
233
234
  - lib/cloudscale/plugins/os/preops/os_preop.rb
@@ -244,16 +245,49 @@ files:
244
245
  - lib/cloudscale/plugins/postgres/postgres_server_status.rb
245
246
  - lib/cloudscale/plugins/postgres/preops/postgres_preop.rb
246
247
  - lib/cloudscale/plugins/preops/plugin_preop.rb
248
+ - lib/cloudscale/plugins/redis/data/redis_chart.json
249
+ - lib/cloudscale/plugins/redis/data/redis_menu.json
250
+ - lib/cloudscale/plugins/redis/preops/redis_preop.rb
251
+ - lib/cloudscale/plugins/redis/redis_server_status.rb
247
252
  - lib/cloudscale/registry.rb
248
253
  - lib/cloudscale/rest/rest_client.rb
249
254
  - lib/cloudscale/rest/rest_client_helper.rb
250
255
  - lib/cloudscale/schedule.rb
251
256
  - lib/cloudscale/store/agent/agent.store
257
+ - lib/cloudscale/store/agent/agent_instance.store
252
258
  - lib/cloudscale/store/agent/influxdb.store
253
259
  - lib/cloudscale/store/plugin/host
254
260
  - lib/cloudscale/store/plugin/port
255
261
  - lib/cloudscale/store/plugin/token
256
262
  - lib/cloudscale/version.rb
263
+ - lib/store/plugin/host
264
+ - lib/store/plugin/mongo-connect-timeout
265
+ - lib/store/plugin/mongo-db
266
+ - lib/store/plugin/mongo-host
267
+ - lib/store/plugin/mongo-op-timeout
268
+ - lib/store/plugin/mongo-password
269
+ - lib/store/plugin/mongo-port
270
+ - lib/store/plugin/mongo-ssl
271
+ - lib/store/plugin/mongo-username
272
+ - lib/store/plugin/mysql-db
273
+ - lib/store/plugin/mysql-host
274
+ - lib/store/plugin/mysql-password
275
+ - lib/store/plugin/mysql-port
276
+ - lib/store/plugin/mysql-username
277
+ - lib/store/plugin/port
278
+ - lib/store/plugin/postgres-db
279
+ - lib/store/plugin/postgres-host
280
+ - lib/store/plugin/postgres-password
281
+ - lib/store/plugin/postgres-port
282
+ - lib/store/plugin/postgres-username
283
+ - lib/store/plugin/redis-db
284
+ - lib/store/plugin/redis-host
285
+ - lib/store/plugin/redis-password
286
+ - lib/store/plugin/redis-port
287
+ - lib/store/plugin/redis-reconnect-attempts
288
+ - lib/store/plugin/redis-timeout
289
+ - lib/store/plugin/redis-username
290
+ - lib/store/plugin/token
257
291
  - lib/test/rest/rest_client_test.rb
258
292
  - lib/test/sigar/sigar_test.rb
259
293
  homepage: http://www.evoila.de
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'autospec' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('rspec-core', 'autospec')
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'bundler' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('bundler', 'bundler')
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'htmldiff' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('diff-lcs', 'htmldiff')
data/bin/ldiff DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'ldiff' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('diff-lcs', 'ldiff')
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # This file was generated by Bundler.
4
- #
5
- # The application 'monitor' is installed as part of a gem, and
6
- # this file is here to facilitate running it.
7
- #
8
-
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
- Pathname.new(__FILE__).realpath)
12
-
13
- require 'rubygems'
14
- require 'bundler/setup'
15
-
16
- load Gem.bin_path('cloudscale', 'monitor')