bin/metrics-snmp-if.rb in sensu-plugins-snmp-1.1.0 vs bin/metrics-snmp-if.rb in sensu-plugins-snmp-2.0.0

- old
+ new

@@ -50,10 +50,15 @@ short: '-h host', boolean: true, default: '127.0.0.1', required: true + option :port, + short: '-P port', + long: '--port PORT', + default: '161' + option :community, short: '-C snmp community', boolean: true, default: 'public' @@ -136,10 +141,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].to_s, community: config[:community].to_s, version: config[:version]) do |manager| + SNMP::Manager.open(host: config[:host].to_s, port: config[:port].to_i, 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