Nagios 4 : インストール2022/08/10 |
|
統合監視システム Nagios をインストールして設定します。
|
|
| [1] | |
| [2] |
こちらを参考に Apache httpd に SSL/TLS の設定を適用しておきます。(必須ではないが推奨)
|
| [3] | |
| [4] | Nagios をインストールします。 Nagios サーバ自身も監視できるよう基本的な監視項目用のプラグインもインストールします。 |
|
# EPEL からインストール [root@dlp ~]# dnf --enablerepo=epel -y install nagios nagios-plugins-{ping,disk,users,procs,load,swap,ssh,http}
|
| [5] | Nagios の設定です。 |
|
[root@dlp ~]#
vi /etc/httpd/conf.d/nagios.conf # 16-17行目 : 必要に応じてアクセス許可範囲を変更 ( 47-48行目も同様に変更 ) # Require all granted#Require host 127.0.0.1 Require ip 127.0.0.1 10.0.0.0/24
# 管理ユーザー登録 [root@dlp ~]# htpasswd /etc/nagios/passwd nagiosadmin New password: # パスワード設定 Re-type new password: Adding password for user nagiosadmin systemctl enable --now nagios [root@dlp ~]# systemctl restart httpd |
| [6] | SELinux を有効にしている場合は、ポリシーの変更が必要です。 |
|
# EPEL からインストール
[root@dlp ~]#
dnf --enablerepo=epel -y install nagios-selinux
[root@dlp ~]#
vi nagios-php.te # 以下の内容で新規作成
module nagios-php 1.0;
require {
type httpd_t;
type nagios_spool_t;
type ping_exec_t;
type nagios_unconfined_plugin_t;
class file { execute execute_no_trans map getattr open read };
class process setcap;
class icmp_socket { create getopt setopt };
class udp_socket { connect create getattr };
}
#============= nagios_unconfined_plugin_t ==============
allow nagios_unconfined_plugin_t ping_exec_t:file { execute execute_no_trans open read };
allow nagios_unconfined_plugin_t ping_exec_t:file map;
allow nagios_unconfined_plugin_t self:icmp_socket { create getopt setopt };
allow nagios_unconfined_plugin_t self:process setcap;
allow nagios_unconfined_plugin_t self:udp_socket { connect create getattr };
#============= httpd_t ==============
allow httpd_t nagios_spool_t:file { getattr open read };
checkmodule -m -M -o nagios-php.mod nagios-php.te [root@dlp ~]# semodule_package --outfile nagios-php.pp --module nagios-php.mod [root@dlp ~]# semodule -i nagios-php.pp |
| [7] | Firewalld を有効にしている場合は、HTTP サービスの許可が必要です。 |
|
[root@dlp ~]# firewall-cmd --add-service={http,https} success [root@dlp ~]# firewall-cmd --runtime-to-permanent success |
| [8] | Nagios サーバーの httpd でアクセス許可したネットワーク範囲内の任意のコンピューターから Webブラウザーを起動して [http://(Nagios サーバーのホスト名 または IP アドレス)/nagios/] にアクセスします。 認証を求められるので、登録した管理ユーザー [nagiosadmin] で認証します。 |
|
| [9] | 認証が成功すると Nagios のトップページが表示されます。 |
|
| [10] | 左メニューの [Tactical Overview] 等々をクリックすると監視データを閲覧することができます。 |
|
|
| Sponsored Link |
|
|