Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in riemann-net when new interfaces are added #112

Closed
md5 opened this issue Mar 23, 2015 · 1 comment · Fixed by #113
Closed

Error in riemann-net when new interfaces are added #112

md5 opened this issue Mar 23, 2015 · 1 comment · Fixed by #113

Comments

@md5
Copy link
Contributor

md5 commented Mar 23, 2015

On one of our hosts being monitored by riemann-net, we just ran into the following error after installing and starting Docker:

TypeError nil can't be coerced into Fixnum
/usr/lib/ruby/gems/2.1.0/gems/riemann-tools-0.1.8/bin/riemann-net:71:in `-'
/usr/lib/ruby/gems/2.1.0/gems/riemann-tools-0.1.8/bin/riemann-net:71:in `block in tick'
/usr/lib/ruby/gems/2.1.0/gems/riemann-tools-0.1.8/bin/riemann-net:70:in `each'
/usr/lib/ruby/gems/2.1.0/gems/riemann-tools-0.1.8/bin/riemann-net:70:in `tick'
/usr/lib/ruby/gems/2.1.0/gems/riemann-tools-0.1.8/lib/riemann/tools.rb:101:in `block in run'
/usr/lib/ruby/gems/2.1.0/gems/riemann-tools-0.1.8/lib/riemann/tools.rb:99:in `loop'
/usr/lib/ruby/gems/2.1.0/gems/riemann-tools-0.1.8/lib/riemann/tools.rb:99:in `run'
/usr/lib/ruby/gems/2.1.0/gems/riemann-tools-0.1.8/lib/riemann/tools.rb:11:in `run'
/usr/lib/ruby/gems/2.1.0/gems/riemann-tools-0.1.8/bin/riemann-net:101:in `<top (required)>'
/usr/local/bin/riemann-net:23:in `load'
/usr/local/bin/riemann-net:23:in `<main>'

Looking at line 71 of that script as it was in version 0.1.8, it looks like the issue is that there is no check to see if a service is actually a key in @old_state before trying to calculate delta. When a new interface is added (e.g. the veth* or docker0 interfaces added when Docker is started), then the list of services in state has keys that aren't in @old_state, leading to the error we saw.

This same code is still in the riemann-net script on master. It looks like an easy fix would be to skip reporting for all services where @old_state.has_key? service is false.

@md5
Copy link
Contributor Author

md5 commented Mar 23, 2015

I was also wondering why the "drops" and "errs" checks are checking metric > 0 instead of delta > 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant