bin/metrics-snmp-if.rb in sensu-plugins-snmp-0.1.0 vs bin/metrics-snmp-if.rb in sensu-plugins-snmp-0.2.0
- old
+ new
@@ -136,10 +136,10 @@
ifInErrors ifOutErrors ifInDiscards ifOutDiscards ifSpeed
)
if_table_columns = if_table_common_columns +
(config[:low_capacity] ? if_table_LC_columns : if_table_HC_columns)
- SNMP::Manager.open(host: "#{config[:host]}", community: "#{config[:community]}", version: config[:version]) do |manager|
+ SNMP::Manager.open(host: config[:host].to_s, community: config[:community].to_s, version: config[:version]) do |manager|
manager.walk(if_table_columns) do |row_array|
# turn row (an array) into a hash for eaiser access to the columns
row = Hash[*if_table_columns.zip(row_array).flatten]
puts row.inspect if config[:verbose]
if_name = config[:include_name] ? "#{row['ifIndex'].value}__#{graphite_safe_name(row['ifName'].value.to_s)}" : row['ifIndex'].value.to_s