class NewRelic::F5Plugin::Pools
Constants
- MAX_RESULTS
- OID_LTM_POOLS
- OID_LTM_POOL_ENTRY
- OID_LTM_POOL_STAT
- OID_LTM_POOL_STAT_NAME
- OID_LTM_POOL_STAT_SERVER_BYTES_IN
- OID_LTM_POOL_STAT_SERVER_BYTES_OUT
- OID_LTM_POOL_STAT_SERVER_CUR_CONNS
- OID_LTM_POOL_STAT_SERVER_PKTS_IN
- OID_LTM_POOL_STAT_SERVER_PKTS_OUT
- OID_LTM_POOL_STAT_SERVER_TOT_CONNS
- OID_LTM_POOL_STAT_TOT_REQUESTS
Attributes
names[RW]
snmp_manager[RW]
Public Class Methods
new(snmp = nil)
click to toggle source
Init
# File lib/newrelic_f5_plugin/pools.rb, line 63 def initialize(snmp = nil) @names = [ ] @f5_agent = nil if snmp @snmp_manager = snmp else @snmp_manager = nil end end
Public Instance Methods
get_conns_current(snmp = nil)
click to toggle source
Gather Connection count
# File lib/newrelic_f5_plugin/pools.rb, line 153 def get_conns_current(snmp = nil) snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("Pools/Current Connections", @names, OID_LTM_POOL_STAT_SERVER_CUR_CONNS, snmp) NewRelic::PlatformLogger.debug("Pools: Got #{res.size}/#{@names.size} Current Connection metrics") unless res.nil? sorted_report = res.sort_by { |k,v| v }.reverse sorted_report.each_with_index do |row, index| @f5_agent.report_metric row[0], "conns", row[1] break if index >= (MAX_RESULTS - 1) end end end
get_conns_total(snmp = nil)
click to toggle source
Gather Connection rate
# File lib/newrelic_f5_plugin/pools.rb, line 174 def get_conns_total(snmp = nil) @conn_rate ||= { } report = { } snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("Pools/Connection Rate", @names, OID_LTM_POOL_STAT_SERVER_TOT_CONNS, snmp) NewRelic::PlatformLogger.debug("Pools: Got #{res.size}/#{@names.size} Connection Rate metrics") unless res.nil? res.each_key do |metric| @conn_rate[metric] ||= NewRelic::Processor::EpochCounter.new report[metric] = @conn_rate[metric].process(res[metric]) end sorted_report = report.sort_by { |k,v| v }.reverse sorted_report.each_with_index do |row, index| @f5_agent.report_metric row[0], "conn/sec", row[1] break if index >= (MAX_RESULTS - 1) end end end
get_names(snmp = nil)
click to toggle source
Get the list of Pool names
# File lib/newrelic_f5_plugin/pools.rb, line 99 def get_names(snmp = nil) snmp = snmp_manager unless snmp if snmp @names.clear begin snmp.walk([OID_LTM_POOL_STAT_NAME]) do |row| row.each do |vb| @names.push(vb.value) end end rescue Exception => e NewRelic::PlatformLogger.error("Unable to gather Pool names with error: #{e}") end NewRelic::PlatformLogger.debug("Pools: Found #{@names.size} pools, reporting the top #{MAX_RESULTS} (max)") return @names end end
get_packets_in(snmp = nil)
click to toggle source
Gather Packets Inbound
# File lib/newrelic_f5_plugin/pools.rb, line 202 def get_packets_in(snmp = nil) @packet_in_rate ||= { } report = { } snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("Pools/Packets/In", @names, OID_LTM_POOL_STAT_SERVER_PKTS_IN, snmp) NewRelic::PlatformLogger.debug("Pools: Got #{res.size}/#{@names.size} Inbound Packet metrics") unless res.nil? res.each_key do |metric| @packet_in_rate[metric] ||= NewRelic::Processor::EpochCounter.new report[metric] = @packet_in_rate[metric].process(res[metric] * 8) end sorted_report = report.sort_by { |k,v| v }.reverse sorted_report.each_with_index do |row, index| @f5_agent.report_metric row[0], "packets/sec", row[1] break if index >= (MAX_RESULTS - 1) end end end
get_packets_out(snmp = nil)
click to toggle source
Gather Packets Outbound
# File lib/newrelic_f5_plugin/pools.rb, line 230 def get_packets_out(snmp = nil) @packet_out_rate ||= { } report = { } snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("Pools/Packets/Out", @names, OID_LTM_POOL_STAT_SERVER_PKTS_OUT, snmp) NewRelic::PlatformLogger.debug("Pools: Got #{res.size}/#{@names.size} Outbound Packet metrics") unless res.nil? res.each_key do |metric| @packet_out_rate[metric] ||= NewRelic::Processor::EpochCounter.new report[metric] = @packet_out_rate[metric].process(res[metric] * 8) end sorted_report = report.sort_by { |k,v| v }.reverse sorted_report.each_with_index do |row, index| @f5_agent.report_metric row[0], "packets/sec", row[1] break if index >= (MAX_RESULTS - 1) end end end
get_requests(snmp = nil)
click to toggle source
Gather Total Requests
# File lib/newrelic_f5_plugin/pools.rb, line 125 def get_requests(snmp = nil) @req_rate ||= { } report = { } snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("Pools/Requests", @names, OID_LTM_POOL_STAT_TOT_REQUESTS, snmp) NewRelic::PlatformLogger.debug("Pools: Got #{res.size}/#{@names.size} Request metrics") unless res.nil? res.each_key do |metric| @req_rate[metric] ||= NewRelic::Processor::EpochCounter.new report[metric] = @req_rate[metric].process(res[metric]) end sorted_report = report.sort_by { |k,v| v }.reverse sorted_report.each_with_index do |row, index| @f5_agent.report_metric row[0], "req/sec", row[1] break if index >= (MAX_RESULTS - 1) end end end
get_throughput_in(snmp = nil)
click to toggle source
Gather Throughput Inbound (returns in bits)
# File lib/newrelic_f5_plugin/pools.rb, line 258 def get_throughput_in(snmp = nil) @throughput_in_rate ||= { } report = { } snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("Pools/Throughput/In", @names, OID_LTM_POOL_STAT_SERVER_BYTES_IN, snmp) NewRelic::PlatformLogger.debug("Pools: Got #{res.size}/#{@names.size} Inbound Throughput metrics") unless res.nil? res.each_key do |metric| @throughput_in_rate[metric] ||= NewRelic::Processor::EpochCounter.new report[metric] = @throughput_in_rate[metric].process(res[metric] * 8) end sorted_report = report.sort_by { |k,v| v }.reverse sorted_report.each_with_index do |row, index| @f5_agent.report_metric row[0], "bits/sec", row[1] break if index >= (MAX_RESULTS - 1) end end end
get_throughput_out(snmp = nil)
click to toggle source
Gather Throughput Outbound (returns in bits)
# File lib/newrelic_f5_plugin/pools.rb, line 286 def get_throughput_out(snmp = nil) @throughput_out_rate ||= { } report = { } snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("Pools/Throughput/Out", @names, OID_LTM_POOL_STAT_SERVER_BYTES_OUT, snmp) NewRelic::PlatformLogger.debug("Pools: Got #{res.size}/#{@names.size} Outbound Throughput metrics") unless res.nil? res.each_key do |metric| @throughput_out_rate[metric] ||= NewRelic::Processor::EpochCounter.new report[metric] = @throughput_out_rate[metric].process(res[metric] * 8) end sorted_report = report.sort_by { |k,v| v }.reverse sorted_report.each_with_index do |row, index| @f5_agent.report_metric row[0], "bits/sec", row[1] break if index >= (MAX_RESULTS - 1) end end end
poll(agent, snmp)
click to toggle source
Perform polling and reportings of metrics
# File lib/newrelic_f5_plugin/pools.rb, line 79 def poll(agent, snmp) @snmp_manager = snmp @f5_agent = agent unless get_names.empty? get_requests get_conns_current get_conns_total get_packets_in get_packets_out get_throughput_in get_throughput_out end end