munin-plugins-rails
munin-plugins-rails copied to clipboard
tail: write error when run by node, not when run manually
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
What does the debug output give you?
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.
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?
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
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_*.
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'
Mikrogroove, is it working for you? If so, please let me know so I can close this ticket.