この投稿では、インフラストラクチャ全体を1か所で監視するIcinga2のウェブインターフェースであるIcingaweb2のインストールについて説明します。
記事シリーズ
1 : CentOS 7 /RHEL7にIcinga2をインストールする方法
2 : CentOS 7 /RHEL7でIcingaWeb2をセットアップする方法
3 :リモートLinuxマシンをIcinga2監視ツールに追加する方法
このガイドでは、Icinga Web2を使用してIcinga2をセットアップする方法について説明します。Icingaweb2は、オペレーティングシステムに応じて、公式リポジトリを使用するか、ソースからインストールできます。
要件
- ApacheやNginxなどのウェブサーバー
- PHP 5.6.0以降、cURL、gettext、intl、mbstring、OpenSSL、およびXMLをサポート。
- LDAPまたはActiveDirectory認証を使用する場合のPHPLDAPライブラリ。
- MySQLまたはPostgreSQL用のPHPライブラリ
PHPおよびPHP拡張機能のインストール
要件で述べたように、IcingaWeb2にはPHPバージョン5.6以降が必要です。 Icinga web 2に必要なPHPバージョンは、CentOS/Redhatベースリポジトリで利用可能なものよりも高くなっています。そのため、CentOSとRHELでそれぞれSCLリポジトリとrhel-server-rhscl-7-rpmsリポジトリを有効にする必要があります。
### CentOS 7 ### yum install -y centos-release-scl ### RHEL 7 ### subscription-manager repos --enable rhel-7-server-optional-rpms subscription-manager repos --enable rhel-server-rhscl-7-rpms
IcingaWeb2用のPHPパッケージと拡張機能をインストールします。
### CentOS 7 ### yum -y install rh-php71-php-json rh-php71-php-pgsql rh-php71-php-xml rh-php71-php-intl rh-php71-php-common rh-php71-php-pdo rh-php71-php-mysqlnd rh-php71-php-cli rh-php71-php-mbstring rh-php71-php-fpm rh-php71-php-gd rh-php71-php-zip rh-php71-php-ldap rh-php71-php-imagick ### RHEL 7 ### yum -y install rh-php71-php-json rh-php71-php-pgsql rh-php71-php-xml rh-php71-php-intl rh-php71-php-common rh-php71-php-pdo rh-php71-php-mysqlnd rh-php71-php-cli rh-php71-php-mbstring rh-php71-php-fpm rh-php71-php-gd rh-php71-php-zip rh-php71-php-ldap
php.iniファイルでタイムゾーンを設定します。
vi /etc/opt/rh/rh-php71/php.ini
以下の行を探して、タイムゾーンで更新してください。
date.timezone = US/Central
PHP-FPMサービスを再起動します。
systemctl restart rh-php71-php-fpm
PHP-FPMサービスがシステムの起動時に自動的に開始されるようにします。
systemctl enable rh-php71-php-fpm
Icinga2リポジトリを追加
まだ設定していない場合に備えて、システムにIcinga2リポジトリを追加します。
rpm --import https://packages.icinga.com/icinga.key yum install https://packages.icinga.com/epel/icinga-rpm-release-7-latest.noarch.rpm
IcingaWeb2をインストールする
yumコマンドを使用します CentOS / RHELで、IcingaCLIおよびApacheWebサーバーとともにIcingaWeb2パッケージをインストールします。
yum -y install icingaweb2 icingacli httpd
システムの起動時にApacheサービスが自動的に開始するようにします。
systemctl enable httpd
SELinux
SELinuxを有効にしてIcingaWeb2を実行している場合は、以下のパッケージをインストールしてIcingaWeb2のポリシーを設定することを検討してください。
yum -y install icingaweb2-selinux
ファイアウォール
以下のコマンドを実行して、HTTPトラフィックが外部マシンからIcingaWeb2にアクセスできるようにします。
firewall-cmd --permanent --add-service=http firewall-cmd --reload
IcingaWeb2セットアップの準備
Icinga CLIは、コマンドラインで管理タスクを実行するために使用されます。 Icinga Web 2とCLIの両方が、ログと構成にアクセスできる必要があります。 Webサーバーユーザーを追加します(Apacheをシステムグループ(icingaweb2)に追加します
groupadd -r icingaweb2 usermod -a -G icingaweb2 apache
IcingaWeb2構成ディレクトリを作成します。
icingacli setup config directory --group icingaweb2
ApacheとPHP-FPMサービスの両方を再起動します。
systemctl restart httpd systemctl restart rh-php71-php-fpm
IcingaWeb2セットアップウィザード
初めてIcingaWeb2にアクセスするときは、IcingaWebセットアップウィザードがIcingaWeb2のインストールを成功させるためのすべての手順をガイドします。
http://your.ip.addr.ess/icingaweb2/setupセキュリティ上の理由から、IcingaWeb2インストール用のトークンを生成する必要があります。
次のコマンドを使用してトークンを生成します。
icingacli setup token create
出力:
The newly generated setup token is: 04fa4ea1baf4f0b9
生成されたトークンをコピーしてセットアップページに貼り付け、[次へ]をクリックします 。
![](https://m.unixlinux.online/article/uploadfiles/202204/2022042710304089.jpg)