newrelic_f5_plugin 1.0.4 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,12 @@
1
+ * 1.0.6
2
+ - Fix throughput reporting issue caused by the refactor.
3
+
4
+ * 1.0.5
5
+ - Upgrade to newer version of newrelic_plugin
6
+ - Add proxy support
7
+ - Improves connectivity to New Relic
8
+ - Major refactoring, and inclusion of better debug logging
9
+
1
10
  * 1.0.4
2
11
  - Add Virtual Server CPU usage metric based on the F5's 1 minute CPU ratio
3
12
 
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # This gemfile is used in the context of development on this plugin agent.
4
4
 
5
- gem 'newrelic_plugin', '= 1.0.2'
5
+ gem 'newrelic_plugin', '~> 1.3.0'
6
6
  gem 'snmp'
7
7
  gem 'rake', '>0.9.2'
8
8
  gem 'test-unit'
@@ -4,7 +4,7 @@ require 'newrelic_plugin'
4
4
  require 'snmp'
5
5
 
6
6
  module NewRelic::F5Plugin
7
- VERSION = '1.0.4'
7
+ VERSION = '1.0.6'
8
8
 
9
9
  # Register and run the agent
10
10
  def self.run
@@ -44,87 +44,99 @@ module NewRelic::F5Plugin
44
44
  # SNMP Stuff here
45
45
  snmp = SNMP::Manager.new(:host => hostname, :port => port, :community => snmp_community)
46
46
 
47
- report_global_cpu_metrics(snmp)
48
- report_global_memory_metrics(snmp)
49
- report_global_connection_metrics(snmp)
50
- report_global_throughput_metrics(snmp)
51
- report_global_http_metrics(snmp)
52
- report_global_http_compression_metrics(snmp)
53
- report_global_ssl_metrics(snmp)
54
- report_global_tcp_metrics(snmp)
55
47
 
56
- node_status = NewRelic::F5Plugin::Nodes.get_status(snmp)
57
- node_status.each_key { |m|
58
- report_metric m, node_status[m][:label], node_status[m][:count]
59
- }
48
+ #
49
+ # Device wide metrics
50
+ #
51
+ system = NewRelic::F5Plugin::Device.new snmp
52
+ system_cpu = system.get_cpu
53
+ system_cpu.each_key { |m| report_metric m, "%", system_cpu[m] } unless system_cpu.nil?
54
+
55
+ system_memory = system.get_memory
56
+ system_memory.each_key { |m| report_metric m, "bytes", system_memory[m] } unless system_memory.nil?
57
+
58
+ system_connections = system.get_connections
59
+ system_connections.each_key { |m| report_metric m, "conn", system_connections[m] } unless system_connections.nil?
60
+
61
+ system_connection_rates = system.get_connection_rates
62
+ system_connection_rates.each_key { |m| report_counter_metric m, "conn/sec", system_connection_rates[m] } unless system_connection_rates.nil?
63
+
64
+ system_throughput = system.get_throughput
65
+ system_throughput.each_key { |m| report_counter_metric m, "bits/sec", system_throughput[m] } unless system_throughput.nil?
66
+
67
+ system_http_reqs = system.get_http_requests
68
+ system_http_reqs.each_key { |m| report_counter_metric m, "req/sec", system_http_reqs[m] } unless system_http_reqs.nil?
69
+
70
+ system_http_resp = system.get_http_responses
71
+ system_http_resp.each_key { |m| report_counter_metric m, "resp/sec", system_http_resp[m] } unless system_http_resp.nil?
72
+
73
+ system_http_compression = system.get_http_compression
74
+ system_http_compression.each_key { |m| report_counter_metric m, "bits/sec", system_http_compression[m] } unless system_http_compression.nil?
75
+
76
+ system_ssl = system.get_ssl
77
+ system_ssl.each_key { |m| report_counter_metric m, "trans/sec", system_ssl[m] } unless system_ssl.nil?
78
+
79
+ system_tcp_conns = system.get_tcp_connections
80
+ system_tcp_conns.each_key { |m| report_metric m, "conn", system_tcp_conns[m] } unless system_tcp_conns.nil?
81
+
82
+ system_tcp_conn_rates = system.get_tcp_connection_rates
83
+ system_tcp_conn_rates.each_key { |m| report_counter_metric m, "conn/sec", system_tcp_conn_rates[m] } unless system_tcp_conn_rates.nil?
84
+
85
+ #
86
+ # Node stats
87
+ #
88
+ NewRelic::PlatformLogger.debug("Collecting Node stats")
89
+ nodes = NewRelic::F5Plugin::Nodes.new snmp
90
+ node_status = nodes.get_status
91
+ node_status.each_key { |m| report_metric m, node_status[m][:label], node_status[m][:count] } unless node_status.nil?
60
92
 
61
93
  #
62
94
  # Collect virtual server statistics
63
95
  #
96
+ NewRelic::PlatformLogger.debug("Collecting Virtual Server stats")
64
97
  vs = NewRelic::F5Plugin::Virtuals.new snmp
65
98
  virtual_requests = vs.get_requests
66
- virtual_requests.each_key { |m|
67
- report_counter_metric m, "req/sec", virtual_requests[m]
68
- }
99
+ virtual_requests.each_key { |m| report_counter_metric m, "req/sec", virtual_requests[m] } unless virtual_requests.nil?
69
100
 
70
101
  virtual_conns_current = vs.get_conns_current
71
- virtual_conns_current.each_key { |m|
72
- report_metric m, "conns", virtual_conns_current[m]
73
- }
102
+ virtual_conns_current.each_key { |m| report_metric m, "conns", virtual_conns_current[m] } unless virtual_conns_current.nil?
74
103
 
75
104
  virtual_conns_total = vs.get_conns_total
76
- virtual_conns_total.each_key { |m|
77
- report_counter_metric m, "conn/sec", virtual_conns_total[m]
78
- }
105
+ virtual_conns_total.each_key { |m| report_counter_metric m, "conn/sec", virtual_conns_total[m] } unless virtual_conns_total.nil?
79
106
 
80
107
  virtual_throughput_in = vs.get_throughput_in
81
- virtual_throughput_in.each_key { |m|
82
- report_counter_metric m, "bits/sec", virtual_throughput_in[m]
83
- }
108
+ virtual_throughput_in.each_key { |m| report_counter_metric m, "bits/sec", virtual_throughput_in[m] } unless virtual_throughput_in.nil?
84
109
 
85
110
  virtual_throughput_out = vs.get_throughput_out
86
- virtual_throughput_out.each_key { |m|
87
- report_counter_metric m, "bits/sec", virtual_throughput_out[m]
88
- }
111
+ virtual_throughput_out.each_key { |m| report_counter_metric m, "bits/sec", virtual_throughput_out[m] } unless virtual_throughput_out.nil?
89
112
 
90
113
  virtual_cpu_usage_1m = vs.get_cpu_usage_1m
91
- virtual_cpu_usage_1m.each_key { |m|
92
- report_metric m, "%", virtual_cpu_usage_1m[m]
93
- }
114
+ virtual_cpu_usage_1m.each_key { |m| report_metric m, "%", virtual_cpu_usage_1m[m] } unless virtual_cpu_usage_1m.nil?
94
115
 
95
116
  #
96
117
  # Collect pool statistics
97
118
  #
119
+ NewRelic::PlatformLogger.debug("Collecting Pool stats")
98
120
  pool = NewRelic::F5Plugin::Pools.new snmp
99
121
  pool_requests = pool.get_requests
100
- pool_requests.each_key { |m|
101
- report_counter_metric m, "req/sec", pool_requests[m]
102
- }
122
+ pool_requests.each_key { |m| report_counter_metric m, "req/sec", pool_requests[m] } unless pool_requests.nil?
103
123
 
104
124
  pool_conns_current = pool.get_conns_current
105
- pool_conns_current.each_key { |m|
106
- report_metric m, "conns", pool_conns_current[m]
107
- }
125
+ pool_conns_current.each_key { |m| report_metric m, "conns", pool_conns_current[m] } unless pool_conns_current.nil?
108
126
 
109
127
  pool_conns_total = pool.get_conns_total
110
- pool_conns_total.each_key { |m|
111
- report_counter_metric m, "conn/sec", pool_conns_total[m]
112
- }
128
+ pool_conns_total.each_key { |m| report_counter_metric m, "conn/sec", pool_conns_total[m] } unless pool_conns_total.nil?
113
129
 
114
130
  pool_throughput_in = pool.get_throughput_in
115
- pool_throughput_in.each_key { |m|
116
- report_counter_metric m, "bits/sec", pool_throughput_in[m]
117
- }
131
+ pool_throughput_in.each_key { |m| report_counter_metric m, "bits/sec", pool_throughput_in[m] } unless pool_throughput_in.nil?
118
132
 
119
133
  pool_throughput_out = pool.get_throughput_out
120
- pool_throughput_out.each_key { |m|
121
- report_counter_metric m, "bits/sec", pool_throughput_out[m]
122
- }
123
-
134
+ pool_throughput_out.each_key { |m| report_counter_metric m, "bits/sec", pool_throughput_out[m] } unless pool_throughput_out.nil?
124
135
 
136
+ #
137
+ # Cleanup snmp connection
138
+ #
125
139
  snmp.close
126
- rescue => e
127
- $stderr.puts "#{e}: #{e.backtrace.join("\n ")}"
128
140
  end
129
141
 
130
142
 
@@ -149,295 +161,6 @@ module NewRelic::F5Plugin
149
161
  report_metric metric, type, @processors[metric].process(value)
150
162
  end
151
163
 
152
-
153
- #
154
- # Gather CPU Related metrics and report them
155
- #
156
- def report_global_cpu_metrics(snmp)
157
- # Create the OIDs if they do not exist
158
- @oid_sysGlobalHostCpuUser1m ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.20.22.0")
159
- @oid_sysGlobalHostCpuNice1m ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.20.23.0")
160
- @oid_sysGlobalHostCpuSystem1m ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.20.24.0")
161
- #@oid_sysGlobalHostCpuIdle1m ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.20.25.0") # Ignoring the idle time
162
- @oid_sysGlobalHostCpuIrq1m ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.20.26.0")
163
- @oid_sysGlobalHostCpuSoftirq1m ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.20.27.0")
164
- @oid_sysGlobalHostCpuIowait1m ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.20.28.0")
165
- @oid_sysGlobalHostCpuCount ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.20.4.0")
166
-
167
- if snmp
168
- res = snmp.get_value([@oid_sysGlobalHostCpuCount, @oid_sysGlobalHostCpuUser1m, @oid_sysGlobalHostCpuNice1m,
169
- @oid_sysGlobalHostCpuSystem1m, @oid_sysGlobalHostCpuIrq1m, @oid_sysGlobalHostCpuSoftirq1m,
170
- @oid_sysGlobalHostCpuIowait1m, ])
171
-
172
- # In order to show the CPU usage as a total percentage, we divide by the number of cpus
173
- cpu_count = res[0].to_i
174
- vals = res[1..6].map { |i| i.to_f / cpu_count }
175
- report_metric "CPU/Global/User", "%", vals[0]
176
- report_metric "CPU/Global/Nice", "%", vals[1]
177
- report_metric "CPU/Global/System", "%", vals[2]
178
- report_metric "CPU/Global/IRQ", "%", vals[3]
179
- report_metric "CPU/Global/Soft IRQ", "%", vals[4]
180
- report_metric "CPU/Global/IO Wait", "%", vals[5]
181
-
182
- # Add it all up, and send a summary metric
183
- report_metric "CPU/Total/Global", "%", vals.inject(0.0){ |a,b| a + b }
184
- end
185
- end
186
-
187
-
188
- #
189
- # Gather Memory related metrics and report them
190
- #
191
- def report_global_memory_metrics(snmp)
192
- # Create the OIDs if they don't exist
193
- @oid_sysStatMemoryUsed ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.1.45.0")
194
- @oid_sysHostMemoryUsed ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.7.1.2.0")
195
-
196
- if snmp
197
- res = snmp.get_value([@oid_sysStatMemoryUsed, @oid_sysHostMemoryUsed])
198
- report_metric "Memory/TMM", "bytes", res[0]
199
- report_metric "Memory/Host", "bytes", res[1]
200
- end
201
- end
202
-
203
-
204
- #
205
- # Gather Global connection related metrics and report them
206
- #
207
- def report_global_connection_metrics(snmp)
208
- # Create the OIDs if they don't exist
209
- @oid_sysStatClientCurConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.1.8.0")
210
- @oid_sysStatServerCurConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.1.15.0")
211
- @oid_sysStatClientTotConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.1.7.0")
212
- @oid_sysStatServerTotConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.1.14.0")
213
- #@oid_sysStatPvaClientCurConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.1.22.0")
214
- #@oid_sysStatPvaServerCurConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.1.29.0")
215
- # These should be moved to an SSL metric...
216
- @oid_sysClientsslStatCurConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.9.2.0")
217
- @oid_sysServersslStatCurConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.10.2.0")
218
-
219
- if snmp
220
- res = snmp.get_value([@oid_sysStatClientCurConns, @oid_sysStatServerCurConns, @oid_sysStatClientTotConns,
221
- @oid_sysStatServerTotConns, @oid_sysClientsslStatCurConns, @oid_sysServersslStatCurConns])
222
- report_metric "Connections/Current/Client", "conn", res[0]
223
- report_metric "Connections/Current/Server", "conn", res[1]
224
- report_counter_metric "Connections/Rate/Client", "conn/sec", res[2]
225
- report_counter_metric "Connections/Rate/Server", "conn/sec", res[3]
226
- report_metric "Connections/Current/Client SSL", "conn", res[4]
227
- report_metric "Connections/Current/Server SSL", "conn", res[5]
228
- end
229
- end
230
-
231
-
232
- #
233
- # Gather Global throughput related metrics and report them
234
- #
235
- def report_global_throughput_metrics(snmp)
236
- # Create the OIDs if they don't exist
237
- @oid_sysStatClientBytesIn ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.1.3.0")
238
- @oid_sysStatClientBytesOut ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.1.5.0")
239
- @oid_sysStatServerBytesIn ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.1.10.0")
240
- @oid_sysStatServerBytesOut ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.1.12.0")
241
-
242
- if snmp
243
- res = snmp.get_value([@oid_sysStatClientBytesIn, @oid_sysStatClientBytesOut, @oid_sysStatServerBytesIn,
244
- @oid_sysStatServerBytesOut])
245
-
246
- report_counter_metric "Throughput/Client/In", "bits/sec", (res[0].to_f * 8)
247
- report_counter_metric "Throughput/Client/Out", "bits/sec", (res[1].to_f * 8)
248
- report_counter_metric "Throughput/Server/In", "bits/sec", (res[2].to_f * 8)
249
- report_counter_metric "Throughput/Server/Out", "bits/sec", (res[3].to_f * 8)
250
- tot = 0
251
- res.each { |x| tot += x.to_f }
252
- report_counter_metric "Throughput/Total", "bits/sec", (tot * 8)
253
- end
254
- end
255
-
256
-
257
- #
258
- # Gather Global HTTP related metrics and report them
259
- #
260
- def report_global_http_metrics(snmp)
261
- # Create the OIDs if they don't exist
262
- @oid_sysHttpStatResp2xxCnt ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.3.0")
263
- @oid_sysHttpStatResp3xxCnt ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.4.0")
264
- @oid_sysHttpStatResp4xxCnt ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.5.0")
265
- @oid_sysHttpStatResp5xxCnt ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.6.0")
266
- @oid_sysHttpStatNumberReqs ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.7.0")
267
- @oid_sysHttpStatGetReqs ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.8.0")
268
- @oid_sysHttpStatPostReqs ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.9.0")
269
- @oid_sysHttpStatV9Reqs ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.10.0")
270
- @oid_sysHttpStatV10Reqs ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.11.0")
271
- @oid_sysHttpStatV11Reqs ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.12.0")
272
- @oid_sysHttpStatV9Resp ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.13.0")
273
- @oid_sysHttpStatV10Resp ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.14.0")
274
- @oid_sysHttpStatV11Resp ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.15.0")
275
- @oid_sysHttpStatRespBucket1k ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.17.0")
276
- @oid_sysHttpStatRespBucket4k ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.18.0")
277
- @oid_sysHttpStatRespBucket16k ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.19.0")
278
- @oid_sysHttpStatRespBucket32k ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.4.20.0")
279
-
280
- if snmp
281
- res = snmp.get_value([@oid_sysHttpStatResp2xxCnt, @oid_sysHttpStatResp3xxCnt, @oid_sysHttpStatResp4xxCnt,
282
- @oid_sysHttpStatResp5xxCnt, @oid_sysHttpStatNumberReqs, @oid_sysHttpStatGetReqs,
283
- @oid_sysHttpStatPostReqs, @oid_sysHttpStatV9Reqs, @oid_sysHttpStatV10Reqs,
284
- @oid_sysHttpStatV11Reqs, @oid_sysHttpStatV9Resp, @oid_sysHttpStatV10Resp,
285
- @oid_sysHttpStatV11Resp, @oid_sysHttpStatRespBucket1k, @oid_sysHttpStatRespBucket4k,
286
- @oid_sysHttpStatRespBucket16k, @oid_sysHttpStatRespBucket32k, ])
287
-
288
- report_counter_metric "HTTP/Response Code/2xx", "resp/sec", res[0]
289
- report_counter_metric "HTTP/Response Code/3xx", "resp/sec", res[1]
290
- report_counter_metric "HTTP/Response Code/4xx", "resp/sec", res[2]
291
- report_counter_metric "HTTP/Response Code/5xx", "resp/sec", res[3]
292
-
293
- report_counter_metric "HTTP/Method/All", "req/sec", res[4]
294
- report_counter_metric "HTTP/Method/Get", "req/sec", res[5]
295
- report_counter_metric "HTTP/Method/Post", "req/sec", res[6]
296
- report_counter_metric "HTTP/Version/v0.9/Request", "req/sec", res[7]
297
- report_counter_metric "HTTP/Version/v1.0/Request", "req/sec", res[8]
298
- report_counter_metric "HTTP/Version/v1.1/Request", "req/sec", res[9]
299
- report_counter_metric "HTTP/Version/v0.9/Response", "resp/sec", res[10]
300
- report_counter_metric "HTTP/Version/v1.0/Response", "resp/sec", res[11]
301
- report_counter_metric "HTTP/Version/v1.1/Response", "resp/sec", res[12]
302
-
303
- report_counter_metric "HTTP/Response Size/1k Bucket", "resp/sec", res[13]
304
- report_counter_metric "HTTP/Response Size/4k Bucket", "resp/sec", res[14]
305
- report_counter_metric "HTTP/Response Size/16k Bucket", "resp/sec", res[15]
306
- report_counter_metric "HTTP/Response Size/32k Bucket", "resp/sec", res[16]
307
- end
308
- end
309
-
310
-
311
- #
312
- # HTTP Compression Stats
313
- #
314
- def report_global_http_compression_metrics(snmp)
315
- @oid_sysHttpCompressionStatPrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.2.0")
316
- @oid_sysHttpCompressionStatPostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.3.0")
317
- @oid_sysHttpCompressionStatHtmlPrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.5.0")
318
- @oid_sysHttpCompressionStatHtmlPostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.6.0")
319
- @oid_sysHttpCompressionStatCssPrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.7.0")
320
- @oid_sysHttpCompressionStatCssPostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.8.0")
321
- @oid_sysHttpCompressionStatJsPrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.9.0")
322
- @oid_sysHttpCompressionStatJsPostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.10.0")
323
- @oid_sysHttpCompressionStatXmlPrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.11.0")
324
- @oid_sysHttpCompressionStatXmlPostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.12.0")
325
- @oid_sysHttpCompressionStatSgmlPrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.13.0")
326
- @oid_sysHttpCompressionStatSgmlPostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.14.0")
327
- @oid_sysHttpCompressionStatPlainPrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.15.0")
328
- @oid_sysHttpCompressionStatPlainPostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.16.0")
329
- @oid_sysHttpCompressionStatOctetPrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.17.0")
330
- @oid_sysHttpCompressionStatOctetPostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.18.0")
331
- @oid_sysHttpCompressionStatImagePrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.19.0")
332
- @oid_sysHttpCompressionStatImagePostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.20.0")
333
- @oid_sysHttpCompressionStatVideoPrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.21.0")
334
- @oid_sysHttpCompressionStatVideoPostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.22.0")
335
- @oid_sysHttpCompressionStatAudioPrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.23.0")
336
- @oid_sysHttpCompressionStatAudioPostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.24.0")
337
- @oid_sysHttpCompressionStatOtherPrecompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.25.0")
338
- @oid_sysHttpCompressionStatOtherPostcompressBytes ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.22.26.0")
339
-
340
- if snmp
341
- res = snmp.get_value([@oid_sysHttpCompressionStatPrecompressBytes, @oid_sysHttpCompressionStatPostcompressBytes,
342
- @oid_sysHttpCompressionStatHtmlPrecompressBytes, @oid_sysHttpCompressionStatHtmlPostcompressBytes,
343
- @oid_sysHttpCompressionStatCssPrecompressBytes, @oid_sysHttpCompressionStatCssPostcompressBytes,
344
- @oid_sysHttpCompressionStatJsPrecompressBytes, @oid_sysHttpCompressionStatJsPostcompressBytes,
345
- @oid_sysHttpCompressionStatXmlPrecompressBytes, @oid_sysHttpCompressionStatXmlPostcompressBytes,
346
- @oid_sysHttpCompressionStatSgmlPrecompressBytes, @oid_sysHttpCompressionStatSgmlPostcompressBytes,
347
- @oid_sysHttpCompressionStatPlainPrecompressBytes, @oid_sysHttpCompressionStatPlainPostcompressBytes,
348
- @oid_sysHttpCompressionStatOctetPrecompressBytes, @oid_sysHttpCompressionStatOctetPostcompressBytes,
349
- @oid_sysHttpCompressionStatImagePrecompressBytes, @oid_sysHttpCompressionStatImagePostcompressBytes,
350
- @oid_sysHttpCompressionStatVideoPrecompressBytes, @oid_sysHttpCompressionStatVideoPostcompressBytes,
351
- @oid_sysHttpCompressionStatAudioPrecompressBytes, @oid_sysHttpCompressionStatAudioPostcompressBytes,
352
- @oid_sysHttpCompressionStatOtherPrecompressBytes, @oid_sysHttpCompressionStatOtherPostcompressBytes, ])
353
-
354
- vals = res.map { |i| i.to_f * 8 } # Convert to bits
355
- report_counter_metric "HTTP/Compression/Total/Pre", "bits/sec", vals[0]
356
- report_counter_metric "HTTP/Compression/Total/Post", "bits/sec", vals[1]
357
- report_counter_metric "HTTP/Compression/HTML/Pre", "bits/sec", vals[2]
358
- report_counter_metric "HTTP/Compression/HTML/Post", "bits/sec", vals[3]
359
- report_counter_metric "HTTP/Compression/CSS/Pre", "bits/sec", vals[4]
360
- report_counter_metric "HTTP/Compression/CSS/Post", "bits/sec", vals[5]
361
- report_counter_metric "HTTP/Compression/Javascript/Pre", "bits/sec", vals[6]
362
- report_counter_metric "HTTP/Compression/Javascript/Post", "bits/sec", vals[7]
363
- report_counter_metric "HTTP/Compression/XML/Pre", "bits/sec", vals[8]
364
- report_counter_metric "HTTP/Compression/XML/Post", "bits/sec", vals[9]
365
- report_counter_metric "HTTP/Compression/SGML/Pre", "bits/sec", vals[10]
366
- report_counter_metric "HTTP/Compression/SGML/Post", "bits/sec", vals[11]
367
- report_counter_metric "HTTP/Compression/Plain/Pre", "bits/sec", vals[12]
368
- report_counter_metric "HTTP/Compression/Plain/Post", "bits/sec", vals[13]
369
- report_counter_metric "HTTP/Compression/Octet/Pre", "bits/sec", vals[14]
370
- report_counter_metric "HTTP/Compression/Octet/Post", "bits/sec", vals[15]
371
- report_counter_metric "HTTP/Compression/Image/Pre", "bits/sec", vals[16]
372
- report_counter_metric "HTTP/Compression/Image/Post", "bits/sec", vals[17]
373
- report_counter_metric "HTTP/Compression/Video/Pre", "bits/sec", vals[18]
374
- report_counter_metric "HTTP/Compression/Video/Post", "bits/sec", vals[19]
375
- report_counter_metric "HTTP/Compression/Audio/Pre", "bits/sec", vals[20]
376
- report_counter_metric "HTTP/Compression/Audio/Post", "bits/sec", vals[21]
377
- report_counter_metric "HTTP/Compression/Other/Pre", "bits/sec", vals[22]
378
- report_counter_metric "HTTP/Compression/Other/Post", "bits/sec", vals[23]
379
- end
380
- end
381
-
382
- #
383
- # SSL Stats
384
- #
385
- def report_global_ssl_metrics(snmp)
386
- @oid_sysClientsslStatTotNativeConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.9.6.0")
387
- @oid_sysClientsslStatTotCompatConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.9.9.0")
388
- @oid_sysServersslStatTotNativeConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.10.6.0")
389
- @oid_sysServersslStatTotCompatConns ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.10.9.0")
390
-
391
- if snmp
392
- res = snmp.get_value([@oid_sysClientsslStatTotNativeConns, @oid_sysClientsslStatTotCompatConns, @oid_sysServersslStatTotNativeConns,
393
- @oid_sysServersslStatTotCompatConns])
394
- vals = res.map { |i| i.to_i }
395
- report_counter_metric "SSL/Global/Client/Native", "trans/sec", vals[0]
396
- report_counter_metric "SSL/Global/Client/Compat", "trans/sec", vals[1]
397
- report_counter_metric "SSL/Global/Server/Native", "trans/sec", vals[2]
398
- report_counter_metric "SSL/Global/Server/Compat", "trans/sec", vals[3]
399
- report_counter_metric "SSL/Global/Total/Client", "trans/sec", (vals[0] + vals[1])
400
- report_counter_metric "SSL/Global/Total/Server", "trans/sec", (vals[2] + vals[3])
401
- report_counter_metric "SSL/Global/Total/All", "trans/sec", vals.inject(0) { |t,i| t + i }
402
- end
403
- end
404
-
405
-
406
- #
407
- # Gather TCP Statistics and report them
408
- #
409
- def report_global_tcp_metrics(snmp)
410
- # Create the OIDs if they don't exist
411
- @oid_sysTcpStatOpen ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.2.0") # "The number of current open connections."
412
- @oid_sysTcpStatCloseWait ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.3.0") # "The number of current connections in CLOSE-WAIT/LAST-ACK."
413
- @oid_sysTcpStatFinWait ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.4.0") # "The number of current connections in FIN-WAIT/CLOSING."
414
- @oid_sysTcpStatTimeWait ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.5.0") # "The number of current connections in TIME-WAIT."
415
- @oid_sysTcpStatAccepts ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.6.0") # "The number of connections accepted."
416
- # @oid_sysTcpStatAcceptfails ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.7.0") # "The number of connections not accepted."
417
- # @oid_sysTcpStatConnects ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.8.0") # "The number of connections established."
418
- # @oid_sysTcpStatConnfails ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.9.0") # "The number of connection failures."
419
- # @oid_sysTcpStatExpires ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.10.0") # "The number of connections expired due to idle timeout."
420
- # @oid_sysTcpStatAbandons ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.11.0") # "The number of connections abandoned connections due to retries/keep-alives."
421
- # @oid_sysTcpStatRxrst ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.12.0") # "The number of received RST."
422
- # @oid_sysTcpStatRxbadsum ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.13.0") # "The number of bad checksum."
423
- # @oid_sysTcpStatRxbadseg ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.14.0") # "The number of malformed segments."
424
- # @oid_sysTcpStatRxooseg ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.15.0") # "The number of out of order segments."
425
- # @oid_sysTcpStatRxcookie ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.16.0") # "The number of received SYN-cookies."
426
- # @oid_sysTcpStatRxbadcookie ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.17.0") # "The number of bad SYN-cookies."
427
- # @oid_sysTcpStatSyncacheover ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.18.0") # "The number of SYN-cache overflow."
428
- # @oid_sysTcpStatTxrexmits ||= SNMP::ObjectId.new("1.3.6.1.4.1.3375.2.1.1.2.12.19.0") # "The number of retransmitted segments."
429
- if snmp
430
- res = snmp.get_value([@oid_sysTcpStatOpen, @oid_sysTcpStatCloseWait, @oid_sysTcpStatFinWait,
431
- @oid_sysTcpStatTimeWait, @oid_sysTcpStatAccepts, ])
432
-
433
- report_metric "TCP/Connection State/Open", "conn", res[0]
434
- report_metric "TCP/Connection State/Wait/Close", "conn", res[1]
435
- report_metric "TCP/Connection State/Wait/FIN", "conn", res[2]
436
- report_metric "TCP/Connection State/Wait/TIME", "conn", res[3]
437
- report_counter_metric "TCP/Accepts", "conn/sec", res[4]
438
- end
439
- end
440
-
441
164
  end
442
165
  end
443
166