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은 Package 내부에 구성된 파일들을 확인하는 용도로 사용
=====================================================
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를 입력합니다. (
기본값 X/ 미입력시 다시 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 사용 가능합니다. (기본값 X/ 미입력시 다시 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;
}