Class: NewRelic::F5Plugin::Device

Inherits:
Object
  • Object
show all
Defined in:
lib/newrelic_f5_plugin/device.rb

Constant Summary collapse

OID_SYS_HTTP_COMPRESSION_STAT =

Create the OIDs if they do not exist

"1.3.6.1.4.1.3375.2.1.1.2.22"
OID_SYS_HTTP_COMPRESSION_STAT_AUDIO_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.24.0"
OID_SYS_HTTP_COMPRESSION_STAT_AUDIO_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.23.0"
OID_SYS_HTTP_COMPRESSION_STAT_CSS_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.8.0"
OID_SYS_HTTP_COMPRESSION_STAT_CSS_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.7.0"
OID_SYS_HTTP_COMPRESSION_STAT_HTML_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.6.0"
OID_SYS_HTTP_COMPRESSION_STAT_HTML_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.5.0"
OID_SYS_HTTP_COMPRESSION_STAT_IMAGE_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.20.0"
OID_SYS_HTTP_COMPRESSION_STAT_IMAGE_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.19.0"
OID_SYS_HTTP_COMPRESSION_STAT_JS_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.10.0"
OID_SYS_HTTP_COMPRESSION_STAT_JS_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.9.0"
OID_SYS_HTTP_COMPRESSION_STAT_OCTET_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.18.0"
OID_SYS_HTTP_COMPRESSION_STAT_OCTET_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.17.0"
OID_SYS_HTTP_COMPRESSION_STAT_OTHER_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.26.0"
OID_SYS_HTTP_COMPRESSION_STAT_OTHER_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.25.0"
OID_SYS_HTTP_COMPRESSION_STAT_PLAIN_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.16.0"
OID_SYS_HTTP_COMPRESSION_STAT_PLAIN_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.15.0"
OID_SYS_HTTP_COMPRESSION_STAT_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.3.0"
OID_SYS_HTTP_COMPRESSION_STAT_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.2.0"
OID_SYS_HTTP_COMPRESSION_STAT_SGML_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.14.0"
OID_SYS_HTTP_COMPRESSION_STAT_SGML_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.13.0"
OID_SYS_HTTP_COMPRESSION_STAT_VIDEO_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.22.0"
OID_SYS_HTTP_COMPRESSION_STAT_VIDEO_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.21.0"
OID_SYS_HTTP_COMPRESSION_STAT_XML_POSTCOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.12.0"
OID_SYS_HTTP_COMPRESSION_STAT_XML_PRECOMPRESS_BYTES =
"#{OID_SYS_HTTP_COMPRESSION_STAT}.11.0"
OID_SYS_HTTP_STAT =
"1.3.6.1.4.1.3375.2.1.1.2.4"
OID_SYS_HTTP_STAT_GET_REQS =
"#{OID_SYS_HTTP_STAT}.8.0"
OID_SYS_HTTP_STAT_NUMBER_REQS =
"#{OID_SYS_HTTP_STAT}.7.0"
OID_SYS_HTTP_STAT_POST_REQS =
"#{OID_SYS_HTTP_STAT}.9.0"
OID_SYS_HTTP_STAT_RESP_2XX_CNT =
"#{OID_SYS_HTTP_STAT}.3.0"
OID_SYS_HTTP_STAT_RESP_3XX_CNT =
"#{OID_SYS_HTTP_STAT}.4.0"
OID_SYS_HTTP_STAT_RESP_4XX_CNT =
"#{OID_SYS_HTTP_STAT}.5.0"
OID_SYS_HTTP_STAT_RESP_5XX_CNT =
"#{OID_SYS_HTTP_STAT}.6.0"
OID_SYS_HTTP_STAT_RESP_BUCKET_16K =
"#{OID_SYS_HTTP_STAT}.19.0"
OID_SYS_HTTP_STAT_RESP_BUCKET_1K =
"#{OID_SYS_HTTP_STAT}.17.0"
OID_SYS_HTTP_STAT_RESP_BUCKET_32K =
"#{OID_SYS_HTTP_STAT}.20.0"
OID_SYS_HTTP_STAT_RESP_BUCKET_4K =
"#{OID_SYS_HTTP_STAT}.18.0"
OID_SYS_HTTP_STAT_V10_REQS =
"#{OID_SYS_HTTP_STAT}.11.0"
OID_SYS_HTTP_STAT_V10_RESP =
"#{OID_SYS_HTTP_STAT}.14.0"
OID_SYS_HTTP_STAT_V11_REQS =
"#{OID_SYS_HTTP_STAT}.12.0"
OID_SYS_HTTP_STAT_V11_RESP =
"#{OID_SYS_HTTP_STAT}.15.0"
OID_SYS_HTTP_STAT_V9_REQS =
"#{OID_SYS_HTTP_STAT}.10.0"
OID_SYS_HTTP_STAT_V9_RESP =
"#{OID_SYS_HTTP_STAT}.13.0"
OID_SYS_STAT =
"1.3.6.1.4.1.3375.2.1.1.2.1"
OID_SYS_STAT_CLIENT_BYTES_IN =
"#{OID_SYS_STAT}.3.0"
OID_SYS_STAT_CLIENT_BYTES_OUT =
"#{OID_SYS_STAT}.5.0"
OID_SYS_STAT_CLIENT_CUR_CONNS =
"#{OID_SYS_STAT}.8.0"
OID_SYS_STAT_CLIENT_TOT_CONNS =
"#{OID_SYS_STAT}.7.0"
OID_SYS_STAT_MEMORY_USED =
"#{OID_SYS_STAT}.45.0"
OID_SYS_STAT_PVA_CLIENT_CUR_CONNS =
"#{OID_SYS_STAT}.22.0"
OID_SYS_STAT_PVA_SERVER_CUR_CONNS =
"#{OID_SYS_STAT}.29.0"
OID_SYS_STAT_SERVER_BYTES_IN =
"#{OID_SYS_STAT}.10.0"
OID_SYS_STAT_SERVER_BYTES_OUT =
"#{OID_SYS_STAT}.12.0"
OID_SYS_STAT_SERVER_CUR_CONNS =
"#{OID_SYS_STAT}.15.0"
OID_SYS_STAT_SERVER_TOT_CONNS =
"#{OID_SYS_STAT}.14.0"
OID_SYS_TCP_STAT =
"1.3.6.1.4.1.3375.2.1.1.2.12"
OID_SYS_TCP_STAT_OPEN =

“The number of current open connections.”

"#{OID_SYS_TCP_STAT}.2.0"
OID_SYS_TCP_STAT_CLOSE_WAIT =

“The number of current connections in CLOSE-WAIT/LAST-ACK.”

"#{OID_SYS_TCP_STAT}.3.0"
OID_SYS_TCP_STAT_FIN_WAIT =

“The number of current connections in FIN-WAIT/CLOSING.”

"#{OID_SYS_TCP_STAT}.4.0"
OID_SYS_TCP_STAT_TIME_WAIT =

“The number of current connections in TIME-WAIT.”

"#{OID_SYS_TCP_STAT}.5.0"
OID_SYS_TCP_STAT_ACCEPTS =

“The number of connections accepted.”

"#{OID_SYS_TCP_STAT}.6.0"
OID_SYS_TCP_STAT_ACCEPTFAILS =

“The number of connections not accepted.”

"#{OID_SYS_TCP_STAT}.7.0"
OID_SYS_TCP_STAT_CONNECTS =

“The number of connections established.”

"#{OID_SYS_TCP_STAT}.8.0"
OID_SYS_TCP_STAT_CONNFAILS =

“The number of connection failures.”

"#{OID_SYS_TCP_STAT}.9.0"
OID_SYS_TCP_STAT_EXPIRES =

“The number of connections expired due to idle timeout.”

"#{OID_SYS_TCP_STAT}.10.0"
OID_SYS_TCP_STAT_ABANDONS =

“The number of connections abandoned connections due to retries/keep-alives.”

"#{OID_SYS_TCP_STAT}.11.0"
OID_SYS_TCP_STAT_RXRST =

“The number of received RST.”

"#{OID_SYS_TCP_STAT}.12.0"
OID_SYS_TCP_STAT_RXBADSUM =

“The number of bad checksum.”

"#{OID_SYS_TCP_STAT}.13.0"
OID_SYS_TCP_STAT_RXBADSEG =

“The number of malformed segments.”

"#{OID_SYS_TCP_STAT}.14.0"
OID_SYS_TCP_STAT_RXOOSEG =

“The number of out of order segments.”

"#{OID_SYS_TCP_STAT}.15.0"
OID_SYS_TCP_STAT_RXCOOKIE =

“The number of received SYN-cookies.”

"#{OID_SYS_TCP_STAT}.16.0"
OID_SYS_TCP_STAT_RXBADCOOKIE =

“The number of bad SYN-cookies.”

"#{OID_SYS_TCP_STAT}.17.0"
OID_SYS_TCP_STAT_SYNCACHEOVER =

“The number of SYN-cache overflow.”

"#{OID_SYS_TCP_STAT}.18.0"
OID_SYS_TCP_STAT_TXREXMITS =

“The number of retransmitted segments.”

"#{OID_SYS_TCP_STAT}.19.0"
OID_SYS_GLOBAL_STAT =
"1.3.6.1.4.1.3375.2.1.1.2"
OID_SYS_STAT_HARD_SYNCOOKIE_GEN =

“The number of hardware SYN cookies are generated on the system.”

"#{OID_SYS_GLOBAL_STAT}.57.0"
OID_SYS_STAT_HARD_SYNCOOKIE_DET =

“The number of hardware SYN cookies are detected on the system.”

"#{OID_SYS_GLOBAL_STAT}.58.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(snmp = nil) ⇒ Device

Init



95
96
97
98
99
100
101
# File 'lib/newrelic_f5_plugin/device.rb', line 95

def initialize(snmp = nil)
  if snmp
    @snmp_manager = snmp
  else
    @snmp_manager = nil
  end
end

Instance Attribute Details

#snmp_managerObject

Returns the value of attribute snmp_manager.



10
11
12
# File 'lib/newrelic_f5_plugin/device.rb', line 10

def snmp_manager
  @snmp_manager
end

Instance Method Details

#get_connection_rates(snmp = nil) ⇒ Object

Gather Global connection rate related metrics and report them in conn/sec



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/newrelic_f5_plugin/device.rb', line 194

def get_connection_rates(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_STAT_CLIENT_TOT_CONNS, OID_SYS_STAT_SERVER_TOT_CONNS], snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    metrics["Connections/Rate/Client"] = res[0]
    metrics["Connections/Rate/Server"] = res[1]
  end

  return metrics
end

#get_connections(snmp = nil) ⇒ Object

Gather Global connection related metrics and report them in conn



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/newrelic_f5_plugin/device.rb', line 173

def get_connections(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_STAT_CLIENT_CUR_CONNS, OID_SYS_STAT_SERVER_CUR_CONNS], snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    metrics["Connections/Current/Client"]     = res[0]
    metrics["Connections/Current/Server"]     = res[1]
  end

  return metrics
end

#get_http_compression(snmp = nil) ⇒ Object

HTTP Compression Stats in bits/sec



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/newrelic_f5_plugin/device.rb', line 304

def get_http_compression(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_HTTP_COMPRESSION_STAT_PRECOMPRESS_BYTES,       OID_SYS_HTTP_COMPRESSION_STAT_POSTCOMPRESS_BYTES,
                                     OID_SYS_HTTP_COMPRESSION_STAT_HTML_PRECOMPRESS_BYTES,  OID_SYS_HTTP_COMPRESSION_STAT_HTML_POSTCOMPRESS_BYTES,
                                     OID_SYS_HTTP_COMPRESSION_STAT_CSS_PRECOMPRESS_BYTES,   OID_SYS_HTTP_COMPRESSION_STAT_CSS_POSTCOMPRESS_BYTES,
                                     OID_SYS_HTTP_COMPRESSION_STAT_JS_PRECOMPRESS_BYTES,    OID_SYS_HTTP_COMPRESSION_STAT_JS_POSTCOMPRESS_BYTES,
                                     OID_SYS_HTTP_COMPRESSION_STAT_XML_PRECOMPRESS_BYTES,   OID_SYS_HTTP_COMPRESSION_STAT_XML_POSTCOMPRESS_BYTES,
                                     OID_SYS_HTTP_COMPRESSION_STAT_SGML_PRECOMPRESS_BYTES,  OID_SYS_HTTP_COMPRESSION_STAT_SGML_POSTCOMPRESS_BYTES,
                                     OID_SYS_HTTP_COMPRESSION_STAT_PLAIN_PRECOMPRESS_BYTES, OID_SYS_HTTP_COMPRESSION_STAT_PLAIN_POSTCOMPRESS_BYTES,
                                     OID_SYS_HTTP_COMPRESSION_STAT_OCTET_PRECOMPRESS_BYTES, OID_SYS_HTTP_COMPRESSION_STAT_OCTET_POSTCOMPRESS_BYTES,
                                     OID_SYS_HTTP_COMPRESSION_STAT_IMAGE_PRECOMPRESS_BYTES, OID_SYS_HTTP_COMPRESSION_STAT_IMAGE_POSTCOMPRESS_BYTES,
                                     OID_SYS_HTTP_COMPRESSION_STAT_VIDEO_PRECOMPRESS_BYTES, OID_SYS_HTTP_COMPRESSION_STAT_VIDEO_POSTCOMPRESS_BYTES,
                                     OID_SYS_HTTP_COMPRESSION_STAT_AUDIO_PRECOMPRESS_BYTES, OID_SYS_HTTP_COMPRESSION_STAT_AUDIO_POSTCOMPRESS_BYTES,
                                     OID_SYS_HTTP_COMPRESSION_STAT_OTHER_PRECOMPRESS_BYTES, OID_SYS_HTTP_COMPRESSION_STAT_OTHER_POSTCOMPRESS_BYTES],
                                   snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    vals = bytes_to_bits(res)

    metrics["HTTP/Compression/Total/Pre"]       = vals[0]
    metrics["HTTP/Compression/Total/Post"]      = vals[1]
    metrics["HTTP/Compression/HTML/Pre"]        = vals[2]
    metrics["HTTP/Compression/HTML/Post"]       = vals[3]
    metrics["HTTP/Compression/CSS/Pre"]         = vals[4]
    metrics["HTTP/Compression/CSS/Post"]        = vals[5]
    metrics["HTTP/Compression/Javascript/Pre"]  = vals[6]
    metrics["HTTP/Compression/Javascript/Post"] = vals[7]
    metrics["HTTP/Compression/XML/Pre"]         = vals[8]
    metrics["HTTP/Compression/XML/Post"]        = vals[9]
    metrics["HTTP/Compression/SGML/Pre"]        = vals[10]
    metrics["HTTP/Compression/SGML/Post"]       = vals[11]
    metrics["HTTP/Compression/Plain/Pre"]       = vals[12]
    metrics["HTTP/Compression/Plain/Post"]      = vals[13]
    metrics["HTTP/Compression/Octet/Pre"]       = vals[14]
    metrics["HTTP/Compression/Octet/Post"]      = vals[15]
    metrics["HTTP/Compression/Image/Pre"]       = vals[16]
    metrics["HTTP/Compression/Image/Post"]      = vals[17]
    metrics["HTTP/Compression/Video/Pre"]       = vals[18]
    metrics["HTTP/Compression/Video/Post"]      = vals[19]
    metrics["HTTP/Compression/Audio/Pre"]       = vals[20]
    metrics["HTTP/Compression/Audio/Post"]      = vals[21]
    metrics["HTTP/Compression/Other/Pre"]       = vals[22]
    metrics["HTTP/Compression/Other/Post"]      = vals[23]
  end

  return metrics
end

#get_http_requests(snmp = nil) ⇒ Object

Gather Global HTTP related metrics in req/sec



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/newrelic_f5_plugin/device.rb', line 243

def get_http_requests(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_HTTP_STAT_NUMBER_REQS, OID_SYS_HTTP_STAT_GET_REQS, OID_SYS_HTTP_STAT_POST_REQS,
                                     OID_SYS_HTTP_STAT_V9_REQS,     OID_SYS_HTTP_STAT_V10_REQS, OID_SYS_HTTP_STAT_V11_REQS],
                                   snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    metrics["HTTP/Method/All"]           = res[0]
    metrics["HTTP/Method/Get"]           = res[1]
    metrics["HTTP/Method/Post"]          = res[2]
    metrics["HTTP/Version/v0.9/Request"] = res[3]
    metrics["HTTP/Version/v1.0/Request"] = res[4]
    metrics["HTTP/Version/v1.1/Request"] = res[5]
  end

  return metrics
end

#get_http_responses(snmp = nil) ⇒ Object

Gather Global HTTP related metrics in resp/sec



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/newrelic_f5_plugin/device.rb', line 270

def get_http_responses(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_HTTP_STAT_RESP_2XX_CNT,    OID_SYS_HTTP_STAT_RESP_3XX_CNT,    OID_SYS_HTTP_STAT_RESP_4XX_CNT,
                                     OID_SYS_HTTP_STAT_RESP_5XX_CNT,    OID_SYS_HTTP_STAT_V9_RESP,         OID_SYS_HTTP_STAT_V10_RESP,
                                     OID_SYS_HTTP_STAT_V11_RESP,        OID_SYS_HTTP_STAT_RESP_BUCKET_1K,  OID_SYS_HTTP_STAT_RESP_BUCKET_4K,
                                     OID_SYS_HTTP_STAT_RESP_BUCKET_16K, OID_SYS_HTTP_STAT_RESP_BUCKET_32K],
                                   snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    metrics["HTTP/Response Code/2xx"]        = res[0]
    metrics["HTTP/Response Code/3xx"]        = res[1]
    metrics["HTTP/Response Code/4xx"]        = res[2]
    metrics["HTTP/Response Code/5xx"]        = res[3]
    metrics["HTTP/Version/v0.9/Response"]    = res[4]
    metrics["HTTP/Version/v1.0/Response"]    = res[5]
    metrics["HTTP/Version/v1.1/Response"]    = res[6]
    metrics["HTTP/Response Size/1k Bucket"]  = res[7]
    metrics["HTTP/Response Size/4k Bucket"]  = res[8]
    metrics["HTTP/Response Size/16k Bucket"] = res[9]
    metrics["HTTP/Response Size/32k Bucket"] = res[10]
  end

  return metrics
end

#get_memory(snmp = nil) ⇒ Object

Gather Memory related metrics and report them in bytes



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/newrelic_f5_plugin/device.rb', line 153

def get_memory(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_STAT_MEMORY_USED], snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    metrics["Memory/TMM"]  = res[0]
  end

  return metrics
end

#get_tcp_connection_rates(snmp = nil) ⇒ Object

Gather TCP Statistics in conn/sec



458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/newrelic_f5_plugin/device.rb', line 458

def get_tcp_connection_rates(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_TCP_STAT_ACCEPTS,  OID_SYS_TCP_STAT_ACCEPTFAILS,
                                     OID_SYS_TCP_STAT_CONNECTS, OID_SYS_TCP_STAT_CONNFAILS,
                                     OID_SYS_TCP_STAT_EXPIRES,  OID_SYS_TCP_STAT_ABANDONS],
                                   snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    metrics["TCP/Accepts"]                 = res[0]
    metrics["TCP/Accept Fails"]            = res[1]
    metrics["TCP/Connections/Established"] = res[2]
    metrics["TCP/Connections/Failed"]      = res[3]
    metrics["TCP/Connections/Expired"]     = res[4]
    metrics["TCP/Connections/Abandoned"]   = res[5]
  end

  return metrics
end

#get_tcp_connections(snmp = nil) ⇒ Object

Gather TCP Statistics in conn



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/newrelic_f5_plugin/device.rb', line 362

def get_tcp_connections(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_TCP_STAT_OPEN, OID_SYS_TCP_STAT_CLOSE_WAIT, OID_SYS_TCP_STAT_FIN_WAIT,
                                     OID_SYS_TCP_STAT_TIME_WAIT],
                                   snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    metrics["TCP/Connection State/Open"]       = res[0]
    metrics["TCP/Connection State/Wait/Close"] = res[1]
    metrics["TCP/Connection State/Wait/FIN"]   = res[2]
    metrics["TCP/Connection State/Wait/TIME"]  = res[3]
  end

  return metrics
end

#get_tcp_error_rates(snmp = nil) ⇒ Object

Gather TCP Error statistics



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/newrelic_f5_plugin/device.rb', line 411

def get_tcp_error_rates(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_TCP_STAT_RXRST, OID_SYS_TCP_STAT_RXBADSUM], snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    metrics["TCP/Errors/Received/Resets"]                = res[0]
    metrics["TCP/Errors/Received/Bad Checksums"]         = res[1]
  end

  return metrics
end

#get_tcp_segment_rates(snmp = nil) ⇒ Object

Gather TCP Segment statistics



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/newrelic_f5_plugin/device.rb', line 387

def get_tcp_segment_rates(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_TCP_STAT_RXBADSEG, OID_SYS_TCP_STAT_RXOOSEG,
                                     OID_SYS_TCP_STAT_TXREXMITS],
                                   snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    metrics["TCP/Segments/Received Malformed"]    = res[0]
    metrics["TCP/Segments/Received Out of Order"] = res[1]
    metrics["TCP/Segments/Retransmitted"]         = res[2]
  end

  return metrics
end

#get_tcp_syn_rates(snmp = nil) ⇒ Object

Gather TCP Syn statistics



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
# File 'lib/newrelic_f5_plugin/device.rb', line 432

def get_tcp_syn_rates(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_TCP_STAT_RXCOOKIE, OID_SYS_TCP_STAT_RXBADCOOKIE,
                                     OID_SYS_TCP_STAT_SYNCACHEOVER, OID_SYS_STAT_HARD_SYNCOOKIE_GEN, OID_SYS_STAT_HARD_SYNCOOKIE_DET],
                                   snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    metrics["TCP/SYN/Received SYN-Cookies"]           = res[0]
    metrics["TCP/SYN/Bad SYN-Cookies"]                = res[1]
    metrics["TCP/SYN/SYN-cache Overflows"]            = res[2]
    metrics["TCP/SYN/Hardware SYN-Cookies Generated"] = res[3]
    metrics["TCP/SYN/Hardware SYN-Cookies Detected"]  = res[4]
  end

  return metrics
end

#get_throughput(snmp = nil) ⇒ Object

Gather Global throughput related metrics and report them in bits/sec



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/newrelic_f5_plugin/device.rb', line 215

def get_throughput(snmp = nil)
  metrics = { }
  snmp    = snmp_manager unless snmp

  if snmp
    res = gather_snmp_metrics_array([OID_SYS_STAT_CLIENT_BYTES_IN, OID_SYS_STAT_CLIENT_BYTES_OUT,
                                     OID_SYS_STAT_SERVER_BYTES_IN, OID_SYS_STAT_SERVER_BYTES_OUT],
                                     snmp)

    # Bail out if we didn't get anything
    return metrics if res.empty?

    metrics["Throughput/Client/In"]  = (res[0].to_f * 8)
    metrics["Throughput/Client/Out"] = (res[1].to_f * 8)
    metrics["Throughput/Server/In"]  = (res[2].to_f * 8)
    metrics["Throughput/Server/Out"] = (res[3].to_f * 8)
    tot = 0
    res.each { |x| tot += x.to_f }
    metrics["Throughput/Total"] = (tot * 8)
  end

  return metrics
end

#poll(agent, snmp) ⇒ Object

Perform polling and reportings of metrics



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/newrelic_f5_plugin/device.rb', line 108

def poll(agent, snmp)
  @snmp_manager = snmp

  system_memory = get_memory
  system_memory.each_key { |m| agent.report_metric m, "bytes", system_memory[m] } unless system_memory.nil?

  system_connections = get_connections
  system_connections.each_key { |m| agent.report_metric m, "conn", system_connections[m] } unless system_connections.nil?

  system_connection_rates = get_connection_rates
  system_connection_rates.each_key { |m| agent.report_counter_metric m, "conn/sec", system_connection_rates[m] } unless system_connection_rates.nil?

  system_throughput = get_throughput
  system_throughput.each_key { |m| agent.report_counter_metric m, "bits/sec", system_throughput[m] } unless system_throughput.nil?

  system_http_reqs = get_http_requests
  system_http_reqs.each_key { |m| agent.report_counter_metric m, "req/sec", system_http_reqs[m] } unless system_http_reqs.nil?

  system_http_resp = get_http_responses
  system_http_resp.each_key { |m| agent.report_counter_metric m, "resp/sec", system_http_resp[m] } unless system_http_resp.nil?

  system_http_compression = get_http_compression
  system_http_compression.each_key { |m| agent.report_counter_metric m, "bits/sec", system_http_compression[m] } unless system_http_compression.nil?

  system_tcp_conns = get_tcp_connections
  system_tcp_conns.each_key { |m| agent.report_metric m, "conn", system_tcp_conns[m] } unless system_tcp_conns.nil?

  system_tcp_conn_rates = get_tcp_connection_rates
  system_tcp_conn_rates.each_key { |m| agent.report_counter_metric m, "conn/sec", system_tcp_conn_rates[m] } unless system_tcp_conn_rates.nil?

  system_tcp_syn_rates = get_tcp_syn_rates
  system_tcp_syn_rates.each_key { |m| agent.report_counter_metric m, "SYN/sec", system_tcp_syn_rates[m] } unless system_tcp_syn_rates.nil?

  system_tcp_segment_rates = get_tcp_segment_rates
  system_tcp_segment_rates.each_key { |m| agent.report_counter_metric m, "segments/sec", system_tcp_segment_rates[m] } unless system_tcp_segment_rates.nil?

  system_tcp_error_rates = get_tcp_error_rates
  system_tcp_error_rates.each_key { |m| agent.report_counter_metric m, "errs/sec", system_tcp_error_rates[m] } unless system_tcp_error_rates.nil?
end