munin-plugins-rails icon indicating copy to clipboard operation
munin-plugins-rails copied to clipboard

tail: write error when run by node, not when run manually

Open clickworkorange opened this issue 14 years ago • 7 comments

When the plugin is run as normal I get: tail: write error failed executing request-log-analyzer. Is the path to the binary correct?

But "munin-run rails_requests" works fine. My first assumption was a permissions problem but that doesn't seem to be the case. I've tried running the plugin as root, www-data and a local user account - no change. Any ideas?

Thanks,

mikrogroove

clickworkorange avatar Aug 27 '10 02:08 clickworkorange

What does the debug output give you?

barttenbrinke avatar Aug 27 '10 11:08 barttenbrinke

Since I'm using RVM the default path for for request-log-analyzer needs to be changed, I do this in the plugin configuration:

env.request_log_analyzer '/usr/local/rvm/gems/ruby-1.9.2-head/bin/request-log-analyzer' command /usr/local/rvm/rubies/ruby-1.9.2-head/bin/ruby %c

But I can't do that when running the plugin in debug mode from the command line (it only accepts a log file path). Because of this I'm unable to provide debug output - though I suppose I could edit the plugin script and change the default path.

clickworkorange avatar Aug 27 '10 17:08 clickworkorange

Ok, here is the debug output:

/etc/munin/plugins/rails_redmine_requests debug '/var/rails/Redmine/log/production.log'

Processing the last 50000 lines of /var/rails/Redmine/log/production.log which are less then 300 seconds old.

"tail -n 50000 /var/rails/Redmine/log/production.log | /usr/local/rvm/gems/ruby-1.9.2-head/bin/request-log-analyzer - --after 20100827181909 -b --dump /tmp/rla_1282929600.yml 2>/dev/null"

get.value 0.26666666666666666 post.value 0.01 put.value 0.0 delete.value 0.0

Looks ok to me?

clickworkorange avatar Aug 27 '10 17:08 clickworkorange

FYI, here's the plugin configuration block:

[rails_redmine_requests]

env.log_file '/var/rails/Redmine/log/production.log' env.request_log_analyzer '/usr/local/rvm/gems/ruby-1.9.2-head/bin/request-log-analyzer' user root command /usr/local/rvm/rubies/ruby-1.9.2-head/bin/ruby %c

clickworkorange avatar Aug 27 '10 17:08 clickworkorange

That's really strange. Your config looks okay and as the debug output is working, I'm assuming RLA and the scripts are working, so the problem must lie elsewhere.

Are you sure you have the RLA gem installed in the 1.9.2 RVM environment you're using? Because it is TAIL who is giving a write error, which it'll probably do if the pipe is closed for some reason. This could be either RLA missing or that it is unable to write to /tmp/. What you could try is to replace "2>/dev/null" with " >> /tmp/rla_log.txt 2>&1" And checkout what is in the generated file.

Also make sure that there are no lingering files in /tmp/rla_*.

barttenbrinke avatar Aug 30 '10 09:08 barttenbrinke

I think this is because you used quotes in the names of the files. Try

env.log_file /var/rails/Redmine/log/production.log

instead of

env.log_file '/var/rails/Redmine/log/production.log'

ebertech avatar Mar 28 '11 20:03 ebertech

Mikrogroove, is it working for you? If so, please let me know so I can close this ticket.

barttenbrinke avatar May 25 '11 07:05 barttenbrinke