Class: NewRelic::F5Plugin::Agent

Inherits:
Plugin::Agent::Base
  • Object
show all
Defined in:
lib/newrelic_f5_plugin/agent.rb

Overview

Part of me wants to split this out into different devices using this OID:

1.3.6.1.4.1.3375.2.1.3.5.2.0 = STRING: "BIG-IP 3900" or
1.3.6.1.4.1.3375.2.1.3.5.1.0 = STRING: "C106"

Especially since a 3900, 6900, Viprion won’t respond exactly the same. To make it worse, versions of BIG-IP older than 11.2 might not implent all all of these OIDs.

Version: 1.3.6.1.4.1.3375.2.1.4.2.0
  Build: 1.3.6.1.4.1.3375.2.1.4.3.0

Instance Method Summary collapse

Instance Method Details

#agent_labelObject



36
37
38
39
# File 'lib/newrelic_f5_plugin/agent.rb', line 36

def agent_label
  return agent_name unless agent_name.nil?
  return hostname
end

#poll_cycleObject

This is called on every polling cycle



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/newrelic_f5_plugin/agent.rb', line 52

def poll_cycle
  NewRelic::PlatformLogger.debug("Starting poll cycle for '#{hostname}'")

  # SNMP Stuff here
  snmp = SNMP::Manager.new(:host => hostname, :port => port, :community => snmp_community)

  #
  # Test our SNMP connection, return if we fail to connect so the entire agent doesn't quit
  #
  begin
    product_name = snmp.get_value(["1.3.6.1.4.1.3375.2.1.4.1.0"]).first
    NewRelic::PlatformLogger.debug("Found F5 device of type: '#{product_name}'")
  rescue SNMP::RequestTimeout
    NewRelic::PlatformLogger.error("Unable to connect to device: '#{hostname}', skipping...")
    snmp.close
    return
  rescue => e
    NewRelic::PlatformLogger.error(e)
    snmp.close
    return
  end


  # Platform metrics
  NewRelic::PlatformLogger.debug("Collecting Platform stats")
  @platform ||= NewRelic::F5Plugin::Platform.new
  @platform.poll(self, snmp)

  # Device wide metrics
  NewRelic::PlatformLogger.debug("Collecting System stats")
  @system ||= NewRelic::F5Plugin::Device.new
  @system.poll(self, snmp)

  # Device Interface metrics
  NewRelic::PlatformLogger.debug("Collecting Interface stats")
  @interfaces ||= NewRelic::F5Plugin::Interfaces.new
  @interfaces.poll(self, snmp)

  # Node stats
  NewRelic::PlatformLogger.debug("Collecting Node stats")
  @nodes ||= NewRelic::F5Plugin::Nodes.new
  @nodes.poll(self, snmp)

  # Collect virtual server statistics
  NewRelic::PlatformLogger.debug("Collecting Virtual Server stats")
  @virtuals ||= NewRelic::F5Plugin::Virtuals.new
  @virtuals.poll(self, snmp)

  # Collect pool statistics
  NewRelic::PlatformLogger.debug("Collecting Pool stats")
  @pools ||= NewRelic::F5Plugin::Pools.new
  @pools.poll(self, snmp)

  # iRule statistics
  NewRelic::PlatformLogger.debug("Collecting iRule stats")
  @rules ||= NewRelic::F5Plugin::Rules.new
  @rules.poll(self, snmp)

  # Collect snat pool statistics
  NewRelic::PlatformLogger.debug("Collecting SNAT Pool stats")
  @snatpools ||= NewRelic::F5Plugin::SnatPools.new
  @snatpools.poll(self, snmp)

  # Collect Client SSL Profile statistics
  NewRelic::PlatformLogger.debug("Collecting Client SSL Profile stats")
  @clientssl ||= NewRelic::F5Plugin::ClientSsl.new
  @clientssl.poll(self, snmp)

  # Collect Global SSL statistics
  NewRelic::PlatformLogger.debug("Collecting Global SSL stats")
  @globalssl ||= NewRelic::F5Plugin::GlobalSsl.new
  @globalssl.poll(self, snmp)

  # Cleanup snmp connection
  snmp.close
end

#portObject

You do not have to specify the SNMP port in the yaml if you don’t want to.



133
134
135
# File 'lib/newrelic_f5_plugin/agent.rb', line 133

def port
  @port || 161
end

#report_counter_metric(metric, type, value) ⇒ Object

Helper function to create and keep track of all the counters



141
142
143
144
145
146
147
148
149
# File 'lib/newrelic_f5_plugin/agent.rb', line 141

def report_counter_metric(metric, type, value)
  @processors ||= {}

  if @processors[metric].nil?
    @processors[metric] = NewRelic::Processor::EpochCounter.new
  end

  report_metric metric, type, @processors[metric].process(value)
end

#setup_metricsObject

Required, but not used



45
46
# File 'lib/newrelic_f5_plugin/agent.rb', line 45

def setup_metrics
end