class NewRelic::F5Plugin::Device

Constants

OID_SYS_GLOBAL_STAT
OID_SYS_HTTP_COMPRESSION_STAT

Create the OIDs if they do not exist

OID_SYS_HTTP_COMPRESSION_STAT_AUDIO_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_AUDIO_PRECOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_CSS_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_CSS_PRECOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_HTML_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_HTML_PRECOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_IMAGE_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_IMAGE_PRECOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_JS_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_JS_PRECOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_OCTET_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_OCTET_PRECOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_OTHER_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_OTHER_PRECOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_PLAIN_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_PLAIN_PRECOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_PRECOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_SGML_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_SGML_PRECOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_VIDEO_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_VIDEO_PRECOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_XML_POSTCOMPRESS_BYTES
OID_SYS_HTTP_COMPRESSION_STAT_XML_PRECOMPRESS_BYTES
OID_SYS_HTTP_STAT
OID_SYS_HTTP_STAT_GET_REQS
OID_SYS_HTTP_STAT_NUMBER_REQS
OID_SYS_HTTP_STAT_POST_REQS
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_RESP_BUCKET_16K
OID_SYS_HTTP_STAT_RESP_BUCKET_1K
OID_SYS_HTTP_STAT_RESP_BUCKET_32K
OID_SYS_HTTP_STAT_RESP_BUCKET_4K
OID_SYS_HTTP_STAT_V10_REQS
OID_SYS_HTTP_STAT_V10_RESP
OID_SYS_HTTP_STAT_V11_REQS
OID_SYS_HTTP_STAT_V11_RESP
OID_SYS_HTTP_STAT_V9_REQS
OID_SYS_HTTP_STAT_V9_RESP
OID_SYS_STAT
OID_SYS_STAT_CLIENT_BYTES_IN
OID_SYS_STAT_CLIENT_BYTES_OUT
OID_SYS_STAT_CLIENT_CUR_CONNS
OID_SYS_STAT_CLIENT_TOT_CONNS
OID_SYS_STAT_HARD_SYNCOOKIE_DET
OID_SYS_STAT_HARD_SYNCOOKIE_GEN
OID_SYS_STAT_MEMORY_USED
OID_SYS_STAT_PVA_CLIENT_CUR_CONNS
OID_SYS_STAT_PVA_SERVER_CUR_CONNS
OID_SYS_STAT_SERVER_BYTES_IN
OID_SYS_STAT_SERVER_BYTES_OUT
OID_SYS_STAT_SERVER_CUR_CONNS
OID_SYS_STAT_SERVER_TOT_CONNS
OID_SYS_TCP_STAT
OID_SYS_TCP_STAT_ABANDONS
OID_SYS_TCP_STAT_ACCEPTFAILS
OID_SYS_TCP_STAT_ACCEPTS
OID_SYS_TCP_STAT_CLOSE_WAIT
OID_SYS_TCP_STAT_CONNECTS
OID_SYS_TCP_STAT_CONNFAILS
OID_SYS_TCP_STAT_EXPIRES
OID_SYS_TCP_STAT_FIN_WAIT
OID_SYS_TCP_STAT_OPEN
OID_SYS_TCP_STAT_RXBADCOOKIE
OID_SYS_TCP_STAT_RXBADSEG
OID_SYS_TCP_STAT_RXBADSUM
OID_SYS_TCP_STAT_RXCOOKIE
OID_SYS_TCP_STAT_RXOOSEG
OID_SYS_TCP_STAT_RXRST
OID_SYS_TCP_STAT_SYNCACHEOVER
OID_SYS_TCP_STAT_TIME_WAIT
OID_SYS_TCP_STAT_TXREXMITS

Attributes

snmp_manager[RW]

Public Class Methods

new(snmp = nil) click to toggle source

Init

# File lib/newrelic_f5_plugin/device.rb, line 95
def initialize(snmp = nil)
  if snmp
    @snmp_manager = snmp
  else
    @snmp_manager = nil
  end
end

Public Instance Methods

get_connection_rates(snmp = nil) click to toggle source

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

# 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) click to toggle source

Gather Global connection related metrics and report them in conn

# 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) click to toggle source

HTTP Compression Stats in bits/sec

# 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) click to toggle source

Gather Global HTTP related metrics in req/sec

# 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) click to toggle source

Gather Global HTTP related metrics in resp/sec

# 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) click to toggle source

Gather Memory related metrics and report them in bytes

# 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) click to toggle source

Gather TCP Statistics in conn/sec

# 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) click to toggle source

Gather TCP Statistics in conn

# 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) click to toggle source

Gather TCP Error statistics

# 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) click to toggle source

Gather TCP Segment statistics

# 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) click to toggle source

Gather TCP Syn statistics

# 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) click to toggle source

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

# 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) click to toggle source

Perform polling and reportings of metrics

# 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