newrelic_f5_plugin 1.0.12 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +14 -0
- data/README.rdoc +15 -0
- data/lib/newrelic_f5_plugin/agent.rb +16 -188
- data/lib/newrelic_f5_plugin/client_ssl.rb +42 -0
- data/lib/newrelic_f5_plugin/device.rb +136 -3
- data/lib/newrelic_f5_plugin/nodes.rb +14 -1
- data/lib/newrelic_f5_plugin/pools.rb +147 -38
- data/lib/newrelic_f5_plugin/rules.rb +40 -18
- data/lib/newrelic_f5_plugin/snatpools.rb +32 -0
- data/lib/newrelic_f5_plugin/virtuals.rb +169 -53
- data/newrelic_f5_plugin.gemspec +5 -4
- metadata +29 -27
@@ -42,10 +42,10 @@ module NewRelic
|
|
42
42
|
module F5Plugin
|
43
43
|
|
44
44
|
class Virtuals
|
45
|
-
attr_accessor :
|
46
|
-
|
47
|
-
OID_LTM_VIRTUAL_SERVERS = "1.3.6.1.4.1.3375.2.2.10"
|
45
|
+
attr_accessor :names, :snmp_manager
|
48
46
|
|
47
|
+
MAX_RESULTS = 150
|
48
|
+
OID_LTM_VIRTUAL_SERVERS = "1.3.6.1.4.1.3375.2.2.10"
|
49
49
|
OID_LTM_VIRTUAL_SERV_STAT = "#{OID_LTM_VIRTUAL_SERVERS}.2"
|
50
50
|
OID_LTM_VIRTUAL_SERV_ENTRY = "#{OID_LTM_VIRTUAL_SERV_STAT}.3.1"
|
51
51
|
OID_LTM_VIRTUAL_SERV_STAT_NAME = "#{OID_LTM_VIRTUAL_SERV_ENTRY}.1"
|
@@ -64,7 +64,8 @@ module NewRelic
|
|
64
64
|
# Init
|
65
65
|
#
|
66
66
|
def initialize(snmp = nil)
|
67
|
-
@
|
67
|
+
@names = [ ]
|
68
|
+
@f5_agent = nil
|
68
69
|
|
69
70
|
if snmp
|
70
71
|
@snmp_manager = snmp
|
@@ -75,27 +76,48 @@ module NewRelic
|
|
75
76
|
|
76
77
|
|
77
78
|
|
79
|
+
#
|
80
|
+
# Perform polling and reportings of metrics
|
81
|
+
#
|
82
|
+
def poll(agent, snmp)
|
83
|
+
@snmp_manager = snmp
|
84
|
+
@f5_agent = agent
|
85
|
+
|
86
|
+
unless get_names.empty?
|
87
|
+
get_requests
|
88
|
+
get_conns_current
|
89
|
+
get_conns_total
|
90
|
+
get_packets_in
|
91
|
+
get_packets_out
|
92
|
+
get_throughput_in
|
93
|
+
get_throughput_out
|
94
|
+
get_cpu_usage_1m
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
|
78
100
|
#
|
79
101
|
# Get the list of Virtual Server names
|
80
102
|
#
|
81
103
|
def get_names(snmp = nil)
|
82
|
-
snmp = snmp_manager unless snmp
|
104
|
+
snmp = @snmp_manager unless snmp
|
83
105
|
|
84
106
|
if snmp
|
85
|
-
@
|
107
|
+
@names.clear
|
86
108
|
|
87
109
|
begin
|
88
110
|
snmp.walk([OID_LTM_VIRTUAL_SERV_STAT_NAME]) do |row|
|
89
111
|
row.each do |vb|
|
90
|
-
@
|
112
|
+
@names.push(vb.value)
|
91
113
|
end
|
92
114
|
end
|
93
115
|
rescue Exception => e
|
94
116
|
NewRelic::PlatformLogger.error("Unable to gather Virtual Server names with error: #{e}")
|
95
117
|
end
|
96
118
|
|
97
|
-
NewRelic::PlatformLogger.debug("Virtual Servers: Found #{@
|
98
|
-
return @
|
119
|
+
NewRelic::PlatformLogger.debug("Virtual Servers: Found #{@names.size} virtual servers, reporting the top #{MAX_RESULTS} (max)")
|
120
|
+
return @names
|
99
121
|
end
|
100
122
|
end
|
101
123
|
|
@@ -105,12 +127,26 @@ module NewRelic
|
|
105
127
|
# Gather VS Total Requests
|
106
128
|
#
|
107
129
|
def get_requests(snmp = nil)
|
108
|
-
|
130
|
+
@req_rate ||= { }
|
131
|
+
report = { }
|
132
|
+
snmp = @snmp_manager unless snmp
|
133
|
+
|
134
|
+
get_names(snmp) if @names.empty?
|
135
|
+
res = gather_snmp_metrics_by_name("Virtual Servers/Requests", @names, OID_LTM_VIRTUAL_SERV_STAT_TOT_REQUESTS, snmp)
|
136
|
+
NewRelic::PlatformLogger.debug("Virtual Servers: Got #{res.size}/#{@names.size} Request metrics")
|
137
|
+
|
138
|
+
unless res.nil?
|
139
|
+
res.each_key do |metric|
|
140
|
+
@req_rate[metric] ||= NewRelic::Processor::EpochCounter.new
|
141
|
+
report[metric] = @req_rate[metric].process(res[metric])
|
142
|
+
end
|
109
143
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
144
|
+
sorted_report = report.sort_by { |k,v| v }.reverse
|
145
|
+
sorted_report.each_with_index do |row, index|
|
146
|
+
@f5_agent.report_metric row[0], "req/sec", row[1]
|
147
|
+
break if index >= (MAX_RESULTS - 1)
|
148
|
+
end
|
149
|
+
end
|
114
150
|
end
|
115
151
|
|
116
152
|
|
@@ -119,12 +155,19 @@ module NewRelic
|
|
119
155
|
# Gather VS Connection count
|
120
156
|
#
|
121
157
|
def get_conns_current(snmp = nil)
|
122
|
-
snmp = snmp_manager unless snmp
|
158
|
+
snmp = @snmp_manager unless snmp
|
159
|
+
|
160
|
+
get_names(snmp) if @names.empty?
|
161
|
+
res = gather_snmp_metrics_by_name("Virtual Servers/Current Connections", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_CUR_CONNS, snmp)
|
162
|
+
NewRelic::PlatformLogger.debug("Virtual Servers: Got #{res.size}/#{@names.size} Current Connection metrics")
|
123
163
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
164
|
+
unless res.nil?
|
165
|
+
sorted_report = res.sort_by { |k,v| v }.reverse
|
166
|
+
sorted_report.each_with_index do |row, index|
|
167
|
+
@f5_agent.report_metric row[0], "conns", row[1]
|
168
|
+
break if index >= (MAX_RESULTS - 1)
|
169
|
+
end
|
170
|
+
end
|
128
171
|
end
|
129
172
|
|
130
173
|
|
@@ -133,12 +176,26 @@ module NewRelic
|
|
133
176
|
# Gather VS Connection rate
|
134
177
|
#
|
135
178
|
def get_conns_total(snmp = nil)
|
136
|
-
|
179
|
+
@conn_rate ||= { }
|
180
|
+
report = { }
|
181
|
+
snmp = @snmp_manager unless snmp
|
182
|
+
|
183
|
+
get_names(snmp) if @names.empty?
|
184
|
+
res = gather_snmp_metrics_by_name("Virtual Servers/Connection Rate", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_TOT_CONNS, snmp)
|
185
|
+
NewRelic::PlatformLogger.debug("Virtual Servers: Got #{res.size}/#{@names.size} Connection Rate metrics")
|
186
|
+
|
187
|
+
unless res.nil?
|
188
|
+
res.each_key do |metric|
|
189
|
+
@conn_rate[metric] ||= NewRelic::Processor::EpochCounter.new
|
190
|
+
report[metric] = @conn_rate[metric].process(res[metric])
|
191
|
+
end
|
137
192
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
193
|
+
sorted_report = report.sort_by { |k,v| v }.reverse
|
194
|
+
sorted_report.each_with_index do |row, index|
|
195
|
+
@f5_agent.report_metric row[0], "conn/sec", row[1]
|
196
|
+
break if index >= (MAX_RESULTS - 1)
|
197
|
+
end
|
198
|
+
end
|
142
199
|
end
|
143
200
|
|
144
201
|
|
@@ -147,13 +204,26 @@ module NewRelic
|
|
147
204
|
# Gather VS Packets Inbound
|
148
205
|
#
|
149
206
|
def get_packets_in (snmp = nil)
|
150
|
-
|
207
|
+
@packet_in_rate ||= { }
|
208
|
+
report = { }
|
209
|
+
snmp = @snmp_manager unless snmp
|
210
|
+
|
211
|
+
get_names(snmp) if @names.empty?
|
212
|
+
res = gather_snmp_metrics_by_name("Virtual Servers/Packets/In", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_PKTS_IN, snmp)
|
213
|
+
NewRelic::PlatformLogger.debug("Virtual Servers: Got #{res.size}/#{@names.size} Inbound Packet metrics")
|
214
|
+
|
215
|
+
unless res.nil?
|
216
|
+
res.each_key do |metric|
|
217
|
+
@packet_in_rate[metric] ||= NewRelic::Processor::EpochCounter.new
|
218
|
+
report[metric] = @packet_in_rate[metric].process(res[metric] * 8)
|
219
|
+
end
|
151
220
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
221
|
+
sorted_report = report.sort_by { |k,v| v }.reverse
|
222
|
+
sorted_report.each_with_index do |row, index|
|
223
|
+
@f5_agent.report_metric row[0], "packets/sec", row[1]
|
224
|
+
break if index >= (MAX_RESULTS - 1)
|
225
|
+
end
|
226
|
+
end
|
157
227
|
end
|
158
228
|
|
159
229
|
|
@@ -162,13 +232,26 @@ module NewRelic
|
|
162
232
|
# Gather VS Packets Outbound
|
163
233
|
#
|
164
234
|
def get_packets_out(snmp = nil)
|
165
|
-
|
235
|
+
@packet_out_rate ||= { }
|
236
|
+
report = { }
|
237
|
+
snmp = @snmp_manager unless snmp
|
238
|
+
|
239
|
+
get_names(snmp) if @names.empty?
|
240
|
+
res = gather_snmp_metrics_by_name("Virtual Servers/Packets/Out", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_PKTS_OUT, snmp)
|
241
|
+
NewRelic::PlatformLogger.debug("Virtual Servers: Got #{res.size}/#{@names.size} Outbound Packet metrics")
|
242
|
+
|
243
|
+
unless res.nil?
|
244
|
+
res.each_key do |metric|
|
245
|
+
@packet_out_rate[metric] ||= NewRelic::Processor::EpochCounter.new
|
246
|
+
report[metric] = @packet_out_rate[metric].process(res[metric] * 8)
|
247
|
+
end
|
166
248
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
249
|
+
sorted_report = report.sort_by { |k,v| v }.reverse
|
250
|
+
sorted_report.each_with_index do |row, index|
|
251
|
+
@f5_agent.report_metric row[0], "packets/sec", row[1]
|
252
|
+
break if index >= (MAX_RESULTS - 1)
|
253
|
+
end
|
254
|
+
end
|
172
255
|
end
|
173
256
|
|
174
257
|
|
@@ -177,13 +260,26 @@ module NewRelic
|
|
177
260
|
# Gather VS Throughput Inbound (returns in bits)
|
178
261
|
#
|
179
262
|
def get_throughput_in(snmp = nil)
|
180
|
-
|
263
|
+
@throughput_in_rate ||= { }
|
264
|
+
report = { }
|
265
|
+
snmp = @snmp_manager unless snmp
|
266
|
+
|
267
|
+
get_names(snmp) if @names.empty?
|
268
|
+
res = gather_snmp_metrics_by_name("Virtual Servers/Throughput/In", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_BYTES_IN, snmp)
|
269
|
+
NewRelic::PlatformLogger.debug("Virtual Servers: Got #{res.size}/#{@names.size} Inbound Throughput metrics")
|
270
|
+
|
271
|
+
unless res.nil?
|
272
|
+
res.each_key do |metric|
|
273
|
+
@throughput_in_rate[metric] ||= NewRelic::Processor::EpochCounter.new
|
274
|
+
report[metric] = @throughput_in_rate[metric].process(res[metric] * 8)
|
275
|
+
end
|
181
276
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
277
|
+
sorted_report = report.sort_by { |k,v| v }.reverse
|
278
|
+
sorted_report.each_with_index do |row, index|
|
279
|
+
@f5_agent.report_metric row[0], "bits/sec", row[1]
|
280
|
+
break if index >= (MAX_RESULTS - 1)
|
281
|
+
end
|
282
|
+
end
|
187
283
|
end
|
188
284
|
|
189
285
|
|
@@ -192,13 +288,26 @@ module NewRelic
|
|
192
288
|
# Gather VS Throughput Outbound (returns in bits)
|
193
289
|
#
|
194
290
|
def get_throughput_out(snmp = nil)
|
195
|
-
|
291
|
+
@throughput_out_rate ||= { }
|
292
|
+
report = { }
|
293
|
+
snmp = @snmp_manager unless snmp
|
294
|
+
|
295
|
+
get_names(snmp) if @names.empty?
|
296
|
+
res = gather_snmp_metrics_by_name("Virtual Servers/Throughput/Out", @names, OID_LTM_VIRTUAL_SERV_STAT_CLIENT_BYTES_OUT, snmp)
|
297
|
+
NewRelic::PlatformLogger.debug("Virtual Servers: Got #{res.size}/#{@names.size} Outbound Throughput metrics")
|
298
|
+
|
299
|
+
unless res.nil?
|
300
|
+
res.each_key do |metric|
|
301
|
+
@throughput_out_rate[metric] ||= NewRelic::Processor::EpochCounter.new
|
302
|
+
report[metric] = @throughput_out_rate[metric].process(res[metric] * 8)
|
303
|
+
end
|
196
304
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
305
|
+
sorted_report = report.sort_by { |k,v| v }.reverse
|
306
|
+
sorted_report.each_with_index do |row, index|
|
307
|
+
@f5_agent.report_metric row[0], "bits/sec", row[1]
|
308
|
+
break if index >= (MAX_RESULTS - 1)
|
309
|
+
end
|
310
|
+
end
|
202
311
|
end
|
203
312
|
|
204
313
|
|
@@ -207,12 +316,19 @@ module NewRelic
|
|
207
316
|
# Gather VS Connection rate
|
208
317
|
#
|
209
318
|
def get_cpu_usage_1m(snmp = nil)
|
210
|
-
snmp = snmp_manager unless snmp
|
319
|
+
snmp = @snmp_manager unless snmp
|
320
|
+
|
321
|
+
get_names(snmp) if @names.empty?
|
322
|
+
res = gather_snmp_metrics_by_name("Virtual Servers/CPU Usage/1m", @names, OID_LTM_VIRTUAL_SERV_STAT_VS_USAGE_RATIO_1M, snmp)
|
323
|
+
NewRelic::PlatformLogger.debug("Virtual Servers: Got #{res.size}/#{@names.size} CPU metrics")
|
211
324
|
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
325
|
+
unless res.nil?
|
326
|
+
sorted_report = res.sort_by { |k,v| v }.reverse
|
327
|
+
sorted_report.each_with_index do |row, index|
|
328
|
+
@f5_agent.report_metric row[0], "%", row[1]
|
329
|
+
break if index >= (MAX_RESULTS - 1)
|
330
|
+
end
|
331
|
+
end
|
216
332
|
end
|
217
333
|
|
218
334
|
end
|
data/newrelic_f5_plugin.gemspec
CHANGED
@@ -13,9 +13,10 @@ 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.
|
17
|
-
s.date = '2014-
|
16
|
+
s.version = '1.0.15'
|
17
|
+
s.date = '2014-07-07'
|
18
18
|
s.rubyforge_project = 'newrelic_f5_plugin'
|
19
|
+
s.licenses = ['MIT']
|
19
20
|
|
20
21
|
## Make sure your summary is short. The description may be as long
|
21
22
|
## as you like.
|
@@ -51,8 +52,8 @@ This is the New Relic plugin for monitoring F5 devices developed by New Relic, I
|
|
51
52
|
## The newrelic_plugin needs to be installed. Prior to public release, the
|
52
53
|
# gem needs to be downloaded from git@github.com:newrelic-platform/newrelic_plugin.git
|
53
54
|
# and built using the "rake build" command
|
54
|
-
s.
|
55
|
-
s.
|
55
|
+
s.add_runtime_dependency('newrelic_plugin', '~> 1.3', '>= 1.3.0')
|
56
|
+
s.add_runtime_dependency('snmp', '~> 1.1', '>= 1.1.0')
|
56
57
|
|
57
58
|
s.post_install_message = <<-EOF
|
58
59
|
To get started with this plugin, create a working directory and do
|
metadata
CHANGED
@@ -1,52 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_f5_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.15
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jonathan Thurman
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-
|
11
|
+
date: 2014-07-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: newrelic_plugin
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
- - ">="
|
20
21
|
- !ruby/object:Gem::Version
|
21
22
|
version: 1.3.0
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
25
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
26
|
requirements:
|
27
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.3'
|
30
|
+
- - ">="
|
28
31
|
- !ruby/object:Gem::Version
|
29
32
|
version: 1.3.0
|
30
33
|
- !ruby/object:Gem::Dependency
|
31
34
|
name: snmp
|
32
35
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
36
|
requirements:
|
35
|
-
- -
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.1'
|
40
|
+
- - ">="
|
36
41
|
- !ruby/object:Gem::Version
|
37
42
|
version: 1.1.0
|
38
43
|
type: :runtime
|
39
44
|
prerelease: false
|
40
45
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
46
|
requirements:
|
43
|
-
- -
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.1'
|
50
|
+
- - ">="
|
44
51
|
- !ruby/object:Gem::Version
|
45
52
|
version: 1.1.0
|
46
|
-
description:
|
47
|
-
New Relic, Inc.
|
48
|
-
|
49
|
-
'
|
53
|
+
description: |
|
54
|
+
This is the New Relic plugin for monitoring F5 devices developed by New Relic, Inc.
|
50
55
|
email: support@newrelic.com
|
51
56
|
executables:
|
52
57
|
- f5_monitor
|
@@ -80,33 +85,30 @@ files:
|
|
80
85
|
- test/plugin_test.rb
|
81
86
|
- test/test_helper.rb
|
82
87
|
homepage: http://newrelic.com
|
83
|
-
licenses:
|
84
|
-
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message: "To get started with this plugin, create a working directory
|
85
92
|
and do \n f5_monitor -h\nto find out how to install and run the plugin agent.\n"
|
86
93
|
rdoc_options:
|
87
|
-
- --charset=UTF-8
|
88
|
-
- --main
|
94
|
+
- "--charset=UTF-8"
|
95
|
+
- "--main"
|
89
96
|
- README.rdoc
|
90
97
|
require_paths:
|
91
98
|
- lib
|
92
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
-
none: false
|
94
100
|
requirements:
|
95
|
-
- -
|
101
|
+
- - ">="
|
96
102
|
- !ruby/object:Gem::Version
|
97
103
|
version: '0'
|
98
|
-
segments:
|
99
|
-
- 0
|
100
|
-
hash: -1376077939883300417
|
101
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
-
none: false
|
103
105
|
requirements:
|
104
|
-
- -
|
106
|
+
- - ">="
|
105
107
|
- !ruby/object:Gem::Version
|
106
108
|
version: '0'
|
107
109
|
requirements: []
|
108
110
|
rubyforge_project: newrelic_f5_plugin
|
109
|
-
rubygems_version:
|
111
|
+
rubygems_version: 2.2.2
|
110
112
|
signing_key:
|
111
113
|
specification_version: 2
|
112
114
|
summary: New Relic F5 plugin
|