newrelic_f5_plugin 1.0.0 → 1.0.1
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 +7 -0
- data/Gemfile +6 -6
- data/README.rdoc +14 -9
- data/lib/newrelic_f5_plugin.rb +2 -1
- data/lib/newrelic_f5_plugin/agent.rb +32 -1
- data/lib/newrelic_f5_plugin/virtuals.rb +187 -0
- data/newrelic_f5_plugin.gemspec +3 -2
- metadata +3 -2
data/CHANGES
CHANGED
data/Gemfile
CHANGED
@@ -2,11 +2,11 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# This gemfile is used in the context of development on this plugin agent.
|
4
4
|
|
5
|
-
gem 'newrelic_plugin',
|
6
|
-
gem
|
7
|
-
gem
|
5
|
+
gem 'newrelic_plugin', '>= 0.2.11'
|
6
|
+
gem 'snmp'
|
7
|
+
gem 'rake', '>0.9.2'
|
8
8
|
gem 'test-unit'
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
9
|
+
gem 'shoulda'
|
10
|
+
gem 'mocha'
|
11
|
+
gem 'rdoc', '>2.4.2'
|
12
12
|
|
data/README.rdoc
CHANGED
@@ -30,24 +30,29 @@ A *read-only* SNMP community is required for each device to be monitored. Curren
|
|
30
30
|
SNMP verison 2c is supported.
|
31
31
|
|
32
32
|
|
33
|
-
==
|
33
|
+
== Installation and Running
|
34
34
|
|
35
|
-
1. Install
|
36
|
-
|
37
|
-
|
38
|
-
|
35
|
+
1. Install this gem from RubyGems:
|
36
|
+
|
37
|
+
gem install newrelic_f5_plugin
|
38
|
+
|
39
|
+
2. Create an installation directory (like /opt/newrelic/f5 ).
|
40
|
+
3. In the installation directory, execute
|
39
41
|
|
40
42
|
f5_monitor install -l LICENSE_KEY
|
41
43
|
|
42
44
|
using the license key from your New Relic account.
|
43
|
-
|
44
|
-
|
45
|
+
4. Edit the +config/newrelic_plugin.yml+ file generated in step 4. Setup name/hostname/port/snmp_community for each F5 you wish to monitor.
|
46
|
+
5. Execute
|
45
47
|
|
46
48
|
f5_monitor run
|
47
49
|
|
48
50
|
== Developer Instructions
|
49
51
|
|
50
52
|
1. Fork/Clone the repository
|
51
|
-
2. Install bundler and
|
52
|
-
|
53
|
+
2. Install bundler and run:
|
54
|
+
|
55
|
+
bundle install
|
56
|
+
|
57
|
+
3. Run <b><tt>rake -T</tt></b> to see rake options, including tests.
|
53
58
|
|
data/lib/newrelic_f5_plugin.rb
CHANGED
@@ -28,7 +28,7 @@ module NewRelic::F5Plugin
|
|
28
28
|
# Build: 1.3.6.1.4.1.3375.2.1.4.3.0
|
29
29
|
class Agent < NewRelic::Plugin::Agent::Base
|
30
30
|
agent_guid 'com.newrelic.f5'
|
31
|
-
agent_version '1.0.
|
31
|
+
agent_version '1.0.1' # FIXME This should come from NewRelic::F5Plugin VERSION constant
|
32
32
|
agent_config_options :hostname, :port, :snmp_community
|
33
33
|
agent_human_labels('F5') { "#{hostname}" }
|
34
34
|
|
@@ -60,6 +60,37 @@ module NewRelic::F5Plugin
|
|
60
60
|
report_metric m, node_status[m][:label], node_status[m][:count]
|
61
61
|
}
|
62
62
|
|
63
|
+
#
|
64
|
+
# Collect virtual server statistics
|
65
|
+
#
|
66
|
+
vs = NewRelic::F5Plugin::Virtuals.new snmp
|
67
|
+
virtual_requests = vs.get_requests
|
68
|
+
virtual_requests.each_key { |m|
|
69
|
+
report_counter_metric m, "req/sec", virtual_requests[m]
|
70
|
+
}
|
71
|
+
|
72
|
+
virtual_conns_current = vs.get_conns_current
|
73
|
+
virtual_conns_current.each_key { |m|
|
74
|
+
report_metric m, "conns", virtual_conns_current[m]
|
75
|
+
}
|
76
|
+
|
77
|
+
virtual_conns_total = vs.get_conns_total
|
78
|
+
virtual_conns_total.each_key { |m|
|
79
|
+
report_counter_metric m, "conn/sec", virtual_conns_total[m]
|
80
|
+
}
|
81
|
+
|
82
|
+
virtual_throughput_in = vs.get_throughput_in
|
83
|
+
virtual_throughput_in.each_key { |m|
|
84
|
+
report_counter_metric m, "bits/sec", virtual_throughput_in[m]
|
85
|
+
}
|
86
|
+
|
87
|
+
virtual_throughput_out = vs.get_throughput_out
|
88
|
+
virtual_throughput_out.each_key { |m|
|
89
|
+
report_counter_metric m, "bits/sec", virtual_throughput_out[m]
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
|
63
94
|
snmp.close
|
64
95
|
rescue => e
|
65
96
|
$stderr.puts "#{e}: #{e.backtrace.join("\n ")}"
|
@@ -0,0 +1,187 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'newrelic_plugin'
|
6
|
+
require 'snmp'
|
7
|
+
|
8
|
+
|
9
|
+
module NewRelic
|
10
|
+
module F5Plugin
|
11
|
+
|
12
|
+
class Virtuals
|
13
|
+
attr_accessor :vs_names, :snmp_manager
|
14
|
+
|
15
|
+
OID_LTM_VIRTUAL_SERVERS = "1.3.6.1.4.1.3375.2.2.10"
|
16
|
+
|
17
|
+
OID_LTM_VIRTUAL_SERV_STAT = "#{OID_LTM_VIRTUAL_SERVERS}.2"
|
18
|
+
OID_LTM_VIRTUAL_SERV_ENTRY = "#{OID_LTM_VIRTUAL_SERV_STAT}.3.1"
|
19
|
+
OID_LTM_VIRTUAL_SERV_STAT_NAME = "#{OID_LTM_VIRTUAL_SERV_ENTRY}.1"
|
20
|
+
OID_LTM_VIRTUAL_SERV_STAT_CLIENT_BYTES_IN = "#{OID_LTM_VIRTUAL_SERV_ENTRY}.7"
|
21
|
+
OID_LTM_VIRTUAL_SERV_STAT_CLIENT_BYTES_OUT = "#{OID_LTM_VIRTUAL_SERV_ENTRY}.9"
|
22
|
+
OID_LTM_VIRTUAL_SERV_STAT_CLIENT_TOT_CONNS = "#{OID_LTM_VIRTUAL_SERV_ENTRY}.11"
|
23
|
+
OID_LTM_VIRTUAL_SERV_STAT_CLIENT_CUR_CONNS = "#{OID_LTM_VIRTUAL_SERV_ENTRY}.12"
|
24
|
+
OID_LTM_VIRTUAL_SERV_STAT_TOT_REQUESTS = "#{OID_LTM_VIRTUAL_SERV_ENTRY}.27"
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
#
|
29
|
+
# Init
|
30
|
+
#
|
31
|
+
def initialize(snmp = nil)
|
32
|
+
@vs_names = [ ]
|
33
|
+
|
34
|
+
if snmp
|
35
|
+
@snmp_manager = snmp
|
36
|
+
else
|
37
|
+
@snmp_manager = nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
#
|
44
|
+
# Get the list of Virtual Server names
|
45
|
+
#
|
46
|
+
def get_names(snmp = nil)
|
47
|
+
snmp = snmp_manager unless snmp
|
48
|
+
|
49
|
+
if snmp
|
50
|
+
@vs_names.clear
|
51
|
+
|
52
|
+
snmp.walk([OID_LTM_VIRTUAL_SERV_STAT_NAME]) do |row|
|
53
|
+
row.each do |vb|
|
54
|
+
@vs_names.push(vb.value)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
return @vs_names
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
#
|
65
|
+
# Gather VS Total Requests
|
66
|
+
#
|
67
|
+
def get_requests(snmp = nil)
|
68
|
+
metrics = { }
|
69
|
+
index = 0
|
70
|
+
snmp = snmp_manager unless snmp
|
71
|
+
|
72
|
+
if snmp
|
73
|
+
get_names(snmp) if @vs_names.empty?
|
74
|
+
|
75
|
+
snmp.walk([OID_LTM_VIRTUAL_SERV_STAT_TOT_REQUESTS]) do |row|
|
76
|
+
row.each do |vb|
|
77
|
+
metrics["Virtual Servers/Requests/#{@vs_names[index]}"] = vb.value.to_i
|
78
|
+
index += 1
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
return metrics
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
#
|
89
|
+
# Gather VS Connection count
|
90
|
+
#
|
91
|
+
def get_conns_current(snmp = nil)
|
92
|
+
metrics = { }
|
93
|
+
index = 0
|
94
|
+
snmp = snmp_manager unless snmp
|
95
|
+
|
96
|
+
if snmp
|
97
|
+
get_names(snmp) if @vs_names.empty?
|
98
|
+
|
99
|
+
snmp.walk([OID_LTM_VIRTUAL_SERV_STAT_CLIENT_CUR_CONNS]) do |row|
|
100
|
+
row.each do |vb|
|
101
|
+
metrics["Virtual Servers/Current Connections/#{@vs_names[index]}"] = vb.value.to_i
|
102
|
+
index += 1
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
return metrics
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
#
|
113
|
+
# Gather VS Connection rate
|
114
|
+
#
|
115
|
+
def get_conns_total(snmp = nil)
|
116
|
+
metrics = { }
|
117
|
+
index = 0
|
118
|
+
snmp = snmp_manager unless snmp
|
119
|
+
|
120
|
+
if snmp
|
121
|
+
get_names(snmp) if @vs_names.empty?
|
122
|
+
|
123
|
+
snmp.walk([OID_LTM_VIRTUAL_SERV_STAT_CLIENT_TOT_CONNS]) do |row|
|
124
|
+
row.each do |vb|
|
125
|
+
metrics["Virtual Servers/Connection Rate/#{@vs_names[index]}"] = vb.value.to_i
|
126
|
+
index += 1
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
return metrics
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
#
|
137
|
+
# Gather VS Throughput Inbound (returns in bits)
|
138
|
+
#
|
139
|
+
def get_throughput_in(snmp = nil)
|
140
|
+
metrics = { }
|
141
|
+
index = 0
|
142
|
+
snmp = snmp_manager unless snmp
|
143
|
+
|
144
|
+
if snmp
|
145
|
+
get_names(snmp) if @vs_names.empty?
|
146
|
+
|
147
|
+
snmp.walk([OID_LTM_VIRTUAL_SERV_STAT_CLIENT_BYTES_IN]) do |row|
|
148
|
+
row.each do |vb|
|
149
|
+
metrics["Virtual Servers/Throughput/In/#{@vs_names[index]}"] = (vb.value.to_f * 8)
|
150
|
+
index += 1
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
return metrics
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
#
|
161
|
+
# Gather VS Throughput Inbound (returns in bits)
|
162
|
+
#
|
163
|
+
def get_throughput_out(snmp = nil)
|
164
|
+
metrics = { }
|
165
|
+
index = 0
|
166
|
+
snmp = snmp_manager unless snmp
|
167
|
+
|
168
|
+
if snmp
|
169
|
+
get_names(snmp) if @vs_names.empty?
|
170
|
+
|
171
|
+
snmp.walk([OID_LTM_VIRTUAL_SERV_STAT_CLIENT_BYTES_OUT]) do |row|
|
172
|
+
row.each do |vb|
|
173
|
+
metrics["Virtual Servers/Throughput/Out/#{@vs_names[index]}"] = (vb.value.to_f * 8)
|
174
|
+
index += 1
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
return metrics
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
data/newrelic_f5_plugin.gemspec
CHANGED
@@ -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.
|
17
|
-
s.date = '2013-06-
|
16
|
+
s.version = '1.0.1'
|
17
|
+
s.date = '2013-06-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
|
@@ -76,6 +76,7 @@ to find out how to install and run the plugin agent.
|
|
76
76
|
lib/newrelic_f5_plugin.rb
|
77
77
|
lib/newrelic_f5_plugin/agent.rb
|
78
78
|
lib/newrelic_f5_plugin/nodes.rb
|
79
|
+
lib/newrelic_f5_plugin/virtuals.rb
|
79
80
|
newrelic_f5_plugin.gemspec
|
80
81
|
test/f5_monitor_test.rb
|
81
82
|
test/plugin_test.rb
|
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.
|
4
|
+
version: 1.0.1
|
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-06-
|
12
|
+
date: 2013-06-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: newrelic_plugin
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- lib/newrelic_f5_plugin.rb
|
68
68
|
- lib/newrelic_f5_plugin/agent.rb
|
69
69
|
- lib/newrelic_f5_plugin/nodes.rb
|
70
|
+
- lib/newrelic_f5_plugin/virtuals.rb
|
70
71
|
- newrelic_f5_plugin.gemspec
|
71
72
|
- test/f5_monitor_test.rb
|
72
73
|
- test/plugin_test.rb
|