nginx - 3.0.10以上
▶ [必須][exem-nginx-module] インストール準備
❶ パッケージインストール時の注意事項
- 必ずインストール前にnginxのバージョンを確認します。
nginx -Vコマンドでバージョン確認時のconfigure arguments設定による注意事項 --with-compatが確認できない場合はカスタムビルドが必要 --with-http_stub_status_moduleが確認できない場合はmetric指標が収集されず0として表示される
nginx -V
- Linux & Alpine Linux環境のnginxをサポートしており、インストールする環境のnginxバージョンを正確に確認する必要があります。(詳細なnginxサポートバージョンは紹介文書を参照)
❷ インストールファイルの準備
- パッケージファイルは
setup_exem-nginx-module_${VERSION}.binのインストールファイルとして配布され、インストールする経路で実行します。
▶ [必須][exem-nginx-module] インストール
❶ exem-nginx-moduleインストール
インストールするターゲットnginxバージョンを確認します。(
nginx -V)パッケージインストールを行う経路でインストールファイルを実行し、installを選択します。(エンター入力時install)
Unpackはパッケージ内部に構成されたファイルを確認する用途で使用
=====================================================
EXEM NGINX Module Setup
=====================================================
Choose work number (default: 1)
1. install(default)
2. unpack
3. exit
:
- インストールするターゲットnginxバージョンを入力します。
=====================================================
exem-nginx-module v3.0.10(4b7652a) Install on linux 3.10
=====================================================
NGINX supported version:
> 1.14.1 1.14.2 1.16.1 1.18.0 1.20.1 1.24.0 1.25.0 1.27.0 1.28.0 1.28.2 1.29.0 1.29.1 1.29.2 1.29.3
Install Nginx Version [version|all]: 1.28.2
- インストールディレクトリを入力します。( エンター入力時デフォルト経路にインストール )
Enter INSTALL_DIRECTORY [/path/to/nginx-module]:
- 通信するexem-webserver-agentのIPを入力します。(
デフォルト値なし/ 未入力時は再度IP入力を求めるプロンプトが表示 )
Enter exem-webserver-agent CONNECT_IP:
- 通信するexem-webserver-agentのPortを入力します。( エンター入力時デフォルト値
12848を適用 )
Enter exem-webserver-agent CONNECT_PORT [12848]:
- モジュールのGroup IDを登録します。( エンター入力時デフォルト値
defaultを適用 )
Enter GROUP_ID [default]:
- webserverモニタリング対象として登録される名前を入力します。( エンター入力時デフォルト値サーバーのHostNameを適用 )
Enter MODULE_NAME [t41a]:
- exem-host-agentとマッピングするBIDを入力します。( エンター入力時デフォルト値サーバーのHostNameを適用 )
Enter EXEMBID with exem-host-agent [t41a]:
- agent ↔ module間で使用されるunique idを固定するかを選択します。オンプレミス環境では一般的にエンターを押してデフォルトで固定します。( エンター入力時デフォルト値
yを適用 )
Fix UNIQUE_ID [yes(default)/no]:
- nginx exemone metric(/exem/v1/metrics)の収集可否を選択します。( エンター入力時デフォルト値
yを適用 ) y入力時、以下のMETRIC_PORT、METRIC_IPを追加入力します。n入力時はmetric設定のための追加入力なしでインストールが完了します。
Collect exemone metric? [Y(default)/n]:
- nginx exemone metric収集を
yにした場合 exem-webserver-agentがnginxのmetricを収集するために接続するPortを入力します。( エンター入力時デフォルト値12849を適用 ) - exem-webserver-agentがnginxにrequestするエンドポイントであるため、使用時はwebserverのlistenポート(ex:12849)のファイアウォールを確認する必要があります。
Enter METRIC_PORT [12849]:
- nginx exemone metric収集を
yにした場合 nginxがインストールされたサーバーのIPを入力します。exem-webserver-agentはこのIPでmetricをリクエストします。ただし、同じサーバーにexem-webserver-agentがインストールされている場合は127.0.0.1を使用可能です。(デフォルト値なし/ 未入力時は再度IP入力を求めるプロンプトが表示 )
Enter METRIC_IP (IP of this server where nginx is installed): 10.20.30.40
- インストール完了文言の確認(設定適用値)
=====================================================
Installation completed
=====================================================
INSTALL_NGINX_VERSION [1.28.2]
INSTALL_DIRECTORY [/path/to/nginx-module]
CONNECT_IP [<webserver agent ip>]
CONNECT_PORT [12848]
GROUP_ID [default]
MODULE_NAME [t41a]
EXEMBID [t41a]
Generated UNIQUE_ID [f2032866-test-test-test-e086125f8481]
EXEM_METRIC_COLLECT [yes]
METRIC_PORT [12849]
METRIC_IP [<nginx ip>]
=====================================================
Copy tools from linux/mdl-ver
Copy tools from linux/xm-uuidgen
Copy module file from linux/ngx_http_exem_module_1.28.2.so
=====================================================
+--> Add the following line to 'nginx.conf' >--+
load_module "/path/to/nginx-module/modules/ngx_http_exem_module_1.28.2.so";
http {
include /path/to/nginx-module/conf/exem_ngx_mod.conf;
}
Add the following line to 'nginx.conf'以降に表示された内容を、以下の内容を参考にnginx.confに追加
❷ nginx.conf設定
- nginx.confファイル経路の確認
nginx -t
- configuration file出力値でnginx.confファイル経路を確認
- nginx.confファイルを開いてインストール完了時に出力されたload_moduleとInclude設定を追加
load_module "/path/to/nginx-module/modules/ngx_http_exem_module_1.28.2.so";
http {
include /path/to/nginx-module/conf/exem_ngx_mod.conf;
}
httpdモジュールと異なり、load_moduleディレクティブを追加する必要があります。
❸ インストールバージョンの確認
- インストール後に生成されたnginx-moduleフォルダの
pkg_version.shを実行すると、インストールされたexem-nginx-moduleのバージョン情報を確認可能
$ /path/to/nginx-module/pkg_version.sh
exemONE exem-nginx-module v3.0.10(4b7652a)
▶ [exem-nginx-module]のexem_ngx_mod.conf設定ファイル
- インストール時に入力した設定値で自動生成される設定ファイルの構造は以下の通りです。(例)
上記のインストール過程でnginx exemone metric収集を
nにした場合は 以下のserverブロックがコメントになっています。 詳細な内容は3. 設定を参照します。
[예시]
############################################
### EXEM Nginx Module Configuration File ###
exem_group_id default;
exem_unique_id {UUID};
# module name (default: hostname)
exem_module_name <input module_name>;
# EXEMBID with exem-host-agent
exem_bid <input host BID>;
# connection ip to exem-webserver-agent (default ip:<webserver agent ip>, port:12848)
exem_connect_ip <webserver agent ip>;
exem_connect_port 12848;
# log path
exem_log_path /path/to/nginx-module/log/exem_ngx_mod.log;
# log level (default:none)
exem_log_level info;
# skip collect exem metrics (default:true)
#exem_skip_metrics_req true;
# metrics configuration (default: <nginx ip>:12849/exem/v1/metrics)
server {
listen 12849;
server_name <nginx ip>;
location /exem/v1/metrics {
stub_status_exem;
}
}
▶ [便利な機能][exem-nginx-module] 簡易インストール
❶ Defaultオプションでインストール
--defaultオプションを使用して<ip>:<port>:<nginx version>バージョン入力時、group idをdefaultに設定し、残りはデフォルト設定で入力なしでインストールが可能です。
--defaultオプションを使用するとExEmBID設定はhostnameに自動設定されます。--helpオプションを使用するとサポート可能なnginxバージョン一覧を確認できます。--metricオプションを使用するとnginx exemone metric収集のためのMETRIC_PORT、METRIC_IPを設定できます。
--helpオプションでサポート可能なnginxバージョン一覧を確認
$ ./setup_exem-nginx-module_3.0.10.bin --help
nginx supported version:
> 1.14.1 1.14.2 1.16.1 1.18.0 1.20.1 1.24.0 1.25.0 1.27.0 1.28.0 1.28.2 1.29.0 1.29.1 1.29.2 1.29.3
options :
--help help
--silent-sample make sample silent setup file
--silent=<file> install with silent setup file
--default=<ip>:<port>:<nginx version> install with default settings
--metric=<ip>:<port> enable metric collection (use with --default)
--default <ip>:<port>:<nginx version> --metric=<ip>:<port>オプションで一行インストール- [ 参考 ]
--metric=<ip>:<port>オプションを設定しない場合、metric収集設定はOFFになります。
- [ 参考 ]
$ ./setup_exem-nginx-module_3.0.10.bin --default=10.20.30.40:12848:1.28.2 --metric=10.20.30.40:12849
=====================================================
EXEM NGINX Module Setup
=====================================================
SETUP TYPE[install]
unpack nginx modules
LOG_PATH[./setup_exem-nginx-module_3.0.10.log]
=====================================================
exem-nginx-module v3.0.10(4b7652a) Install on linux 3.10
=====================================================
NGINX supported version:
> 1.14.1 1.14.2 1.16.1 1.18.0 1.20.1 1.24.0 1.25.0 1.27.0 1.28.0 1.28.2 1.29.0 1.29.1 1.29.2 1.29.3
=====================================================
Installation completed
=====================================================
INSTALL_NGINX_VERSION [1.28.2]
INSTALL_DIRECTORY [/root/nginx-module]
CONNECT_IP [10.20.30.40]
CONNECT_PORT [12848]
GROUP_ID [default]
MODULE_NAME [test]
EXEMBID [test]
Generated UNIQUE_ID [9899cd10-test-test-test-c80f516a1147]
EXEM_METRIC_COLLECT [yes]
METRIC_PORT [12849]
METRIC_IP [10.20.30.40]
=====================================================
Copy tools from linux/mdl-ver
Copy tools from linux/xm-uuidgen
Copy module file from linux/ngx_http_exem_module_1.28.2.so
=====================================================
+--> Add the following line to 'nginx.conf' >--+
load_module "/root/nginx-module/modules/ngx_http_exem_module_1.28.2.so";
http {
include /root/nginx-module/conf/exem_ngx_mod.conf;
}
❷ Silentオプションでインストール
silent設定ファイルを通じてインストール過程で入力なしでインストールが可能です。sampleファイル生成
$ ./setup_exem-nginx-module_3.0.10.bin --silent-sample
make sample silent setup file
- sampleファイルの確認及び必要な設定の作成
$ cat setup_sample.silent
SETUP_TYPE=install
INSTALL_NGINX_VERSION=
INSTALL_DIR=/root/nginx-module
GROUP_ID=default
#MODULE_NAME=
FIX_UNIQUE_ID=yes
#EXEM_BID=
EXEM_METRIC_COLLECT=yes
METRIC_PORT=12849
#METRIC_IP=<nginx ip>
#EXEM_CONNECT_IP=<webserver agent ip>
#EXEM_CONNECT_PORT=12848
- slient設定ファイルを通じてインストール
$ ./setup_exem-nginx-module_3.0.10.bin --silent=setup_sample.silent
=====================================================
EXEM NGINX Module Setup
=====================================================
SETUP TYPE[install]
unpack nginx modules
LOG_PATH[./setup_exem-nginx-module_3.0.10.log]
=====================================================
exem-nginx-module v3.0.10(4b7652a) Install on linux 3.10
=====================================================
NGINX supported version:
> 1.14.1 1.14.2 1.16.1 1.18.0 1.20.1 1.24.0 1.25.0 1.27.0 1.28.0 1.28.2 1.29.0 1.29.1 1.29.2 1.29.3
=====================================================
Installation completed
=====================================================
INSTALL_NGINX_VERSION [1.28.2]
INSTALL_DIRECTORY [/root/nginx-module]
CONNECT_IP [10.20.30.40]
CONNECT_PORT [12848]
GROUP_ID [default]
MODULE_NAME [test]
EXEMBID [test]
Generated UNIQUE_ID [b66f10d5-test-test-test-fadc773128a0]
EXEM_METRIC_COLLECT [yes]
METRIC_PORT [12849]
METRIC_IP [10.20.30.40]
=====================================================
Copy tools from linux/mdl-ver
Copy tools from linux/xm-uuidgen
Copy module file from linux/ngx_http_exem_module_1.28.2.so
=====================================================
+--> Add the following line to 'nginx.conf' >--+
load_module "/root/nginx-module/modules/ngx_http_exem_module_1.28.2.so";
http {
include /root/nginx-module/conf/exem_ngx_mod.conf;
}