newrelic_f5_plugin 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b7cc8b0330af44b1a00392f0d9dc7a048c0ce79
4
- data.tar.gz: 0aab0890155622be2e12ab0ba2263cb7593f1ba7
3
+ metadata.gz: 279793e5c1936f90db19c0ffd8842a0f7dc99760
4
+ data.tar.gz: ebbbd91dac4e565184e5d45562ff23ad428bdbea
5
5
  SHA512:
6
- metadata.gz: dd8e326a708d65cf0f2f799328fe2802e059154d531e10317385234b67c1b4abfa495cf6e7010fbe891e044903565268e3d7f5d52d3b03de4113c1e227fd53c5
7
- data.tar.gz: aa3406c4791ab4ffe72ef4a7b15eedd04d7f0797c636938fd06aa0e148222daf3bf121264db28f79b0af3533aa3ba87681389ed368152f3c134efa25cefc5db5
6
+ metadata.gz: e3af625664d8d7c549203c1a03cc7ece47178f0900b0085c8df3c6fff98e9d88e982a6029d987c9388d53f3454becc449d918ad18b90e16a945dfeed1f7f5f46
7
+ data.tar.gz: 390c1550dce277a0bc2f46458a5fb67215f1c801de7a85a19313a0e727073026ceca796d71e3df4e47955f3c606f597a2b4c045b3074aa32e0d5a329ed065da1
@@ -4,6 +4,7 @@ require 'newrelic_f5_plugin/client_ssl'
4
4
  require 'newrelic_f5_plugin/device'
5
5
  require 'newrelic_f5_plugin/interfaces'
6
6
  require 'newrelic_f5_plugin/nodes'
7
+ require 'newrelic_f5_plugin/platform'
7
8
  require 'newrelic_f5_plugin/pools'
8
9
  require 'newrelic_f5_plugin/rules'
9
10
  require 'newrelic_f5_plugin/snatpools'
@@ -4,7 +4,7 @@ require 'newrelic_plugin'
4
4
  require 'snmp'
5
5
 
6
6
  module NewRelic::F5Plugin
7
- VERSION = '1.0.16'
7
+ VERSION = '1.0.17'
8
8
 
9
9
  # Register and run the agent
10
10
  def self.run
@@ -72,6 +72,11 @@ module NewRelic::F5Plugin
72
72
  end
73
73
 
74
74
 
75
+ # Platform metrics
76
+ NewRelic::PlatformLogger.debug("Collecting Platform stats")
77
+ @platform ||= NewRelic::F5Plugin::Platform.new
78
+ @platform.poll(self, snmp)
79
+
75
80
  # Device wide metrics
76
81
  NewRelic::PlatformLogger.debug("Collecting System stats")
77
82
  @system ||= NewRelic::F5Plugin::Device.new
@@ -13,16 +13,6 @@ module NewRelic
13
13
  OID_SYS_CLIENTSSL_STAT_CUR_CONNS = "1.3.6.1.4.1.3375.2.1.1.2.9.2.0"
14
14
  OID_SYS_CLIENTSSL_STAT_TOT_COMPAT_CONNS = "1.3.6.1.4.1.3375.2.1.1.2.9.9.0"
15
15
  OID_SYS_CLIENTSSL_STAT_TOT_NATIVE_CONNS = "1.3.6.1.4.1.3375.2.1.1.2.9.6.0"
16
- OID_SYS_GLOBAL_HOST = "1.3.6.1.4.1.3375.2.1.1.2.20"
17
- OID_SYS_GLOBAL_HOST_CPU_COUNT = "#{OID_SYS_GLOBAL_HOST}.4.0"
18
- OID_SYS_GLOBAL_HOST_CPU_IDLE_1M = "#{OID_SYS_GLOBAL_HOST}.25.0"
19
- OID_SYS_GLOBAL_HOST_CPU_IOWAIT_1M = "#{OID_SYS_GLOBAL_HOST}.28.0"
20
- OID_SYS_GLOBAL_HOST_CPU_IRQ_1M = "#{OID_SYS_GLOBAL_HOST}.26.0"
21
- OID_SYS_GLOBAL_HOST_CPU_NICE_1M = "#{OID_SYS_GLOBAL_HOST}.23.0"
22
- OID_SYS_GLOBAL_HOST_CPU_SOFTIRQ_1M = "#{OID_SYS_GLOBAL_HOST}.27.0"
23
- OID_SYS_GLOBAL_HOST_CPU_SYSTEM_1M = "#{OID_SYS_GLOBAL_HOST}.24.0"
24
- OID_SYS_GLOBAL_HOST_CPU_USER_1M = "#{OID_SYS_GLOBAL_HOST}.22.0"
25
- OID_SYS_HOST_MEMORY_USED = "1.3.6.1.4.1.3375.2.1.7.1.2.0"
26
16
  OID_SYS_HTTP_COMPRESSION_STAT = "1.3.6.1.4.1.3375.2.1.1.2.22"
27
17
  OID_SYS_HTTP_COMPRESSION_STAT_AUDIO_POSTCOMPRESS_BYTES = "#{OID_SYS_HTTP_COMPRESSION_STAT}.24.0"
28
18
  OID_SYS_HTTP_COMPRESSION_STAT_AUDIO_PRECOMPRESS_BYTES = "#{OID_SYS_HTTP_COMPRESSION_STAT}.23.0"
@@ -66,11 +56,6 @@ module NewRelic
66
56
  OID_SYS_HTTP_STAT_V11_RESP = "#{OID_SYS_HTTP_STAT}.15.0"
67
57
  OID_SYS_HTTP_STAT_V9_REQS = "#{OID_SYS_HTTP_STAT}.10.0"
68
58
  OID_SYS_HTTP_STAT_V9_RESP = "#{OID_SYS_HTTP_STAT}.13.0"
69
- OID_SYS_PRODUCT = "1.3.6.1.4.1.3375.2.1.4"
70
- OID_SYS_PRODUCT_NAME = "#{OID_SYS_PRODUCT}.1.0"
71
- OID_SYS_PRODUCT_VERSION = "#{OID_SYS_PRODUCT}.2.0"
72
- OID_SYS_PRODUCT_BUILD = "#{OID_SYS_PRODUCT}.3.0"
73
- OID_SYS_PRODUCT_EDITION = "#{OID_SYS_PRODUCT}.4.0"
74
59
  OID_SYS_SERVERSSL_STAT_CUR_CONNS = "1.3.6.1.4.1.3375.2.1.1.2.10.2.0"
75
60
  OID_SYS_SERVERSSL_STAT_TOT_COMPAT_CONNS = "1.3.6.1.4.1.3375.2.1.1.2.10.9.0"
76
61
  OID_SYS_SERVERSSL_STAT_TOT_NATIVE_CONNS = "1.3.6.1.4.1.3375.2.1.1.2.10.6.0"
@@ -126,12 +111,6 @@ module NewRelic
126
111
  def poll(agent, snmp)
127
112
  @snmp_manager = snmp
128
113
 
129
- system_version = get_version
130
- NewRelic::PlatformLogger.debug("Found F5 device with version: #{system_version}")
131
-
132
- system_cpu = get_cpu
133
- system_cpu.each_key { |m| agent.report_metric m, "%", system_cpu[m] } unless system_cpu.nil?
134
-
135
114
  system_memory = get_memory
136
115
  system_memory.each_key { |m| agent.report_metric m, "bytes", system_memory[m] } unless system_memory.nil?
137
116
 
@@ -174,59 +153,6 @@ module NewRelic
174
153
 
175
154
 
176
155
 
177
- #
178
- # Gather Version information
179
- #
180
- def get_version(snmp = nil)
181
- version = "Unknown!"
182
- snmp = snmp_manager unless snmp
183
-
184
- if snmp
185
- res = gather_snmp_metrics_array([OID_SYS_PRODUCT_VERSION, OID_SYS_PRODUCT_BUILD], snmp)
186
-
187
- version = "#{res[0]}.#{res[1]}" unless res.empty?
188
- end
189
-
190
- return version
191
- end
192
-
193
-
194
- #
195
- # Gather CPU Related metrics and report them in %
196
- #
197
- def get_cpu(snmp = nil)
198
- metrics = { }
199
- snmp = snmp_manager unless snmp
200
-
201
- if snmp
202
- res = gather_snmp_metrics_array([OID_SYS_GLOBAL_HOST_CPU_COUNT, OID_SYS_GLOBAL_HOST_CPU_USER_1M, OID_SYS_GLOBAL_HOST_CPU_NICE_1M,
203
- OID_SYS_GLOBAL_HOST_CPU_SYSTEM_1M, OID_SYS_GLOBAL_HOST_CPU_IRQ_1M, OID_SYS_GLOBAL_HOST_CPU_SOFTIRQ_1M,
204
- OID_SYS_GLOBAL_HOST_CPU_IOWAIT_1M],
205
- snmp)
206
-
207
- # Bail out if we didn't get anything
208
- return metrics if res.empty?
209
-
210
- # In order to show the CPU usage as a total percentage, we divide by the number of cpus
211
- cpu_count = res[0].to_i
212
- vals = res[1..6].map { |i| i.to_f / cpu_count }
213
-
214
- metrics["CPU/Global/User"] = vals[0]
215
- metrics["CPU/Global/Nice"] = vals[1]
216
- metrics["CPU/Global/System"] = vals[2]
217
- metrics["CPU/Global/IRQ"] = vals[3]
218
- metrics["CPU/Global/Soft IRQ"] = vals[4]
219
- metrics["CPU/Global/IO Wait"] = vals[5]
220
-
221
- # Add it all up, and send a summary metric
222
- metrics["CPU/Total/Global"] = vals.inject(0.0){ |a,b| a + b }
223
-
224
- end
225
-
226
- return metrics
227
- end
228
-
229
-
230
156
  #
231
157
  # Gather Memory related metrics and report them in bytes
232
158
  #
@@ -235,13 +161,12 @@ module NewRelic
235
161
  snmp = snmp_manager unless snmp
236
162
 
237
163
  if snmp
238
- res = gather_snmp_metrics_array([OID_SYS_STAT_MEMORY_USED, OID_SYS_HOST_MEMORY_USED], snmp)
164
+ res = gather_snmp_metrics_array([OID_SYS_STAT_MEMORY_USED], snmp)
239
165
 
240
166
  # Bail out if we didn't get anything
241
167
  return metrics if res.empty?
242
168
 
243
169
  metrics["Memory/TMM"] = res[0]
244
- metrics["Memory/Host"] = res[1]
245
170
  end
246
171
 
247
172
  return metrics
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'newrelic_plugin'
4
+ require 'snmp'
5
+
6
+ module NewRelic
7
+ module F5Plugin
8
+
9
+ class Platform
10
+ attr_accessor :snmp_manager
11
+
12
+ # Create the OIDs if they do not exist
13
+ OID_SYS_GLOBAL_HOST = "1.3.6.1.4.1.3375.2.1.1.2.20"
14
+ OID_SYS_GLOBAL_HOST_CPU_COUNT = "#{OID_SYS_GLOBAL_HOST}.4.0"
15
+ OID_SYS_GLOBAL_HOST_CPU_IDLE_1M = "#{OID_SYS_GLOBAL_HOST}.25.0"
16
+ OID_SYS_GLOBAL_HOST_CPU_IOWAIT_1M = "#{OID_SYS_GLOBAL_HOST}.28.0"
17
+ OID_SYS_GLOBAL_HOST_CPU_IRQ_1M = "#{OID_SYS_GLOBAL_HOST}.26.0"
18
+ OID_SYS_GLOBAL_HOST_CPU_NICE_1M = "#{OID_SYS_GLOBAL_HOST}.23.0"
19
+ OID_SYS_GLOBAL_HOST_CPU_SOFTIRQ_1M = "#{OID_SYS_GLOBAL_HOST}.27.0"
20
+ OID_SYS_GLOBAL_HOST_CPU_SYSTEM_1M = "#{OID_SYS_GLOBAL_HOST}.24.0"
21
+ OID_SYS_GLOBAL_HOST_CPU_USER_1M = "#{OID_SYS_GLOBAL_HOST}.22.0"
22
+ OID_SYS_HOST_MEMORY_USED = "1.3.6.1.4.1.3375.2.1.7.1.2.0"
23
+
24
+ OID_SYS_PLATFORM = "1.3.6.1.4.1.3375.2.1.3"
25
+ OID_SYS_PLATFORM_INFO = "#{OID_SYS_PLATFORM}.5"
26
+ OID_SYS_PLATFORM_INFO_NAME = "#{OID_SYS_PLATFORM_INFO}.1.0"
27
+ OID_SYS_PLATFORM_INFO_MARKETING_NAME = "#{OID_SYS_PLATFORM_INFO}.2.0"
28
+
29
+ OID_SYS_PRODUCT = "1.3.6.1.4.1.3375.2.1.4"
30
+ OID_SYS_PRODUCT_NAME = "#{OID_SYS_PRODUCT}.1.0"
31
+ OID_SYS_PRODUCT_VERSION = "#{OID_SYS_PRODUCT}.2.0"
32
+ OID_SYS_PRODUCT_BUILD = "#{OID_SYS_PRODUCT}.3.0"
33
+ OID_SYS_PRODUCT_EDITION = "#{OID_SYS_PRODUCT}.4.0"
34
+
35
+ #
36
+ # Init
37
+ #
38
+ def initialize(snmp = nil)
39
+ @version = 'Unknown!'
40
+
41
+ if snmp
42
+ @snmp_manager = snmp
43
+ else
44
+ @snmp_manager = nil
45
+ end
46
+ end
47
+
48
+
49
+
50
+ #
51
+ # Perform polling and reportings of metrics
52
+ #
53
+ def poll(agent, snmp)
54
+ @snmp_manager = snmp
55
+
56
+ system_platform = get_platform_info
57
+ @version = get_version
58
+ NewRelic::PlatformLogger.debug("Found a #{system_platform} running version #{@version}")
59
+
60
+
61
+ system_cpu = get_cpu
62
+ system_cpu.each_key { |m| agent.report_metric m, "%", system_cpu[m] } unless system_cpu.nil?
63
+
64
+ system_memory = get_memory
65
+ system_memory.each_key { |m| agent.report_metric m, "bytes", system_memory[m] } unless system_memory.nil?
66
+
67
+ end
68
+
69
+
70
+
71
+ #
72
+ # Gather Version information
73
+ #
74
+ def get_version(snmp = nil)
75
+ version = "Unknown!"
76
+ snmp = snmp_manager unless snmp
77
+
78
+ if snmp
79
+ res = gather_snmp_metrics_array([OID_SYS_PRODUCT_VERSION, OID_SYS_PRODUCT_BUILD], snmp)
80
+
81
+ version = "#{res[0]}.#{res[1]}" unless res.empty?
82
+ end
83
+
84
+ return version
85
+ end
86
+
87
+
88
+
89
+ def get_platform_info(snmp = nil)
90
+ platform = "Unknown!"
91
+ snmp = snmp_manager unless snmp
92
+
93
+ if snmp
94
+ res = gather_snmp_metrics_array([OID_SYS_PLATFORM_INFO_MARKETING_NAME, OID_SYS_PLATFORM_INFO_NAME], snmp)
95
+
96
+ platform = "#{res[0]} (#{res[1]})"
97
+ end
98
+
99
+ return platform
100
+ end
101
+
102
+
103
+
104
+ #
105
+ # Gather CPU Related metrics and report them in %
106
+ #
107
+ def get_cpu(snmp = nil)
108
+ metrics = { }
109
+ snmp = snmp_manager unless snmp
110
+
111
+ if snmp
112
+ res = gather_snmp_metrics_array([OID_SYS_GLOBAL_HOST_CPU_COUNT, OID_SYS_GLOBAL_HOST_CPU_USER_1M, OID_SYS_GLOBAL_HOST_CPU_NICE_1M,
113
+ OID_SYS_GLOBAL_HOST_CPU_SYSTEM_1M, OID_SYS_GLOBAL_HOST_CPU_IRQ_1M, OID_SYS_GLOBAL_HOST_CPU_SOFTIRQ_1M,
114
+ OID_SYS_GLOBAL_HOST_CPU_IOWAIT_1M],
115
+ snmp)
116
+
117
+ # Bail out if we didn't get anything
118
+ return metrics if res.empty?
119
+
120
+ # In order to show the CPU usage as a total percentage, we divide by the number of cpus for older versions
121
+ case @version
122
+ when /^11\.4\.1/
123
+ # 11.4.1 HF3 reports average CPU not total, so don't divide by CPU count
124
+ cpu_count = 1
125
+ else
126
+ cpu_count = res[0].to_i
127
+ end
128
+
129
+ vals = res[1..6].map { |i| i.to_f / cpu_count }
130
+
131
+ metrics["CPU/Global/User"] = vals[0]
132
+ metrics["CPU/Global/Nice"] = vals[1]
133
+ metrics["CPU/Global/System"] = vals[2]
134
+ metrics["CPU/Global/IRQ"] = vals[3]
135
+ metrics["CPU/Global/Soft IRQ"] = vals[4]
136
+ metrics["CPU/Global/IO Wait"] = vals[5]
137
+
138
+ # Add it all up, and send a summary metric
139
+ metrics["CPU/Total/Global"] = vals.inject(0.0){ |a,b| a + b }
140
+
141
+ end
142
+
143
+ return metrics
144
+ end
145
+
146
+
147
+ #
148
+ # Gather Memory related metrics and report them in bytes
149
+ #
150
+ def get_memory(snmp = nil)
151
+ metrics = { }
152
+ snmp = snmp_manager unless snmp
153
+
154
+ if snmp
155
+ res = gather_snmp_metrics_array([OID_SYS_HOST_MEMORY_USED], snmp)
156
+
157
+ # Bail out if we didn't get anything
158
+ return metrics if res.empty?
159
+
160
+ metrics["Memory/Host"] = res[0]
161
+ end
162
+
163
+ return metrics
164
+ end
165
+
166
+ end
167
+ end
168
+ end
169
+
@@ -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.16'
17
- s.date = '2014-08-18'
16
+ s.version = '1.0.17'
17
+ s.date = '2014-10-08'
18
18
  s.rubyforge_project = 'newrelic_f5_plugin'
19
19
  s.licenses = ['MIT']
20
20
 
@@ -80,6 +80,7 @@ to find out how to install and run the plugin agent.
80
80
  lib/newrelic_f5_plugin/device.rb
81
81
  lib/newrelic_f5_plugin/interfaces.rb
82
82
  lib/newrelic_f5_plugin/nodes.rb
83
+ lib/newrelic_f5_plugin/platform.rb
83
84
  lib/newrelic_f5_plugin/pools.rb
84
85
  lib/newrelic_f5_plugin/rules.rb
85
86
  lib/newrelic_f5_plugin/snatpools.rb
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_f5_plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Thurman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2014-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: newrelic_plugin
@@ -75,6 +75,7 @@ files:
75
75
  - lib/newrelic_f5_plugin/device.rb
76
76
  - lib/newrelic_f5_plugin/interfaces.rb
77
77
  - lib/newrelic_f5_plugin/nodes.rb
78
+ - lib/newrelic_f5_plugin/platform.rb
78
79
  - lib/newrelic_f5_plugin/pools.rb
79
80
  - lib/newrelic_f5_plugin/rules.rb
80
81
  - lib/newrelic_f5_plugin/snatpools.rb