第4章 Nagios Core サーバーでのリモートノードの設定
Nagios Core サーバーを設定して、リモートホストを認識させます。
前提条件
- Nagios Core サーバー上のリモートノードへの root レベルのアクセス。
- インターネットアクセス。
手順
check_nrpeプラグインをインストールします。例
[root@nagios ~]# cd ~ [root@nagios ~]# wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe-4.0.3/nrpe-4.0.3.tar.gz [root@nagios ~]# tar xvfz nrpe-4.0.3.tar.gz [root@nagios ~]# cd nrpe-4.0.3 [root@nagios nrpe-4.0.3]# ./configure [root@nagios nrpe-4.0.3]# make check_nrpe [root@nagios nrpe-4.0.3]# make install-pluginリモートホストの設定を作成します。
構文
cd /usr/local/nagios/etc/objects cp localhost.cfg HOST_TO_ADD.cfg例
[root@nagios nrpe-4.0.3]# cd /usr/local/nagios/etc/objects [root@nagios objects]# cp localhost.cfg host01.cfg設定ファイルを編集し、リモートホストの設定を更新します。
構文
vi HOST_TO_ADD.cfg例
[root@nagios objects]# vi host01.cfg構文
# Define a host for the local machine define host { use linux-server ; Name of host template to use ; This host definition will inherit all variables that are defined ; in (or inherited by) the linux-server host template definition. host_name LOCALHOST alias LOCALHOST address 127.0.0.1 }LOCALHOST をリモートホストのホスト名に、
127.0.0.1を Ceph Monitor ホストの IP アドレスに置き換えてください。例
# Define a host for the local machine define host { use linux-server ; Name of host template to use ; This host definition will inherit all variables that are defined ; in (or inherited by) the linux-server host template definition. host_name host01 alias host01 address 10.10.128.69 }ホストグループの定義を削除またはコメントアウトします。
例
[root@nagios objects]# vi host01.cfg#define hostgroup { # # hostgroup_name linux-servers ; The name of the hostgroup # alias Linux Servers ; Long name of the group # members localhost ; Comma separated list of hosts that belong to this group #}ファイルの所有者を Nagios に変更します。
例
[root@nagios objects]# chown nagios:nagios host01.cfg/usr/local/nagios/etc/nagios.cfgのhost01.cfgファイルにcfg_file=の参照を追加します。例
[root@nagios objects]# vi /usr/local/nagios/etc/nagios.cfgcfg_file=/usr/local/nagios/etc/objects/host01.cfgNagios サーバーを再起動します。
例
[root@nagios objects]# systemctl restart nagios作成およびインストール手順が機能し、Nagios Core サーバーと NRPE が含まれるリモートホストとの間に接続性があることを確認します。
構文
/usr/local/nagios/libexec/check_nrpe -H HOSTNAME_OF_REMOTE_HOSTHOSTNAME_OF_REMOTE_HOST を、監視する Ceph ホストの IP アドレスに置き換えてください。
例
[root@nagios objects]# /usr/local/nagios/libexec/check_nrpe -H host01
検証
-
正しく機能している場合は、このチェックにより
NRPE v4.0.3が表示されるはずです。