Class: NewRelic::F5Plugin::SnatPools
- Inherits:
-
Object
- Object
- NewRelic::F5Plugin::SnatPools
- Defined in:
- lib/newrelic_f5_plugin/snatpools.rb
Constant Summary collapse
- OID_LTM_SNATS =
"1.3.6.1.4.1.3375.2.2.9"- OID_LTM_SNAT_POOL =
"#{OID_LTM_SNATS}.7"- OID_LTM_SNAT_POOL_ENTRY =
"#{OID_LTM_SNAT_POOL}.2.1"- OID_LTM_SNAT_POOL_STAT =
"#{OID_LTM_SNATS}.8"- OID_LTM_SNAT_POOL_STAT_ENTRY =
"#{OID_LTM_SNAT_POOL_STAT}.3.1"- OID_LTM_SNAT_POOL_STAT_NAME =
"#{OID_LTM_SNAT_POOL_STAT_ENTRY}.1"- OID_LTM_SNAT_POOL_STAT_SERVER_PKTS_IN =
"#{OID_LTM_SNAT_POOL_STAT_ENTRY}.2"- OID_LTM_SNAT_POOL_STAT_SERVER_BYTES_IN =
"#{OID_LTM_SNAT_POOL_STAT_ENTRY}.3"- OID_LTM_SNAT_POOL_STAT_SERVER_PKTS_OUT =
"#{OID_LTM_SNAT_POOL_STAT_ENTRY}.4"- OID_LTM_SNAT_POOL_STAT_SERVER_BYTES_OUT =
"#{OID_LTM_SNAT_POOL_STAT_ENTRY}.5"- OID_LTM_SNAT_POOL_STAT_SERVER_MAX_CONNS =
"#{OID_LTM_SNAT_POOL_STAT_ENTRY}.6"- OID_LTM_SNAT_POOL_STAT_SERVER_TOT_CONNS =
"#{OID_LTM_SNAT_POOL_STAT_ENTRY}.7"- OID_LTM_SNAT_POOL_STAT_SERVER_CUR_CONNS =
"#{OID_LTM_SNAT_POOL_STAT_ENTRY}.8"
Instance Attribute Summary collapse
-
#names ⇒ Object
Returns the value of attribute names.
-
#snmp_manager ⇒ Object
Returns the value of attribute snmp_manager.
Instance Method Summary collapse
-
#get_conns_current(snmp = nil) ⇒ Object
Gather Connection count.
-
#get_conns_max(snmp = nil) ⇒ Object
Gather Max Connection count.
-
#get_conns_total(snmp = nil) ⇒ Object
Gather Connection rate.
-
#get_names(snmp = nil) ⇒ Object
Get the list of Pool names.
-
#get_packets_in(snmp = nil) ⇒ Object
Gather Packets Inbound.
-
#get_packets_out(snmp = nil) ⇒ Object
Gather Packets Outbound.
-
#get_throughput_in(snmp = nil) ⇒ Object
Gather Throughput Inbound (returns in bits).
-
#get_throughput_out(snmp = nil) ⇒ Object
Gather Throughput Inbound (returns in bits).
-
#initialize(snmp = nil) ⇒ SnatPools
constructor
Init.
-
#poll(agent, snmp) ⇒ Object
Perform polling and reportings of metrics.
Constructor Details
#initialize(snmp = nil) ⇒ SnatPools
Init
43 44 45 46 47 48 49 50 51 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 43 def initialize(snmp = nil) @names = [ ] if snmp @snmp_manager = snmp else @snmp_manager = nil end end |
Instance Attribute Details
#names ⇒ Object
Returns the value of attribute names.
20 21 22 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 20 def names @names end |
#snmp_manager ⇒ Object
Returns the value of attribute snmp_manager.
20 21 22 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 20 def snmp_manager @snmp_manager end |
Instance Method Details
#get_conns_current(snmp = nil) ⇒ Object
Gather Connection count
130 131 132 133 134 135 136 137 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 130 def get_conns_current(snmp = nil) snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("SnatPools/Current Connections", @names, OID_LTM_SNAT_POOL_STAT_SERVER_CUR_CONNS, snmp) NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Current Connection metrics") return res end |
#get_conns_max(snmp = nil) ⇒ Object
Gather Max Connection count
116 117 118 119 120 121 122 123 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 116 def get_conns_max(snmp = nil) snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("SnatPools/Max Connections", @names, OID_LTM_SNAT_POOL_STAT_SERVER_MAX_CONNS, snmp) NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Max Connection metrics") return res end |
#get_conns_total(snmp = nil) ⇒ Object
Gather Connection rate
144 145 146 147 148 149 150 151 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 144 def get_conns_total(snmp = nil) snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("SnatPools/Connection Rate", @names, OID_LTM_SNAT_POOL_STAT_SERVER_TOT_CONNS, snmp) NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Connection Rate metrics") return res end |
#get_names(snmp = nil) ⇒ Object
Get the list of Pool names
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 90 def get_names(snmp = nil) snmp = snmp_manager unless snmp if snmp @names.clear begin snmp.walk([OID_LTM_SNAT_POOL_STAT_NAME]) do |row| row.each do |vb| @names.push(vb.value) end end rescue Exception => e NewRelic::PlatformLogger.error("Unable to gather SNAT Pool names with error: #{e}") end NewRelic::PlatformLogger.debug("SNAT Pools: Found #{@names.size} pools") return @names end end |
#get_packets_in(snmp = nil) ⇒ Object
Gather Packets Inbound
188 189 190 191 192 193 194 195 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 188 def get_packets_in(snmp = nil) snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("SnatPools/Packets/In", @names, OID_LTM_SNAT_POOL_STAT_SERVER_PKTS_IN, snmp) NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Inbound packet metrics") return res end |
#get_packets_out(snmp = nil) ⇒ Object
Gather Packets Outbound
202 203 204 205 206 207 208 209 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 202 def get_packets_out(snmp = nil) snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("SnatPools/Packets/Out", @names, OID_LTM_SNAT_POOL_STAT_SERVER_PKTS_OUT, snmp) NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Outbound packet metrics") return res end |
#get_throughput_in(snmp = nil) ⇒ Object
Gather Throughput Inbound (returns in bits)
158 159 160 161 162 163 164 165 166 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 158 def get_throughput_in(snmp = nil) snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("SnatPools/Throughput/In", @names, OID_LTM_SNAT_POOL_STAT_SERVER_BYTES_IN, snmp) res = res.each_key { |n| res[n] *= 8 } NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Inbound Throughput metrics") return res end |
#get_throughput_out(snmp = nil) ⇒ Object
Gather Throughput Inbound (returns in bits)
173 174 175 176 177 178 179 180 181 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 173 def get_throughput_out(snmp = nil) snmp = snmp_manager unless snmp get_names(snmp) if @names.empty? res = gather_snmp_metrics_by_name("SnatPools/Throughput/Out", @names, OID_LTM_SNAT_POOL_STAT_SERVER_BYTES_OUT, snmp) res = res.each_key { |n| res[n] *= 8 } NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Outbound Throughput metrics") return res end |
#poll(agent, snmp) ⇒ Object
Perform polling and reportings of metrics
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/newrelic_f5_plugin/snatpools.rb', line 58 def poll(agent, snmp) @snmp_manager = snmp unless get_names.empty? snatpool_conns_max = get_conns_max snatpool_conns_max.each_key { |m| agent.report_metric m, "conns", snatpool_conns_max[m] } unless snatpool_conns_max.nil? snatpool_conns_current = get_conns_current snatpool_conns_current.each_key { |m| agent.report_metric m, "conns", snatpool_conns_current[m] } unless snatpool_conns_current.nil? snatpool_conns_total = get_conns_total snatpool_conns_total.each_key { |m| agent.report_counter_metric m, "conn/sec", snatpool_conns_total[m] } unless snatpool_conns_total.nil? snatpool_throughput_in = get_throughput_in snatpool_throughput_in.each_key { |m| agent.report_counter_metric m, "bits/sec", snatpool_throughput_in[m] } unless snatpool_throughput_in.nil? snatpool_throughput_out = get_throughput_out snatpool_throughput_out.each_key { |m| agent.report_counter_metric m, "bits/sec", snatpool_throughput_out[m] } unless snatpool_throughput_out.nil? snatpool_packets_in = get_packets_in snatpool_packets_in.each_key { |m| agent.report_counter_metric m, "pkts/sec", snatpool_packets_in[m] } unless snatpool_packets_in.nil? snatpool_packets_out = get_packets_out snatpool_packets_out.each_key { |m| agent.report_counter_metric m, "pkts/sec", snatpool_packets_out[m] } unless snatpool_packets_out.nil? end end |