Ruby on rails 试图用nagios和nrpe监视rails应用程序的内部,但只得到;NRPE:无法读取输出“;

Ruby on rails 试图用nagios和nrpe监视rails应用程序的内部,但只得到;NRPE:无法读取输出“;,ruby-on-rails,ruby,monitoring,nagios,nrpe,Ruby On Rails,Ruby,Monitoring,Nagios,Nrpe,我试图用nagios和nrpe插件监视rails应用程序的内部,但只得到nrpe:cannot read output 这是我的监控机器代码“check_test.rb”脚本: #!/usr/bin/env ruby # load rails RAILS_ENV = 'production' require '/var/www/production/current/config/environment' error = 0 print "OK" exit error # exit wi

我试图用
nagios
nrpe
插件监视rails应用程序的内部,但只得到
nrpe:cannot read output

这是我的监控机器代码“check_test.rb”脚本:

#!/usr/bin/env ruby

# load rails

RAILS_ENV = 'production'
require '/var/www/production/current/config/environment'

error = 0

print "OK"

exit error # exit with the error code that is then interpreted by nagios
# load rails

RAILS_ENV = 'production'
require '/var/www/production/current/config/environment'
以下是我的监控主机呼叫:

$ sudo /usr/local/nagios/libexec/check_nrpe -H remote.machine.com -c check_test -t 240
如果删除下面的行,效果很好:

#!/usr/bin/env ruby

# load rails

RAILS_ENV = 'production'
require '/var/www/production/current/config/environment'

error = 0

print "OK"

exit error # exit with the error code that is then interpreted by nagios
# load rails

RAILS_ENV = 'production'
require '/var/www/production/current/config/environment'
任何帮助都将非常感激。
提前感谢。

我创建了一个包装器bash脚本,如下所示:


#!/bin/bash

cd/var/www/production/current/

RAILS\u ENV=production/usr/local/nagios/libexec/check\u test.rb——无提示

退出$


并从check_test.rb中删除RAILS_ENV语句,因为它已经声明到包装器脚本中

它现在运行良好:-DD


谢谢

另一个选项是:
cd/var/www/production/current/&script/railsrunner-e[ENVIRONMENT]“您的类。您的方法”