[Nagios] Return code of 255 is out of bounds エラーが発生したら NRPE が起動していないのが原因

Nagios の監視対象で Return code of 255 is out of bounds エラーが返ってきたときは NRPE が起動していないことが原因であることが多いです。

Nagios | ナギオス

[前提] NRPE とは

NRPE (Nagios Remote Plugin Executer) は Nagios からリモートホストを監視するためのプラグインです。

リソース監視など監視対象ホストで任意のコマンドを実行する必要があるときに、監視対象ホストサーバーにインストールして使います。

NRPE を起動する

まず、Nagios のアラートが出ないようにするために NRPE を起動しましょう。

$ sudo /etc/init.d/nrpe start
Starting nrpe:                                             [  OK  ]
 
$ ps aux | grep nrpe
nrpe      1593  0.0  0.2  43576  1360 ?        Ss   05:15   0:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
ec2-user  1596  0.0  0.1 110284   848 pts/0    S+   05:15   0:00 grep nrpe

NRPE の自動起動設定 ON

次に NRPE の自動起動設定が有効になってないのがそもそもの問題だと思うので、chkconfig コマンドで有効にしておきます。

$ sudo chkconfig nrpe on
$ chkconfig --list nrpe
nrpe           	0:off	1:off	2:on	3:on	4:on	5:on	6:off

以上、NRPE を自動起動させて、無駄な Nagios の通知を受け取りたくない現場からお送りしました。