-
Notifications
You must be signed in to change notification settings - Fork 15
undefined method `[]' for nil:NilClass #1
Comments
Hi caine256, In config.yaml you are able to set a proper hostname to the switch ip address. switch: Please try setting correct ips and switch hostnames of all your switches you are collecting sflow samples from. If this fixes the issue for you I should fix the code :) Regards, Sebastian |
Hey @caine256, does it work if you specifiy your switch names? Regards, |
I'm also having problems with this on an ubuntu system HAHAHAAH@MyServer:~/sflow$ bundle exec ./bin/sflow.rb /home/HAHAHAAH/sflow/lib/sflow/collector.rb:63:in rescue in start_collector': unable to start sflow collector (RuntimeError) from /home/HAHAHAAH/sflow/lib/sflow/collector.rb:42:in start_collector'from ./bin/sflow.rb:7:in `' However, I did configure a switch with the right IP and the right name. I also tried it FQDN |
I'm also having trouble getting the sflow collector. I'm receiving data from the collector but only the name of the host the collector is running on: sflow 127.0.0.1 sflow sflow-2015.04.17 AUzEsWZnhNNs4DpbGImT 1 2015-04-17T00:05:02.262Z 0 KM_C5G the collector is recieving data from the switch however its getting mangled in transit to logstash. ALso the console for the collector looks like its not able to process the sflow data its receiving. Im using snmp v3 to get the interface names - could that be related? When i receive sflow traffic the switch the collector shows the following: root@logstash:/tmp/sflow# bundle exec ./bin/sflow.rb doing ctrl-c to cancel shows the following: /var/lib/gems/1.9.1/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in /home/sysadmin/sflow/lib/sflow/collector.rb:63:in rescue in start_collector': unable to start sflow collector (RuntimeError) from /home/sysadmin/sflow/lib/sflow/collector.rb:42:in start_collector'from ./bin/sflow.rb:7:in `' root@logstash:/home/sysadmin/sflow# ruby --version any ideas on how to fix this? any help would be greatly apreciated. |
Actually, I found a different way around my whole SFLOW + ELK. I can't take any credit for this, but if you want I could search for the guy who suggested it to me. Basically the workaround he did, and that I also applied was to create simple wrapper scripts that would execute sflowtool and pipe the information into logstash. A logstash config file is what executes the wrapper which executes the the wrapper, which executes sflow tool. Here's how it went (on an Ubuntu 14.04 system) First obtain the sflowtool for linux and build it (you'll need build-essentials if you don't have it already)
Now that we have sflowtool installed, we can create the wrapper script that logstash will call.
And here's the actual sflowtool-wrapper.sh script. Pay attention to the
And now can chmod that file so it's exectuable. I tried chmod 755 but it had problems executing from logstash, so 775 worked for me. It's a fairly secured system so I'm not worried: Finally, in logstash config, I start with
And if you'd like, here's my full logstash config file for sflow.
|
Thank you so much. This is exactly what I was looking for! |
Glad to have helped! |
so i've been looking into the sflow fields and im unning into a problem. I'm trying to get the following information and graph it in kibana. Im able to get the following information just find from the flow fields: However, I also want to have the bytes and packets for the flow and sflow only has the byte/packet field on the interface counters and not the flow counters. in netflow i would collect the following fields: IPV4_SRC_ADDR, L4_SRC_PORT, IPV4_DST_ADDR, L4_DST_PORT, IN_BYTES, IN_PKTS @message from elasticsearch FLOW,172.16.78.254,48,0,00141cd484a1,20b399ab5093,0x0800,5,0,10.20.0.31,172.16.78.64,6,0x00,126,445,49482,0x10,1522,1500,2048 CNTR,172.16.78.254,48,6,100000000,1,3,189641622348,400597923,20605593,22994,0,0,0,119063213814,391638219,1163290,58060,0,0,2 do you have any idea how i would be able to get something similar to the netflow using sflow? |
I'm pretty sure I have the same issue to be fair, but I haven't gotten around to investigating it. I feel like you could play with the wrapper script to pass some arguments to sflowtool to see if you can get that raw information. If logstash is stopped, you should be able to call sflowtool manually and it will dump it's captures to your screen. That should also help you to debug the raw information you're receiving. Check out http://www.inmon.com/technology/sflowTools.php for some more information on sflowtool arguments |
This might be somewhat informative also: http://blog.sflow.com/2011/12/sflowtool.html |
Could anyone assist with this one; When I attempt to run the command below, as outlined in the readme, I'm getting an error complaining about snmpwalk. I don't see any reference to needing it.
Connecting to Logstash: computer:6343 /opt/sflow/lib/sflow/collector.rb:63:in `rescue in start_collector': unable to start sflow collector (RuntimeError) from /opt/sflow/lib/sflow/collector.rb:42:in`start_collector' from ./bin/sflow.rb:7:in `' I'm using CentOS7, having installed the ELK stack (version 1.5) from elastic.co EDIT - Apologies.. I installed snmp utils, and this removed the snmp error above |
I'm having some issues getting the collector to run successfully. It looks like the code is being executed successfully because I can see that it establishes the logstash connection and opens the listening port via netstat. When running tcpdump on the second terminal I can also see that no packets are being sent from the sflow listener to logstash. The error below repeats indefinitely and the speed seems to be related to the expected flows, leading me to believe it is successfully receiving the packets, but just unable to process them successfully. I've gone back and ensured that eventmachine, yaml, and bindata are installed. Any other thoughts on what the issue may be? Thanks!
OS: CentOS 6.5
Ruby: ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-linux]
Logstash: logstash-1.4.2
TERMINAL 1
[root@HOST sflow]# bundle exec ./bin/sflow.rb
Connecting to Logstash: localhost:6543
Server listening.
2014-11-07 09:50:23 -0500
nil
undefined method
[]' for nil:NilClass /DIR/logstash-1.4.2/sflow/lib/sflow/parsers/parsers.rb:7:in
parse_packet'/DIR/logstash-1.4.2/sflow/lib/sflow/collector.rb:13:in
block in receive_data' /usr/local/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in
call'/usr/local/lib/ruby/gems/2.1.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:1037:in `block in spawn_threadpool'
2014-11-07 09:50:23 -0500
TERMINAL 2
[root@HOST sflow]# netstat -anup
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
udp 0 0 0.0.0.0:6543 0.0.0.0:* 32242/java
udp 0 0 127.0.0.1:57626 127.0.0.1:6543 ESTABLISHED 493/ruby
udp 0 0 0.0.0.0:6343 0.0.0.0:* 493/ruby
The text was updated successfully, but these errors were encountered: