# HG changeset patch # User Mahlon E. Smith # Date 1532364122 25200 # Node ID 77084121952b186cc1e7619872a51d063271d336 # Parent cedffd6652d35becb2a3b65119adfdd46cd9c9fd Remove the unnecessary Hash. diff -r cedffd6652d3 -r 77084121952b lib/arborist/monitor/snmp/cpu.rb --- a/lib/arborist/monitor/snmp/cpu.rb Wed Jun 13 08:55:14 2018 -0700 +++ b/lib/arborist/monitor/snmp/cpu.rb Mon Jul 23 09:42:02 2018 -0700 @@ -24,11 +24,7 @@ # When walking load OIDS, the iterator count matches # these labels. # - LOADKEYS = { - 1 => :load1, - 2 => :load5, - 3 => :load15 - } + LOADKEYS = %i[ load1 load5 load15 ] # Global defaults for instances of this monitor @@ -96,8 +92,8 @@ # else snmp.walk( oid: OIDS[:load] ).each_with_index do |(_, value), idx| - next unless LOADKEYS[ idx + 1 ] - info[ :load ][ LOADKEYS[idx + 1] ] = value.to_f + next unless LOADKEYS[ idx ] + info[ :load ][ LOADKEYS[idx] ] = value.to_f end percentage = (( ( info[:load][ :load5 ] / cpus.size) - 1 ) * 100 ).round( 1 )