Class: NewRelic::F5Plugin::ClientSsl

Inherits:
Object
  • Object
show all
Defined in:
lib/newrelic_f5_plugin/client_ssl.rb

Constant Summary collapse

OID_LTM_CLIENT_SSL =
"1.3.6.1.4.1.3375.2.2.6.2"
OID_LTM_CLIENT_SSL_PROFILE_STAT =
"#{OID_LTM_CLIENT_SSL}.2"
OID_LTM_CLIENT_SSL_STAT_ENTRY =
"#{OID_LTM_CLIENT_SSL_PROFILE_STAT}.3.1"
OID_LTM_CLIENT_SSL_STAT_NAME =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.1"
OID_LTM_CLIENT_SSL_STAT_CUR_CONNS =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.2"
OID_LTM_CLIENT_SSL_STAT_MAX_CONNS =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.3"
OID_LTM_CLIENT_SSL_STAT_CUR_NATIVE_CONNS =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.4"
OID_LTM_CLIENT_SSL_STAT_MAX_NATIVE_CONNS =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.5"
OID_LTM_CLIENT_SSL_STAT_FULLY_HW_ACCELERATED_CONNS =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.16"
OID_LTM_CLIENT_SSL_STAT_PARTIALLY_HW_ACCELERATED_CONNS =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.17"
OID_LTM_CLIENT_SSL_STAT_NON_HW_ACCELERATED_CONNS =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.18"
OID_LTM_CLIENT_SSL_STAT_SESS_CACHE_CUR_ENTRIES =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.21"
OID_LTM_CLIENT_SSL_STAT_SESS_CACHE_HITS =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.22"
OID_LTM_CLIENT_SSL_STAT_SESS_CACHE_LOOKUPS =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.23"
OID_LTM_CLIENT_SSL_STAT_SESS_CACHE_OVERFLOWS =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.24"
OID_LTM_CLIENT_SSL_STAT_SESS_CACHE_INVALIDATIONS =
"#{OID_LTM_CLIENT_SSL_STAT_ENTRY}.25"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(snmp = nil) ⇒ ClientSsl

Init



97
98
99
100
101
102
103
104
105
# File 'lib/newrelic_f5_plugin/client_ssl.rb', line 97

def initialize(snmp = nil)
  @names = [ ]

  if snmp
    @snmp_manager = snmp
  else
    @snmp_manager = nil
  end
end

Instance Attribute Details

#namesObject

Returns the value of attribute names.



71
72
73
# File 'lib/newrelic_f5_plugin/client_ssl.rb', line 71

def names
  @names
end

#snmp_managerObject

Returns the value of attribute snmp_manager.



71
72
73
# File 'lib/newrelic_f5_plugin/client_ssl.rb', line 71

def snmp_manager
  @snmp_manager
end

Instance Method Details

#get_conns_current(snmp = nil) ⇒ Object

Gather current connection count



180
181
182
183
184
185
186
187
# File 'lib/newrelic_f5_plugin/client_ssl.rb', line 180

def get_conns_current(snmp = nil)
  snmp = snmp_manager unless snmp

  get_names(snmp) if @names.empty?
  res = gather_snmp_metrics_by_name("Client SSL Profiles/Current Connections", @names, OID_LTM_CLIENT_SSL_STAT_CUR_CONNS, snmp)
  NewRelic::PlatformLogger.debug("Client SSL Profiles: Got #{res.size}/#{@names.size} Current Connection metrics")
  return res
end

#get_names(snmp = nil) ⇒ Object

Get the list of iRule names



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/newrelic_f5_plugin/client_ssl.rb', line 154

def get_names(snmp = nil)
  snmp = snmp_manager unless snmp

  if snmp
    @names.clear

    begin
      snmp.walk([OID_LTM_CLIENT_SSL_STAT_NAME]) do |row|
        row.each do |vb|
          @names.push(vb.value)
        end
      end
    rescue Exception => e
      NewRelic::PlatformLogger.error("Unable to gather Client SSL Profile names with error: #{e}")
    end

    NewRelic::PlatformLogger.debug("Client SSL Profiles: Found #{@names.size}")
    return @names
  end
end

#get_session_cache_current(snmp = nil) ⇒ Object

Gather current cache entries



194
195
196
197
198
199
200
201
# File 'lib/newrelic_f5_plugin/client_ssl.rb', line 194

def get_session_cache_current(snmp = nil)
  snmp = snmp_manager unless snmp

  get_names(snmp) if @names.empty?
  res = gather_snmp_metrics_by_name("Client SSL Profiles/Current Cache Entries", @names, OID_LTM_CLIENT_SSL_STAT_SESS_CACHE_CUR_ENTRIES, snmp)
  NewRelic::PlatformLogger.debug("Client SSL Profiles: Got #{res.size}/#{@names.size} Current Session Cache metrics")
  return res
end

#get_session_cache_hits(snmp = nil) ⇒ Object

Gather session cache hits



208
209
210
211
212
213
214
215
# File 'lib/newrelic_f5_plugin/client_ssl.rb', line 208

def get_session_cache_hits(snmp = nil)
  snmp = snmp_manager unless snmp

  get_names(snmp) if @names.empty?
  res = gather_snmp_metrics_by_name("Client SSL Profiles/Session Cache Hits", @names, OID_LTM_CLIENT_SSL_STAT_SESS_CACHE_HITS, snmp)
  NewRelic::PlatformLogger.debug("Client SSL Profiles: Got #{res.size}/#{@names.size} Session Cache Hit metrics")
  return res
end

#get_session_cache_invalidations(snmp = nil) ⇒ Object

Gather session cache invalidations



250
251
252
253
254
255
256
257
# File 'lib/newrelic_f5_plugin/client_ssl.rb', line 250

def get_session_cache_invalidations(snmp = nil)
  snmp = snmp_manager unless snmp

  get_names(snmp) if @names.empty?
  res = gather_snmp_metrics_by_name("Client SSL Profiles/Session Cache Invalidations", @names, OID_LTM_CLIENT_SSL_STAT_SESS_CACHE_INVALIDATIONS, snmp)
  NewRelic::PlatformLogger.debug("Client SSL Profiles: Got #{res.size}/#{@names.size} Session Cache Invalidation metrics")
  return res
end

#get_session_cache_lookups(snmp = nil) ⇒ Object

Gather session cache lookups



222
223
224
225
226
227
228
229
# File 'lib/newrelic_f5_plugin/client_ssl.rb', line 222

def get_session_cache_lookups(snmp = nil)
  snmp = snmp_manager unless snmp

  get_names(snmp) if @names.empty?
  res = gather_snmp_metrics_by_name("Client SSL Profiles/Session Cache Lookups", @names, OID_LTM_CLIENT_SSL_STAT_SESS_CACHE_LOOKUPS, snmp)
  NewRelic::PlatformLogger.debug("Client SSL Profiles: Got #{res.size}/#{@names.size} Session Cache Lookup metrics")
  return res
end

#get_session_cache_overflows(snmp = nil) ⇒ Object

Gather session cache overflows



236
237
238
239
240
241
242
243
# File 'lib/newrelic_f5_plugin/client_ssl.rb', line 236

def get_session_cache_overflows(snmp = nil)
  snmp = snmp_manager unless snmp

  get_names(snmp) if @names.empty?
  res = gather_snmp_metrics_by_name("Client SSL Profiles/Session Cache Overflows", @names, OID_LTM_CLIENT_SSL_STAT_SESS_CACHE_OVERFLOWS, snmp)
  NewRelic::PlatformLogger.debug("Client SSL Profiles: Got #{res.size}/#{@names.size} Session Cache Overflow metrics")
  return res
end

#poll(agent, snmp) ⇒ Object

Perform polling and reportings of metrics



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/newrelic_f5_plugin/client_ssl.rb', line 111

def poll(agent, snmp)
  @snmp_manager = snmp

  unless get_names.empty?
    clientssl_conns_current = get_conns_current
    clientssl_conns_current.each_key { |m| agent.report_metric m, "conns", clientssl_conns_current[m] } unless clientssl_conns_current.nil?

    clientssl_session_cache_current = get_session_cache_current
    clientssl_session_cache_current.each_key { |m| agent.report_metric m, "entries", clientssl_session_cache_current[m] } unless clientssl_session_cache_current.nil?

    clientssl_session_cache_hits = get_session_cache_hits
    clientssl_session_cache_hits.each_key { |m| agent.report_counter_metric m, "hits/sec", clientssl_session_cache_hits[m] } unless clientssl_session_cache_hits.nil?

    clientssl_session_cache_lookups = get_session_cache_lookups
    clientssl_session_cache_lookups.each_key { |m| agent.report_counter_metric m, "lookups/sec", clientssl_session_cache_lookups[m] } unless clientssl_session_cache_lookups.nil?

    NewRelic::PlatformLogger.debug("Calculating Client SSL Profile hit ratios")
    clientssl_hit_ratio = { }
    clientssl_session_cache_hits.each_key do |h|
      key = h.gsub(/^Client SSL Profiles\/Session Cache Hits\//, '')
      l = "Client SSL Profiles/Session Cache Lookups/#{key}"
      p = "Client SSL Profiles/Session Cache Hit Ratio/#{key}"
      unless clientssl_session_cache_lookups[l].nil?
        if clientssl_session_cache_lookups[l].to_f > 0
          clientssl_hit_ratio[p] = (clientssl_session_cache_hits[h].to_f / clientssl_session_cache_lookups[l].to_f) * 100
        else
          clientssl_hit_ratio[p] = 0.0
        end
      end
    end
    clientssl_hit_ratio.each_key { |m| agent.report_metric m, "%", clientssl_hit_ratio[m] } unless clientssl_hit_ratio.empty?

    clientssl_session_cache_overflows = get_session_cache_overflows
    clientssl_session_cache_overflows.each_key { |m| agent.report_counter_metric m, "overflows/sec", clientssl_session_cache_overflows[m] } unless clientssl_session_cache_overflows.nil?

    clientssl_session_cache_invalidations = get_session_cache_invalidations
    clientssl_session_cache_invalidations.each_key { |m| agent.report_counter_metric m, "invld/sec", clientssl_session_cache_invalidations[m] } unless clientssl_session_cache_invalidations.nil?
  end
end