SNMP::Integer values in Ruby 1.9

Hey guys, this is my first forum post. Wanted to see if anyone could
give me some insight.

I have written a script to derive RSSI values from a Wimax Base Station.
There is some output change between Ruby 1.8 and 1.9.

active_sfid.each { |c| print “SFID#{c}:”,
“#{histogram_summary.fetch(sfarray_num +=1)}” " " }

(Objects are all arrays)

Output in Ruby 1.8.7:
SFID7:53 SFID8:47 SFID9:68 SFID10:57 SFID11:61 SFID12:56 SFID13:53
SFID14:46 SFID15:54 SFID16:47 SFID17:41 SFID18:37 SFID19:55 SFID20:51
SFID23:49 SFID24:45 SFID31:50 SFID32:45 SFID33:57 SFID34:51 SFID35:51
SFID36:47 SFID37:57 SFID38:52 SFID39:58 SFID40:54 SFID41:53 SFID42:49
SFID43:53 SFID44:48 SFID45:60 SFID46:56 SFID47:49 SFID48:44 SFID49:49
SFID50:43 SFID51:44 SFID52:40 SFID53:55 SFID54:52 SFID55:52 SFID56:46
SFID59:64 SFID60:56 SFID61:54 SFID62:50 SFID63:52 SFID64:48 SFID67:53
SFID68:48 SFID69:54 SFID70:49 SFID73:50 SFID74:44

Output in Ruby 1.9:
SFID7:[#<SNMP::Integer:0x000000023fe338 @value=53>]
SFID8:[#<SNMP::Integer:0x00000002331658 @value=47>]
SFID9:[#<SNMP::Integer:0x0000000229c240 @value=68>]
SFID10:[#<SNMP::Integer:0x00000002204658 @value=57>]
SFID11:[#<SNMP::Integer:0x0000000214dd28 @value=61>]
SFID12:[#<SNMP::Integer:0x000000020765a8 @value=56>]
SFID13:[#<SNMP::Integer:0x00000001f7ec18 @value=53>]
SFID14:[#<SNMP::Integer:0x0000000248e7b0 @value=46>]
SFID15:[#<SNMP::Integer:0x000000023acef8 @value=54>]
SFID16:[#<SNMP::Integer:0x000000022c7fc8 @value=47>]
SFID17:[#<SNMP::Integer:0x0000000227c570 @value=41>]
SFID18:[#<SNMP::Integer:0x00000002193e40 @value=37>]
SFID19:[#<SNMP::Integer:0x000000020dfe68 @value=55>]
SFID20:[#<SNMP::Integer:0x00000001fdc3e8 @value=51>]
SFID23:[#<SNMP::Integer:0x00000002512c18 @value=49>]
SFID24:[#<SNMP::Integer:0x00000002402cb8 @value=45>]
SFID31:[#<SNMP::Integer:0x0000000236e5c0 @value=50>]
SFID32:[#<SNMP::Integer:0x000000022a6500 @value=44>]
SFID33:[#<SNMP::Integer:0x000000022152c0 @value=57>]
SFID34:[#<SNMP::Integer:0x000000021767b8 @value=51>]
SFID35:[#<SNMP::Integer:0x000000020928b8 @value=51>]
SFID36:[#<SNMP::Integer:0x00000001fc2678 @value=46>]
SFID37:[#<SNMP::Integer:0x0000000249ff78 @value=57>]
SFID38:[#<SNMP::Integer:0x000000023d1a88 @value=52>]
SFID39:[#<SNMP::Integer:0x000000022ddc40 @value=58>]
SFID40:[#<SNMP::Integer:0x0000000228dd00 @value=54>]
SFID41:[#<SNMP::Integer:0x000000021b17d8 @value=53>]
SFID42:[#<SNMP::Integer:0x00000002111db8 @value=49>]
SFID43:[#<SNMP::Integer:0x0000000203cf90 @value=53>]
SFID44:[#<SNMP::Integer:0x00000002109c70 @value=48>]
SFID45:[#<SNMP::Integer:0x00000002453528 @value=60>]
SFID46:[#<SNMP::Integer:0x0000000239e408 @value=56>]
SFID47:[#<SNMP::Integer:0x000000022c27d8 @value=49>]
SFID48:[#<SNMP::Integer:0x00000002276530 @value=44>]
SFID49:[#<SNMP::Integer:0x0000000218a830 @value=49>]
SFID50:[#<SNMP::Integer:0x000000020b42d8 @value=43>]
SFID51:[#<SNMP::Integer:0x00000001fd4818 @value=44>]
SFID52:[#<SNMP::Integer:0x000000024ceb28 @value=40>]
SFID53:[#<SNMP::Integer:0x000000023e42f0 @value=55>]
SFID54:[#<SNMP::Integer:0x000000022eaeb0 @value=52>]
SFID55:[#<SNMP::Integer:0x000000022991b0 @value=52>]
SFID56:[#<SNMP::Integer:0x00000002203eb0 @value=46>]
SFID59:[#<SNMP::Integer:0x0000000214d7b0 @value=64>]
SFID60:[#<SNMP::Integer:0x00000002075f18 @value=56>]
SFID61:[#<SNMP::Integer:0x00000001f2a630 @value=54>]
SFID62:[#<SNMP::Integer:0x0000000248ee40 @value=50>]
SFID63:[#<SNMP::Integer:0x000000023ae708 @value=52>]
SFID64:[#<SNMP::Integer:0x000000022cae28 @value=48>]
SFID67:[#<SNMP::Integer:0x0000000227f9b8 @value=53>]
SFID68:[#<SNMP::Integer:0x000000021989b8 @value=48>]
SFID69:[#<SNMP::Integer:0x000000020e7f78 @value=54>]
SFID70:[#<SNMP::Integer:0x00000001fe6c20 @value=49>]
SFID73:[#<SNMP::Integer:0x000000025307a8 @value=50>]
SFID74:[#<SNMP::Integer:0x0000000240f4e0 @value=43>]

How can I get just the @value and why is this so different? I’m hoping
to cut processor usage using 1.9.

Thanks,

Jason

Hey y’all (…I’m in Kentucky),

Figured this weirdness out on my own. Figured I’d post it in case anyone
stumbled upon it (since when I Google, this is all I see):

Using ‘print’ with that particular patch of code produces the
SNMP::Integer output, however, ‘puts’ does not, it’s fine.

So I guess it’s getting thrown into an array-like structure then,
because I changed the code to this, and it works fine:

active_sfid.each do |c|
hrip = histogram_summary.fetch(sfarray_num +=1)
print “SFID#{c}:”, “#{hrip[0]}” " " end
end

All I really did was assign the fetched values to ‘hrip’ and call
‘hrip[0]’

BAM!

Jason Loughran wrote:

Hey guys, this is my first forum post. Wanted to see if anyone could
give me some insight.

I have written a script to derive RSSI values from a Wimax Base Station.
There is some output change between Ruby 1.8 and 1.9.

active_sfid.each { |c| print “SFID#{c}:”,
“#{histogram_summary.fetch(sfarray_num +=1)}” " " }

(Objects are all arrays)

Output in Ruby 1.8.7:
SFID7:53 SFID8:47 SFID9:68 SFID10:57 SFID11:61 SFID12:56 SFID13:53
SFID14:46 SFID15:54 SFID16:47 SFID17:41 SFID18:37 SFID19:55 SFID20:51
SFID23:49 SFID24:45 SFID31:50 SFID32:45 SFID33:57 SFID34:51 SFID35:51
SFID36:47 SFID37:57 SFID38:52 SFID39:58 SFID40:54 SFID41:53 SFID42:49
SFID43:53 SFID44:48 SFID45:60 SFID46:56 SFID47:49 SFID48:44 SFID49:49
SFID50:43 SFID51:44 SFID52:40 SFID53:55 SFID54:52 SFID55:52 SFID56:46
SFID59:64 SFID60:56 SFID61:54 SFID62:50 SFID63:52 SFID64:48 SFID67:53
SFID68:48 SFID69:54 SFID70:49 SFID73:50 SFID74:44

Output in Ruby 1.9:
SFID7:[#<SNMP::Integer:0x000000023fe338 @value=53>]
SFID8:[#<SNMP::Integer:0x00000002331658 @value=47>]
SFID9:[#<SNMP::Integer:0x0000000229c240 @value=68>]
SFID10:[#<SNMP::Integer:0x00000002204658 @value=57>]
SFID11:[#<SNMP::Integer:0x0000000214dd28 @value=61>]
SFID12:[#<SNMP::Integer:0x000000020765a8 @value=56>]
SFID13:[#<SNMP::Integer:0x00000001f7ec18 @value=53>]
SFID14:[#<SNMP::Integer:0x0000000248e7b0 @value=46>]
SFID15:[#<SNMP::Integer:0x000000023acef8 @value=54>]
SFID16:[#<SNMP::Integer:0x000000022c7fc8 @value=47>]
SFID17:[#<SNMP::Integer:0x0000000227c570 @value=41>]
SFID18:[#<SNMP::Integer:0x00000002193e40 @value=37>]
SFID19:[#<SNMP::Integer:0x000000020dfe68 @value=55>]
SFID20:[#<SNMP::Integer:0x00000001fdc3e8 @value=51>]
SFID23:[#<SNMP::Integer:0x00000002512c18 @value=49>]
SFID24:[#<SNMP::Integer:0x00000002402cb8 @value=45>]
SFID31:[#<SNMP::Integer:0x0000000236e5c0 @value=50>]
SFID32:[#<SNMP::Integer:0x000000022a6500 @value=44>]
SFID33:[#<SNMP::Integer:0x000000022152c0 @value=57>]
SFID34:[#<SNMP::Integer:0x000000021767b8 @value=51>]
SFID35:[#<SNMP::Integer:0x000000020928b8 @value=51>]
SFID36:[#<SNMP::Integer:0x00000001fc2678 @value=46>]
SFID37:[#<SNMP::Integer:0x0000000249ff78 @value=57>]
SFID38:[#<SNMP::Integer:0x000000023d1a88 @value=52>]
SFID39:[#<SNMP::Integer:0x000000022ddc40 @value=58>]
SFID40:[#<SNMP::Integer:0x0000000228dd00 @value=54>]
SFID41:[#<SNMP::Integer:0x000000021b17d8 @value=53>]
SFID42:[#<SNMP::Integer:0x00000002111db8 @value=49>]
SFID43:[#<SNMP::Integer:0x0000000203cf90 @value=53>]
SFID44:[#<SNMP::Integer:0x00000002109c70 @value=48>]
SFID45:[#<SNMP::Integer:0x00000002453528 @value=60>]
SFID46:[#<SNMP::Integer:0x0000000239e408 @value=56>]
SFID47:[#<SNMP::Integer:0x000000022c27d8 @value=49>]
SFID48:[#<SNMP::Integer:0x00000002276530 @value=44>]
SFID49:[#<SNMP::Integer:0x0000000218a830 @value=49>]
SFID50:[#<SNMP::Integer:0x000000020b42d8 @value=43>]
SFID51:[#<SNMP::Integer:0x00000001fd4818 @value=44>]
SFID52:[#<SNMP::Integer:0x000000024ceb28 @value=40>]
SFID53:[#<SNMP::Integer:0x000000023e42f0 @value=55>]
SFID54:[#<SNMP::Integer:0x000000022eaeb0 @value=52>]
SFID55:[#<SNMP::Integer:0x000000022991b0 @value=52>]
SFID56:[#<SNMP::Integer:0x00000002203eb0 @value=46>]
SFID59:[#<SNMP::Integer:0x0000000214d7b0 @value=64>]
SFID60:[#<SNMP::Integer:0x00000002075f18 @value=56>]
SFID61:[#<SNMP::Integer:0x00000001f2a630 @value=54>]
SFID62:[#<SNMP::Integer:0x0000000248ee40 @value=50>]
SFID63:[#<SNMP::Integer:0x000000023ae708 @value=52>]
SFID64:[#<SNMP::Integer:0x000000022cae28 @value=48>]
SFID67:[#<SNMP::Integer:0x0000000227f9b8 @value=53>]
SFID68:[#<SNMP::Integer:0x000000021989b8 @value=48>]
SFID69:[#<SNMP::Integer:0x000000020e7f78 @value=54>]
SFID70:[#<SNMP::Integer:0x00000001fe6c20 @value=49>]
SFID73:[#<SNMP::Integer:0x000000025307a8 @value=50>]
SFID74:[#<SNMP::Integer:0x0000000240f4e0 @value=43>]

How can I get just the @value and why is this so different? I’m hoping
to cut processor usage using 1.9.

Thanks,

Jason

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs