newrelic_f5_plugin 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES CHANGED
@@ -1,3 +1,11 @@
1
+ * 1.0.9
2
+ - Add SNAT Pools statistics:
3
+ - Current Connections
4
+ - Connections per second
5
+ - Max Connections
6
+ - Throughput (In/Out)
7
+ - Packets per Second (In/Out)
8
+
1
9
  * 1.0.8
2
10
  - Changed the name attribute to agent_name as name wasn't being picked up
3
11
  and we don't want to break systems that might have it set.
data/bin/f5_monitor CHANGED
@@ -5,6 +5,8 @@ require 'optparse'
5
5
 
6
6
  options = OptionParser.new do |opts|
7
7
  opts.banner = <<-EOF
8
+ New Relic F5 Plugin version #{NewRelic::F5Plugin::VERSION}
9
+
8
10
  Usage:
9
11
  f5_monitor ( run | install ) [options]
10
12
  EOF
@@ -26,7 +28,6 @@ EOF
26
28
  end
27
29
 
28
30
  opts.on("-h", "--help") do
29
- puts "New Relic F5 Plugin version #{NewRelic::F5Plugin::VERSION}"
30
31
  puts opts
31
32
  if File.basename($0) == File.basename(__FILE__)
32
33
  exit 0
@@ -4,7 +4,7 @@ require 'newrelic_plugin'
4
4
  require 'snmp'
5
5
 
6
6
  module NewRelic::F5Plugin
7
- VERSION = '1.0.8'
7
+ VERSION = '1.0.9'
8
8
 
9
9
  # Register and run the agent
10
10
  def self.run
@@ -146,6 +146,33 @@ module NewRelic::F5Plugin
146
146
  pool_throughput_out = pool.get_throughput_out
147
147
  pool_throughput_out.each_key { |m| report_counter_metric m, "bits/sec", pool_throughput_out[m] } unless pool_throughput_out.nil?
148
148
 
149
+ #
150
+ # Collect snat pool statistics
151
+ #
152
+ NewRelic::PlatformLogger.debug("Collecting SNAT Pool stats")
153
+ snatpool = NewRelic::F5Plugin::SnatPools.new snmp
154
+
155
+ snatpool_conns_max = snatpool.get_conns_max
156
+ snatpool_conns_max.each_key { |m| report_metric m, "conns", snatpool_conns_max[m] } unless snatpool_conns_max.nil?
157
+
158
+ snatpool_conns_current = snatpool.get_conns_current
159
+ snatpool_conns_current.each_key { |m| report_metric m, "conns", snatpool_conns_current[m] } unless snatpool_conns_current.nil?
160
+
161
+ snatpool_conns_total = snatpool.get_conns_total
162
+ snatpool_conns_total.each_key { |m| report_counter_metric m, "conn/sec", snatpool_conns_total[m] } unless snatpool_conns_total.nil?
163
+
164
+ snatpool_throughput_in = snatpool.get_throughput_in
165
+ snatpool_throughput_in.each_key { |m| report_counter_metric m, "bits/sec", snatpool_throughput_in[m] } unless snatpool_throughput_in.nil?
166
+
167
+ snatpool_throughput_out = snatpool.get_throughput_out
168
+ snatpool_throughput_out.each_key { |m| report_counter_metric m, "bits/sec", snatpool_throughput_out[m] } unless snatpool_throughput_out.nil?
169
+
170
+ snatpool_packets_in = snatpool.get_packets_in
171
+ snatpool_packets_in.each_key { |m| report_counter_metric m, "pkts/sec", snatpool_packets_in[m] } unless snatpool_packets_in.nil?
172
+
173
+ snatpool_packets_out = snatpool.get_packets_out
174
+ snatpool_packets_out.each_key { |m| report_counter_metric m, "pkts/sec", snatpool_packets_out[m] } unless snatpool_packets_out.nil?
175
+
149
176
  #
150
177
  # Cleanup snmp connection
151
178
  #
@@ -0,0 +1,182 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'newrelic_plugin'
4
+
5
+ #LtmSnatPoolStatEntry
6
+ # ltmSnatPoolStatName LongDisplayString,
7
+ # ltmSnatPoolStatServerPktsIn Counter64,
8
+ # ltmSnatPoolStatServerBytesIn Counter64,
9
+ # ltmSnatPoolStatServerPktsOut Counter64,
10
+ # ltmSnatPoolStatServerBytesOut Counter64,
11
+ # ltmSnatPoolStatServerMaxConns Counter64,
12
+ # ltmSnatPoolStatServerTotConns Counter64,
13
+ # ltmSnatPoolStatServerCurConns CounterBasedGauge64
14
+
15
+
16
+ module NewRelic
17
+ module F5Plugin
18
+
19
+ class SnatPools
20
+ attr_accessor :names, :snmp_manager
21
+
22
+ OID_LTM_SNATS = "1.3.6.1.4.1.3375.2.2.9"
23
+ OID_LTM_SNAT_POOL = "#{OID_LTM_SNATS}.7"
24
+ OID_LTM_SNAT_POOL_ENTRY = "#{OID_LTM_SNAT_POOL}.2.1"
25
+
26
+ OID_LTM_SNAT_POOL_STAT = "#{OID_LTM_SNATS}.8"
27
+ OID_LTM_SNAT_POOL_STAT_ENTRY = "#{OID_LTM_SNAT_POOL_STAT}.3.1"
28
+
29
+ OID_LTM_SNAT_POOL_STAT_NAME = "#{OID_LTM_SNAT_POOL_STAT_ENTRY}.1"
30
+ OID_LTM_SNAT_POOL_STAT_SERVER_PKTS_IN = "#{OID_LTM_SNAT_POOL_STAT_ENTRY}.2"
31
+ OID_LTM_SNAT_POOL_STAT_SERVER_BYTES_IN = "#{OID_LTM_SNAT_POOL_STAT_ENTRY}.3"
32
+ OID_LTM_SNAT_POOL_STAT_SERVER_PKTS_OUT = "#{OID_LTM_SNAT_POOL_STAT_ENTRY}.4"
33
+ OID_LTM_SNAT_POOL_STAT_SERVER_BYTES_OUT = "#{OID_LTM_SNAT_POOL_STAT_ENTRY}.5"
34
+ OID_LTM_SNAT_POOL_STAT_SERVER_MAX_CONNS = "#{OID_LTM_SNAT_POOL_STAT_ENTRY}.6"
35
+ OID_LTM_SNAT_POOL_STAT_SERVER_TOT_CONNS = "#{OID_LTM_SNAT_POOL_STAT_ENTRY}.7"
36
+ OID_LTM_SNAT_POOL_STAT_SERVER_CUR_CONNS = "#{OID_LTM_SNAT_POOL_STAT_ENTRY}.8"
37
+
38
+
39
+
40
+ #
41
+ # Init
42
+ #
43
+ def initialize(snmp = nil)
44
+ @names = [ ]
45
+
46
+ if snmp
47
+ @snmp_manager = snmp
48
+ else
49
+ @snmp_manager = nil
50
+ end
51
+ end
52
+
53
+
54
+
55
+ #
56
+ # Get the list of Pool names
57
+ #
58
+ def get_names(snmp = nil)
59
+ snmp = snmp_manager unless snmp
60
+
61
+ if snmp
62
+ @names.clear
63
+
64
+ begin
65
+ snmp.walk([OID_LTM_SNAT_POOL_STAT_NAME]) do |row|
66
+ row.each do |vb|
67
+ @names.push(vb.value)
68
+ end
69
+ end
70
+ rescue Exception => e
71
+ NewRelic::PlatformLogger.error("Unable to gather SNAT Pool names with error: #{e}")
72
+ end
73
+
74
+ NewRelic::PlatformLogger.debug("SNAT Pools: Found #{@names.size} pools")
75
+ return @names
76
+ end
77
+ end
78
+
79
+
80
+
81
+ #
82
+ # Gather Max Connection count
83
+ #
84
+ def get_conns_max(snmp = nil)
85
+ snmp = snmp_manager unless snmp
86
+
87
+ get_names(snmp) if @names.empty?
88
+ res = gather_snmp_metrics_by_name("SnatPools/Max Connections", @names, OID_LTM_SNAT_POOL_STAT_SERVER_MAX_CONNS, snmp)
89
+ NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Max Connection metrics")
90
+ return res
91
+ end
92
+
93
+
94
+
95
+ #
96
+ # Gather Connection count
97
+ #
98
+ def get_conns_current(snmp = nil)
99
+ snmp = snmp_manager unless snmp
100
+
101
+ get_names(snmp) if @names.empty?
102
+ res = gather_snmp_metrics_by_name("SnatPools/Current Connections", @names, OID_LTM_SNAT_POOL_STAT_SERVER_CUR_CONNS, snmp)
103
+ NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Current Connection metrics")
104
+ return res
105
+ end
106
+
107
+
108
+
109
+ #
110
+ # Gather Connection rate
111
+ #
112
+ def get_conns_total(snmp = nil)
113
+ snmp = snmp_manager unless snmp
114
+
115
+ get_names(snmp) if @names.empty?
116
+ res = gather_snmp_metrics_by_name("SnatPools/Connection Rate", @names, OID_LTM_SNAT_POOL_STAT_SERVER_TOT_CONNS, snmp)
117
+ NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Connection Rate metrics")
118
+ return res
119
+ end
120
+
121
+
122
+
123
+ #
124
+ # Gather Throughput Inbound (returns in bits)
125
+ #
126
+ def get_throughput_in(snmp = nil)
127
+ snmp = snmp_manager unless snmp
128
+
129
+ get_names(snmp) if @names.empty?
130
+ res = gather_snmp_metrics_by_name("SnatPools/Throughput/In", @names, OID_LTM_SNAT_POOL_STAT_SERVER_BYTES_IN, snmp)
131
+ res = res.each_key { |n| res[n] *= 8 }
132
+ NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Inbound Throughput metrics")
133
+ return res
134
+ end
135
+
136
+
137
+
138
+ #
139
+ # Gather Throughput Inbound (returns in bits)
140
+ #
141
+ def get_throughput_out(snmp = nil)
142
+ snmp = snmp_manager unless snmp
143
+
144
+ get_names(snmp) if @names.empty?
145
+ res = gather_snmp_metrics_by_name("SnatPools/Throughput/Out", @names, OID_LTM_SNAT_POOL_STAT_SERVER_BYTES_OUT, snmp)
146
+ res = res.each_key { |n| res[n] *= 8 }
147
+ NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Outbound Throughput metrics")
148
+ return res
149
+ end
150
+
151
+
152
+
153
+ #
154
+ # Gather Packets Inbound
155
+ #
156
+ def get_packets_in(snmp = nil)
157
+ snmp = snmp_manager unless snmp
158
+
159
+ get_names(snmp) if @names.empty?
160
+ res = gather_snmp_metrics_by_name("SnatPools/Packets/In", @names, OID_LTM_SNAT_POOL_STAT_SERVER_PKTS_IN, snmp)
161
+ NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Inbound packet metrics")
162
+ return res
163
+ end
164
+
165
+
166
+
167
+ #
168
+ # Gather Packets Outbound
169
+ #
170
+ def get_packets_out(snmp = nil)
171
+ snmp = snmp_manager unless snmp
172
+
173
+ get_names(snmp) if @names.empty?
174
+ res = gather_snmp_metrics_by_name("SnatPools/Packets/Out", @names, OID_LTM_SNAT_POOL_STAT_SERVER_PKTS_OUT, snmp)
175
+ NewRelic::PlatformLogger.debug("SNAT Pools: Got #{res.size}/#{@names.size} Outbound packet metrics")
176
+ return res
177
+ end
178
+
179
+ end
180
+ end
181
+ end
182
+
@@ -3,6 +3,7 @@ require 'newrelic_f5_plugin/util'
3
3
  require 'newrelic_f5_plugin/device'
4
4
  require 'newrelic_f5_plugin/nodes'
5
5
  require 'newrelic_f5_plugin/pools'
6
+ require 'newrelic_f5_plugin/snatpools'
6
7
  require 'newrelic_f5_plugin/virtuals'
7
8
  require 'newrelic_f5_plugin/agent'
8
9
 
@@ -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.8'
17
- s.date = '2013-12-31'
16
+ s.version = '1.0.9'
17
+ s.date = '2014-01-21'
18
18
  s.rubyforge_project = 'newrelic_f5_plugin'
19
19
 
20
20
  ## Make sure your summary is short. The description may be as long
@@ -78,6 +78,7 @@ to find out how to install and run the plugin agent.
78
78
  lib/newrelic_f5_plugin/device.rb
79
79
  lib/newrelic_f5_plugin/nodes.rb
80
80
  lib/newrelic_f5_plugin/pools.rb
81
+ lib/newrelic_f5_plugin/snatpools.rb
81
82
  lib/newrelic_f5_plugin/util.rb
82
83
  lib/newrelic_f5_plugin/virtuals.rb
83
84
  newrelic_f5_plugin.gemspec
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.8
4
+ version: 1.0.9
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-12-31 00:00:00.000000000 Z
12
+ date: 2014-01-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: newrelic_plugin
@@ -69,6 +69,7 @@ files:
69
69
  - lib/newrelic_f5_plugin/device.rb
70
70
  - lib/newrelic_f5_plugin/nodes.rb
71
71
  - lib/newrelic_f5_plugin/pools.rb
72
+ - lib/newrelic_f5_plugin/snatpools.rb
72
73
  - lib/newrelic_f5_plugin/util.rb
73
74
  - lib/newrelic_f5_plugin/virtuals.rb
74
75
  - newrelic_f5_plugin.gemspec