Class: NewRelic::F5Plugin::Nodes
- Inherits:
-
Object
- Object
- NewRelic::F5Plugin::Nodes
- Defined in:
- lib/newrelic_f5_plugin/nodes.rb
Constant Summary collapse
- NODE_MONITOR_STATES =
{ 0 => 'unchecked', 1 => 'checking', 2 => 'inband', 3 => 'forced-up', 4 => 'up', 19 => 'down', 20 => 'forced-down', 21 => 'maint', 22 => 'irule-down', 23 => 'inband-down', 24 => 'down-manual-resume', 25 => 'disabled', }
- OID_LTM_NODE_ADDR_MONITOR_STATUS =
"1.3.6.1.4.1.3375.2.2.4.1.2.1.7"
Instance Attribute Summary collapse
-
#snmp_manager ⇒ Object
Returns the value of attribute snmp_manager.
Instance Method Summary collapse
-
#get_status(snmp = nil) ⇒ Object
Gather Node Status and report.
-
#initialize(snmp = nil) ⇒ Nodes
constructor
Init.
-
#poll(agent, snmp) ⇒ Object
Perform polling and reportings of metrics.
Constructor Details
#initialize(snmp = nil) ⇒ Nodes
Init
34 35 36 37 38 39 40 |
# File 'lib/newrelic_f5_plugin/nodes.rb', line 34 def initialize(snmp = nil) if snmp @snmp_manager = snmp else @snmp_manager = nil end end |
Instance Attribute Details
#snmp_manager ⇒ Object
Returns the value of attribute snmp_manager.
11 12 13 |
# File 'lib/newrelic_f5_plugin/nodes.rb', line 11 def snmp_manager @snmp_manager end |
Instance Method Details
#get_status(snmp = nil) ⇒ Object
Gather Node Status and report
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 |
# File 'lib/newrelic_f5_plugin/nodes.rb', line 66 def get_status(snmp = nil) snmp = snmp_manager unless snmp metrics = { } counter = 0 if snmp # Init all the states with zeros so we always get them base_name = "Nodes/Monitor Status" NODE_MONITOR_STATES.each do |key,value| metrics["#{base_name}/#{value}"] = { :label => "nodes", :count => 0 } end # ltmNodeAddrMonitorStatus begin snmp.walk([OID_LTM_NODE_ADDR_MONITOR_STATUS]) do |row| row.each do |vb| metric_name = "#{base_name}/#{NODE_MONITOR_STATES[vb.value.to_i]}" metrics[metric_name][:count] += 1 counter += 1 end end rescue Exception => e NewRelic::PlatformLogger.error("Unable to gather Node Status metrics with error: #{e}") end end NewRelic::PlatformLogger.debug("Nodes: Got #{counter} Status metrics") return metrics end |
#poll(agent, snmp) ⇒ Object
Perform polling and reportings of metrics
47 48 49 50 51 52 |
# File 'lib/newrelic_f5_plugin/nodes.rb', line 47 def poll(agent, snmp) @snmp_manager = snmp node_status = get_status node_status.each_key { |m| agent.report_metric m, node_status[m][:label], node_status[m][:count] } unless node_status.nil? end |