Getting Data In

Ruby SNMP CIM

ephemeric
Contributor

Greetz,

I know almost nothing about Ruby, could someone maybe assist by advising how to print the below
fields but for each value in each column concatenate the value with the CIM field (loosely named for now), like interface="ifDescr" in="ifInOctets" out="ifOutOctets"?

Thank you.

!/usr/bin/ruby

require 'rubygems'
require 'snmp'

ifTable_columns = ["ifDescr", "ifInOctets", "ifOutOctets"]
SNMP::Manager.open(:host => '10.0.0.10', :community => 'public') do |manager|
manager.walk(ifTable_columns) do |row|
row.each { |vb| print "\s#{vb.value}" }
puts
end
end

0 Karma
1 Solution

psanford_splunk
Splunk Employee
Splunk Employee

Hi - If you are new to ruby, our upcoming Ruby SDK release might be able to help you interface with Splunk. We can give you pre-release access now. Just send your GitHub ID to: devinfo@splunk.com

View solution in original post

fross_splunk
Splunk Employee
Splunk Employee

I see you figured it out, but the Ruby SDK for Splunk wouldn't be much help here. It's a core Ruby question, and not really something involving Splunk. There are a lot more Rubyists actively answering questions on Stackoverflow, so you'll probably get faster responses there.

0 Karma

ephemeric
Contributor

!/usr/bin/ruby

require 'rubygems'
require 'snmp'

SNMP::Manager.open(:host => '10.0.0.10', :community => 'public') do |manager|
manager.walk(["ifDescr", "ifInOctets", "ifOutOctets"]) do |descr, inoctets, outoctets|
puts "src_int=#{descr.value} bytes_in=#{inoctets.value} bytes_out=#{outoctets.value}"
end
end

0 Karma

psanford_splunk
Splunk Employee
Splunk Employee

Hi - If you are new to ruby, our upcoming Ruby SDK release might be able to help you interface with Splunk. We can give you pre-release access now. Just send your GitHub ID to: devinfo@splunk.com

ephemeric
Contributor

Wow! Thank you.

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...