newrelic_f5_plugin 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ * 1.0.7
2
+ - Better handling of older versions of BIG-IP (pre 11.3.0)
3
+ - Print F5 version in debug logs
4
+
1
5
  * 1.0.6
2
6
  - Fix throughput reporting issue caused by the refactor.
3
7
 
@@ -4,7 +4,7 @@ require 'newrelic_plugin'
4
4
  require 'snmp'
5
5
 
6
6
  module NewRelic::F5Plugin
7
- VERSION = '1.0.6'
7
+ VERSION = '1.0.7'
8
8
 
9
9
  # Register and run the agent
10
10
  def self.run
@@ -49,6 +49,10 @@ module NewRelic::F5Plugin
49
49
  # Device wide metrics
50
50
  #
51
51
  system = NewRelic::F5Plugin::Device.new snmp
52
+
53
+ system_version = system.get_version
54
+ NewRelic::PlatformLogger.debug("Found F5 device with version: #{system_version}")
55
+
52
56
  system_cpu = system.get_cpu
53
57
  system_cpu.each_key { |m| report_metric m, "%", system_cpu[m] } unless system_cpu.nil?
54
58
 
@@ -66,6 +66,11 @@ module NewRelic
66
66
  OID_SYS_HTTP_STAT_V11_RESP = "#{OID_SYS_HTTP_STAT}.15.0"
67
67
  OID_SYS_HTTP_STAT_V9_REQS = "#{OID_SYS_HTTP_STAT}.10.0"
68
68
  OID_SYS_HTTP_STAT_V9_RESP = "#{OID_SYS_HTTP_STAT}.13.0"
69
+ OID_SYS_PRODUCT = "1.3.6.1.4.1.3375.2.1.4"
70
+ OID_SYS_PRODUCT_NAME = "#{OID_SYS_PRODUCT}.1.0"
71
+ OID_SYS_PRODUCT_VERSION = "#{OID_SYS_PRODUCT}.2.0"
72
+ OID_SYS_PRODUCT_BUILD = "#{OID_SYS_PRODUCT}.3.0"
73
+ OID_SYS_PRODUCT_EDITION = "#{OID_SYS_PRODUCT}.4.0"
69
74
  OID_SYS_SERVERSSL_STAT_CUR_CONNS = "1.3.6.1.4.1.3375.2.1.1.2.10.2.0"
70
75
  OID_SYS_SERVERSSL_STAT_TOT_COMPAT_CONNS = "1.3.6.1.4.1.3375.2.1.1.2.10.9.0"
71
76
  OID_SYS_SERVERSSL_STAT_TOT_NATIVE_CONNS = "1.3.6.1.4.1.3375.2.1.1.2.10.6.0"
@@ -113,6 +118,21 @@ module NewRelic
113
118
  end
114
119
  end
115
120
 
121
+ #
122
+ # Gather Version information
123
+ #
124
+ def get_version(snmp = nil)
125
+ version = "Unknown!"
126
+ snmp = snmp_manager unless snmp
127
+
128
+ if snmp
129
+ res = gather_snmp_metrics_array([OID_SYS_PRODUCT_VERSION, OID_SYS_PRODUCT_BUILD], snmp)
130
+
131
+ version = "#{res[0]}.#{res[1]}" unless res.empty?
132
+ end
133
+
134
+ return version
135
+ end
116
136
 
117
137
 
118
138
  #
@@ -128,6 +148,9 @@ module NewRelic
128
148
  OID_SYS_GLOBAL_HOST_CPU_IOWAIT_1M],
129
149
  snmp)
130
150
 
151
+ # Bail out if we didn't get anything
152
+ return metrics if res.empty?
153
+
131
154
  # In order to show the CPU usage as a total percentage, we divide by the number of cpus
132
155
  cpu_count = res[0].to_i
133
156
  vals = res[1..6].map { |i| i.to_f / cpu_count }
@@ -158,6 +181,9 @@ module NewRelic
158
181
  if snmp
159
182
  res = gather_snmp_metrics_array([OID_SYS_STAT_MEMORY_USED, OID_SYS_HOST_MEMORY_USED], snmp)
160
183
 
184
+ # Bail out if we didn't get anything
185
+ return metrics if res.empty?
186
+
161
187
  metrics["Memory/TMM"] = res[0]
162
188
  metrics["Memory/Host"] = res[1]
163
189
  end
@@ -178,6 +204,9 @@ module NewRelic
178
204
  OID_SYS_CLIENTSSL_STAT_CUR_CONNS, OID_SYS_SERVERSSL_STAT_CUR_CONNS],
179
205
  snmp)
180
206
 
207
+ # Bail out if we didn't get anything
208
+ return metrics if res.empty?
209
+
181
210
  metrics["Connections/Current/Client"] = res[0]
182
211
  metrics["Connections/Current/Server"] = res[1]
183
212
  metrics["Connections/Current/Client SSL"] = res[2]
@@ -198,6 +227,9 @@ module NewRelic
198
227
  if snmp
199
228
  res = gather_snmp_metrics_array([OID_SYS_STAT_CLIENT_TOT_CONNS, OID_SYS_STAT_SERVER_TOT_CONNS], snmp)
200
229
 
230
+ # Bail out if we didn't get anything
231
+ return metrics if res.empty?
232
+
201
233
  metrics["Connections/Rate/Client"] = res[0]
202
234
  metrics["Connections/Rate/Server"] = res[1]
203
235
  end
@@ -218,6 +250,9 @@ module NewRelic
218
250
  OID_SYS_STAT_SERVER_BYTES_IN, OID_SYS_STAT_SERVER_BYTES_OUT],
219
251
  snmp)
220
252
 
253
+ # Bail out if we didn't get anything
254
+ return metrics if res.empty?
255
+
221
256
  metrics["Throughput/Client/In"] = (res[0].to_f * 8)
222
257
  metrics["Throughput/Client/Out"] = (res[1].to_f * 8)
223
258
  metrics["Throughput/Server/In"] = (res[2].to_f * 8)
@@ -243,6 +278,9 @@ module NewRelic
243
278
  OID_SYS_HTTP_STAT_V9_REQS, OID_SYS_HTTP_STAT_V10_REQS, OID_SYS_HTTP_STAT_V11_REQS],
244
279
  snmp)
245
280
 
281
+ # Bail out if we didn't get anything
282
+ return metrics if res.empty?
283
+
246
284
  metrics["HTTP/Method/All"] = res[0]
247
285
  metrics["HTTP/Method/Get"] = res[1]
248
286
  metrics["HTTP/Method/Post"] = res[2]
@@ -269,6 +307,9 @@ module NewRelic
269
307
  OID_SYS_HTTP_STAT_RESP_BUCKET_16K, OID_SYS_HTTP_STAT_RESP_BUCKET_32K],
270
308
  snmp)
271
309
 
310
+ # Bail out if we didn't get anything
311
+ return metrics if res.empty?
312
+
272
313
  metrics["HTTP/Response Code/2xx"] = res[0]
273
314
  metrics["HTTP/Response Code/3xx"] = res[1]
274
315
  metrics["HTTP/Response Code/4xx"] = res[2]
@@ -308,7 +349,11 @@ module NewRelic
308
349
  OID_SYS_HTTP_COMPRESSION_STAT_OTHER_PRECOMPRESS_BYTES, OID_SYS_HTTP_COMPRESSION_STAT_OTHER_POSTCOMPRESS_BYTES],
309
350
  snmp)
310
351
 
311
- vals = res.map { |i| i.to_f * 8 } # Convert to bits
352
+ # Bail out if we didn't get anything
353
+ return metrics if res.empty?
354
+
355
+ vals = bytes_to_bits(res)
356
+
312
357
  metrics["HTTP/Compression/Total/Pre"] = vals[0]
313
358
  metrics["HTTP/Compression/Total/Post"] = vals[1]
314
359
  metrics["HTTP/Compression/HTML/Pre"] = vals[2]
@@ -352,6 +397,9 @@ module NewRelic
352
397
  OID_SYS_SERVERSSL_STAT_TOT_NATIVE_CONNS, OID_SYS_SERVERSSL_STAT_TOT_COMPAT_CONNS],
353
398
  snmp)
354
399
 
400
+ # Bail out if we didn't get anything
401
+ return metrics if res.empty?
402
+
355
403
  vals = res.map { |i| i.to_i }
356
404
 
357
405
  metrics["SSL/Global/Client/Native"] = vals[0]
@@ -379,6 +427,9 @@ module NewRelic
379
427
  OID_SYS_TCP_STAT_TIME_WAIT],
380
428
  snmp)
381
429
 
430
+ # Bail out if we didn't get anything
431
+ return metrics if res.empty?
432
+
382
433
  metrics["TCP/Connection State/Open"] = res[0]
383
434
  metrics["TCP/Connection State/Wait/Close"] = res[1]
384
435
  metrics["TCP/Connection State/Wait/FIN"] = res[2]
@@ -399,6 +450,9 @@ module NewRelic
399
450
  if snmp
400
451
  res = gather_snmp_metrics_array([OID_SYS_TCP_STAT_ACCEPTS], snmp)
401
452
 
453
+ # Bail out if we didn't get anything
454
+ return metrics if res.empty?
455
+
402
456
  metrics["TCP/Accepts"] = res[0]
403
457
  end
404
458
 
@@ -65,13 +65,43 @@ def gather_snmp_metrics_array(oids, snmp)
65
65
 
66
66
  if snmp
67
67
  begin
68
- metrics = snmp.get_value(oids)
68
+ metrics = snmp.get_value(oids).map do |val|
69
+ # If an OID is missing, just return zero for that metric
70
+ if val.to_s == 'noSuchObject'
71
+ 0
72
+ else
73
+ val
74
+ end
75
+ end
69
76
  rescue Exception => e
70
77
  NewRelic::PlatformLogger.error("Unable to gather SNMP metrics with error: #{e}")
71
- return
72
78
  end
73
79
  end
74
80
 
75
81
  return metrics
76
82
  end
77
83
 
84
+
85
+ #
86
+ # Convert bytes to bits
87
+ #
88
+ def bytes_to_bits(vals)
89
+ ret = nil
90
+
91
+ if vals.class == Array
92
+ ret = vals.map { |i| i.to_f * 8 }
93
+ elsif vals.class == Hash
94
+ ret = { }
95
+ vals.keys.each do |k,v|
96
+ if v.nil?
97
+ ret[k] = v
98
+ else
99
+ ret[k] = v.to_f * 8
100
+ end
101
+ end
102
+ end
103
+
104
+ return ret
105
+ end
106
+
107
+
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  ## If your rubyforge_project name is different, then edit it and comment out
14
14
  ## the sub! line in the Rakefile
15
15
  s.name = 'newrelic_f5_plugin'
16
- s.version = '1.0.6'
17
- s.date = '2013-10-23'
16
+ s.version = '1.0.7'
17
+ s.date = '2013-10-28'
18
18
  s.rubyforge_project = 'newrelic_f5_plugin'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_f5_plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-23 00:00:00.000000000 Z
12
+ date: 2013-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: newrelic_plugin