0

nagiosとプラグインを使用してレールアプリケーションの内部を監視しようとしていnrpeますが、取得するだけですNRPE: Unable to 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

これが私の監視ホストの呼び出しです。

$ sudo /usr/local/nagios/libexec/check_nrpe -H remote.machine.com -c check_test -t 240

以下の行を削除すると、正常に動作します。

# load rails

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

どんな助けでも大歓迎です。前もって感謝します。

4

1 に答える 1

1

次のようにラッパーbashスクリプトを作成しました。


#!/ビン/バッシュ

cd /var/www/production/current/

RAILS_ENV=プロダクション /usr/local/nagios/libexec/check_test.rb --silent

$ を終了しますか?


RAILS_ENV ステートメントは既にラッパー スクリプトに宣言されているため、check_test.rb から削除しました。

現在は正常に動作しています:-DD

ありがとう!

于 2012-07-11T22:51:39.077 に答える