cloudscale 0.0.7 → 0.0.8

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.
@@ -0,0 +1,110 @@
1
+ {
2
+ "postgres.rows" : {
3
+ "chartId" : "postgres.rows",
4
+ "options" : {
5
+ "title" : { "text" : "Row Stats" },
6
+ "subtitle" : { "text" : "The row usage/performance details" },
7
+ "chart" : {
8
+ "type": "area"
9
+ },
10
+ "xAxis" : {
11
+ "title" : {
12
+ "text" : "Date"
13
+ },
14
+ "type" : "datetime"
15
+ },
16
+ "yAxis" : {
17
+ "title" : {
18
+ "text" : "short"
19
+ },
20
+ "type" : "linear"
21
+ },
22
+ "legend" : {
23
+ "title" : "Row Statistics",
24
+ "enabled" : true,
25
+ "align" : "center",
26
+ "verticalAlign" : "bottom"
27
+ }
28
+ },
29
+ "queries" :[{
30
+ "command" : "select mean(value) from /^[[agentInstanceId]].postgres.rows\\./i"
31
+ }],
32
+ "agentInstanceId" : null,
33
+ "menuId" : "postgres.general",
34
+ "order" : 0,
35
+ "width" : 12,
36
+ "height" : 0
37
+ },
38
+ "postgres.transactions" : {
39
+ "chartId" : "postgres.transactions",
40
+ "options" : {
41
+ "title" : { "text" : "Transaction Stats" },
42
+ "subtitle" : { "text" : "The transaction usage/performance details" },
43
+ "chart" : {
44
+ "type": "area"
45
+ },
46
+ "xAxis" : {
47
+ "title" : {
48
+ "text" : "Date"
49
+ },
50
+ "type" : "datetime"
51
+ },
52
+ "yAxis" : {
53
+ "title" : {
54
+ "text" : "short"
55
+ },
56
+ "type" : "linear"
57
+ },
58
+ "legend" : {
59
+ "title" : "Transaction Statistics",
60
+ "enabled" : true,
61
+ "align" : "center",
62
+ "verticalAlign" : "bottom"
63
+ }
64
+ },
65
+ "queries" :[{
66
+ "command" : "select mean(value) from /^[[agentInstanceId]].postgres.transactions\\./i"
67
+ }],
68
+ "agentInstanceId" : null,
69
+ "menuId" : "postgres.general",
70
+ "order" : 0,
71
+ "width" : 12,
72
+ "height" : 0
73
+ },
74
+ "postgres.bulk" : {
75
+ "chartId" : "postgres.bulk",
76
+ "options" : {
77
+ "title" : { "text" : "Bulk Stats" },
78
+ "subtitle" : { "text" : "The bulk usage/performance details" },
79
+ "chart" : {
80
+ "type": "area"
81
+ },
82
+ "xAxis" : {
83
+ "title" : {
84
+ "text" : "Date"
85
+ },
86
+ "type" : "datetime"
87
+ },
88
+ "yAxis" : {
89
+ "title" : {
90
+ "text" : "short"
91
+ },
92
+ "type" : "linear"
93
+ },
94
+ "legend" : {
95
+ "title" : "Bulk Statistics",
96
+ "enabled" : true,
97
+ "align" : "center",
98
+ "verticalAlign" : "bottom"
99
+ }
100
+ },
101
+ "queries" :[{
102
+ "command" : "select mean(value) from /^[[agentInstanceId]].postgres.bulk\\./i"
103
+ }],
104
+ "agentInstanceId" : null,
105
+ "menuId" : "postgres.general",
106
+ "order" : 0,
107
+ "width" : 12,
108
+ "height" : 0
109
+ }
110
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "postgres":{
3
+ "menuId" : "postgresql",
4
+ "label" : "PostgreSQL",
5
+ "description": "PostgreSQL information",
6
+ "order" : 1,
7
+ "agentInstanceId" : null,
8
+ "subItems" : [
9
+ {
10
+ "menuId" : "postgres.general",
11
+ "label" : "General Stats",
12
+ "description" : "All relevant information regarding the PostgreSQL Endpoint",
13
+ "order" : 1
14
+ }
15
+ ]
16
+ }
17
+ }
@@ -25,12 +25,12 @@ module Cloudscale
25
25
  def collect(agentInstanceId)
26
26
  registry = Monitor::Registry.instance
27
27
  metrics = Metrics::Agent.new
28
- log.info("Calling Collect on MongoServerStatus")
28
+ log.info("Calling Collect on PostgresServerStatus")
29
29
  report_database_stats(registry, metrics)
30
30
  report_table_stats(registry, metrics)
31
31
  end
32
32
 
33
- def report_database_stats(agentInstanceId)
33
+ def report_database_stats(registry, metrics)
34
34
  result = @connection.exec('SELECT sum(idx_tup_fetch) AS "rows_select_idx",
35
35
  sum(seq_tup_read) AS "rows_select_scan",
36
36
  sum(n_tup_ins) AS "rows_insert",
@@ -39,7 +39,7 @@ module Cloudscale
39
39
  (sum(idx_tup_fetch) + sum(seq_tup_read) + sum(n_tup_ins) + sum(n_tup_upd) + sum(n_tup_del)) AS "rows_total"
40
40
  FROM pg_stat_all_tables;')
41
41
  row = result[0]
42
-
42
+
43
43
  registry.metrics["postgres.rows.select.index"] = metrics.gauge :rows_select_idx do
44
44
  { :value => row['rows_select_idx'] }
45
45
  end
@@ -65,7 +65,7 @@ module Cloudscale
65
65
  end
66
66
  end
67
67
 
68
- def report_table_stats(agentInstanceId)
68
+ def report_table_stats(registry, metrics)
69
69
  result = @connection.exec('SELECT sum(numbackends) AS "numbackends",
70
70
  sum(xact_commit) AS "xact_commit",
71
71
  sum(xact_rollback) AS "xact_rollback",
@@ -17,61 +17,65 @@ module Cloudscale
17
17
  class PostgresPreop < Preops::PluginPreop
18
18
  include Singleton
19
19
 
20
+ attr_accessor :options
21
+
20
22
  def is_enabled
21
- false
23
+ true
22
24
  end
23
25
 
24
- @@options = {
25
- :"postgres-host" => {
26
- :argument => "--postgres-host",
27
- :description => "Host for your Postgres Instance (e.g. host.instance.com)",
28
- :required => true,
29
- :value => nil
30
- },
31
- :"postgres-port" => {
32
- :argument => "--postgres-port",
33
- :description => "Port for your Postgres Instance (Standard 5432)",
34
- :required => false,
35
- :value => 5432
36
- },
37
- :"postgres-db" => {
38
- :argument => "--postgres-db",
39
- :description => "Database of your Postgres instance",
40
- :required => true,
41
- :value => nil
42
- },
43
- :"postgres-username" => {
44
- :argument => "--postgres-username",
45
- :description => "Username for your Postgres instance",
46
- :required => false,
47
- :value => nil
48
- },
49
- :"postgres-password" => {
50
- :argument => "--postgres-password",
51
- :description => "Password for your Postgres instance",
52
- :required => false,
53
- :value => nil
54
- }
55
- }
56
-
57
- def options
58
- @@options
26
+ def register
27
+ init_charts("#{File.dirname(__FILE__)}/../data/postgres_chart.json")
28
+ init_menus("#{File.dirname(__FILE__)}/../data/postgres_menu.json")
59
29
  end
60
30
 
61
31
  def initialize
62
32
  self.init
63
- if defined? PG
64
- begin
65
- @connection = PG.connect(:host => options[:host][:value], :user => options[:username][:value],
66
- :password => options[:password][:value],
67
- :port => options[:port][:value].to_i, :dbname => options[:db][:value])
68
- rescue PGError => e
69
- puts e.message
70
- end
71
- end
33
+ @options = {
34
+ :"postgres-host" => {
35
+ :argument => "--postgres-host",
36
+ :description => "Host for your Postgres Instance (e.g. host.instance.com)",
37
+ :required => true,
38
+ :value => nil
39
+ },
40
+ :"postgres-port" => {
41
+ :argument => "--postgres-port",
42
+ :description => "Port for your Postgres Instance (Standard 5432)",
43
+ :required => false,
44
+ :value => 5432
45
+ },
46
+ :"postgres-db" => {
47
+ :argument => "--postgres-db",
48
+ :description => "Database of your Postgres instance",
49
+ :required => true,
50
+ :value => nil
51
+ },
52
+ :"postgres-username" => {
53
+ :argument => "--postgres-username",
54
+ :description => "Username for your Postgres instance",
55
+ :required => false,
56
+ :value => nil
57
+ },
58
+ :"postgres-password" => {
59
+ :argument => "--postgres-password",
60
+ :description => "Password for your Postgres instance",
61
+ :required => false,
62
+ :value => nil
63
+ }
64
+ }
72
65
  end
73
66
 
74
67
  def connection
68
+ if @connection == nil
69
+ if defined? PG
70
+ begin
71
+ @connection = PG.connect(:host => options[:'postgres-host'][:value], :user => options[:'postgres-username'][:value],
72
+ :password => options[:'postgres-password'][:value],
73
+ :port => options[:'postgres-port'][:value].to_i, :dbname => options[:'postgres-db'][:value])
74
+ rescue PGError => e
75
+ puts e.message
76
+ end
77
+ end
78
+ end
75
79
  @connection
76
80
  end
77
81
 
@@ -13,36 +13,27 @@ module Cloudscale
13
13
  class Registry
14
14
  include Singleton
15
15
 
16
- attr_accessor :agent_instance_id, :metrics, :generated_instance_id,
17
- :stored_agent_instance, :stored_agent
16
+ attr_accessor :metrics, :stored_agent
18
17
 
19
- def initialize()
18
+ def initialize
20
19
  @metrics = Hash.new
21
- @generated_instance_id = SecureRandom.hex
22
- @stored_agent_instance = Constants::AgentInstance.load
23
20
  @stored_agent = Constants::Agent.load
24
21
  end
25
22
 
26
- def metrics
27
- @metrics
28
- end
29
-
30
23
  def agent_instance_id
31
24
  agent_config = Constants::AgentInstance.load
32
- if agent_config != nil then instance_id = agent_config["agentInstanceId"] end
25
+ if agent_config != nil then
26
+ instance_id = agent_config["agentInstanceId"]
27
+ end
33
28
  if (instance_id == nil)
34
- return @generated_instance_id
29
+ return SecureRandom.hex
35
30
  else
36
31
  return instance_id
37
32
  end
38
33
  end
39
34
 
40
- def stored_agent
41
- @stored_agent
42
- end
43
-
44
35
  def stored_agent_instance
45
- @stored_agent_instance
36
+ Constants::AgentInstance.load
46
37
  end
47
38
 
48
39
  end
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  agentId: 32093209323
3
3
  host: localhost
4
- path: /service
4
+ path: "/service"
5
5
  port: '8080'
6
6
  key: monitoring
7
7
  token: e2FsZz1IUzI1NiwgdHlwPUNUfQ.e3Y9MCwgZD1tb25pdG9yaW5nLCBpYXQ9MTQwNDc1NzMyNH0.rG0biCuH_-X1vulEr19H2m42i4DGRR8PGwgXastyk3Q
@@ -4,5 +4,5 @@
4
4
  #
5
5
  ##
6
6
  module Cloudscale
7
- VERSION = "0.0.7" unless const_defined?(:VERSION)
7
+ VERSION = "0.0.8" unless const_defined?(:VERSION)
8
8
  end
metadata CHANGED
@@ -1,195 +1,195 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudscale
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
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-22 00:00:00.000000000 Z
11
+ date: 2015-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: OptionParser
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.5'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: hashable
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rufus-scheduler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: fsdb
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.7'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.7'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: csigar
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 0.7.4
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.7.4
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: influxdb
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.1.9
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.1.9
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: ruby-metrics
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.9.3
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.9.3
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: mongo
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: 2.0.3
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 2.0.3
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: pg
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ~>
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
145
  version: 0.18.2
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ~>
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: 0.18.2
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: bundler
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ~>
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
159
  version: '1.7'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ~>
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '1.7'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rake
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - ~>
171
+ - - "~>"
172
172
  - !ruby/object:Gem::Version
173
173
  version: '10.0'
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - ~>
178
+ - - "~>"
179
179
  - !ruby/object:Gem::Version
180
180
  version: '10.0'
181
181
  - !ruby/object:Gem::Dependency
182
182
  name: rspec
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ~>
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
187
  version: '2.14'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ~>
192
+ - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: '2.14'
195
195
  description: A Monitoring Client for Cloud Infrastructure provided by evoila.de
@@ -199,6 +199,8 @@ executables: []
199
199
  extensions: []
200
200
  extra_rdoc_files: []
201
201
  files:
202
+ - LICENSE.txt
203
+ - README.md
202
204
  - bin/autospec
203
205
  - bin/bundler
204
206
  - bin/htmldiff
@@ -207,6 +209,7 @@ files:
207
209
  - bin/rake
208
210
  - bin/restclient
209
211
  - bin/rspec
212
+ - lib/cloudscale.rb
210
213
  - lib/cloudscale/monitor/agent/agent.rb
211
214
  - lib/cloudscale/monitor/model/agent/agent_instance.rb
212
215
  - lib/cloudscale/monitor/model/agent/agent_instance_settings.rb
@@ -218,8 +221,9 @@ files:
218
221
  - lib/cloudscale/monitor/preops/general_preop.rb
219
222
  - lib/cloudscale/monitor/preops/preop.rb
220
223
  - lib/cloudscale/monitor/reporter/influxdb_reporter.rb
221
- - lib/cloudscale/plugins/mongo/data/os_chart.json
222
- - lib/cloudscale/plugins/mongo/data/os_menu.json
224
+ - lib/cloudscale/plugins/mongo/data/mongo_chart.json
225
+ - lib/cloudscale/plugins/mongo/data/mongo_menu.json
226
+ - lib/cloudscale/plugins/mongo/mongo_db_collection_status.rb
223
227
  - lib/cloudscale/plugins/mongo/mongo_db_status.rb
224
228
  - lib/cloudscale/plugins/mongo/mongo_replica_status.rb
225
229
  - lib/cloudscale/plugins/mongo/mongo_server_status.rb
@@ -235,6 +239,8 @@ files:
235
239
  - lib/cloudscale/plugins/os/sigar_ram_usage.rb
236
240
  - lib/cloudscale/plugins/os/sigar_swap_usage.rb
237
241
  - lib/cloudscale/plugins/plugin.rb
242
+ - lib/cloudscale/plugins/postgres/data/postgres_chart.json
243
+ - lib/cloudscale/plugins/postgres/data/postgres_menu.json
238
244
  - lib/cloudscale/plugins/postgres/postgres_server_status.rb
239
245
  - lib/cloudscale/plugins/postgres/preops/postgres_preop.rb
240
246
  - lib/cloudscale/plugins/preops/plugin_preop.rb
@@ -248,11 +254,8 @@ files:
248
254
  - lib/cloudscale/store/plugin/port
249
255
  - lib/cloudscale/store/plugin/token
250
256
  - lib/cloudscale/version.rb
251
- - lib/cloudscale.rb
252
257
  - lib/test/rest/rest_client_test.rb
253
258
  - lib/test/sigar/sigar_test.rb
254
- - LICENSE.txt
255
- - README.md
256
259
  homepage: http://www.evoila.de
257
260
  licenses:
258
261
  - MIT
@@ -263,17 +266,17 @@ require_paths:
263
266
  - lib
264
267
  required_ruby_version: !ruby/object:Gem::Requirement
265
268
  requirements:
266
- - - '>='
269
+ - - ">="
267
270
  - !ruby/object:Gem::Version
268
271
  version: '0'
269
272
  required_rubygems_version: !ruby/object:Gem::Requirement
270
273
  requirements:
271
- - - '>='
274
+ - - ">="
272
275
  - !ruby/object:Gem::Version
273
276
  version: '0'
274
277
  requirements: []
275
278
  rubyforge_project:
276
- rubygems_version: 2.0.14
279
+ rubygems_version: 2.4.6
277
280
  signing_key:
278
281
  specification_version: 4
279
282
  summary: Cloud Monitoring of evoila.de