본문으로 건너뛰기

nginx-_3.0.9.3이하

1. 패키지 설치 시 주의사항

반드시 설치 전 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 의 설치 파일로 배포되며 설치할 경로에서 실행합니다. 

1.1 설치 방법

  • 설치할 타겟 nginx 버전을 확인합니다. ( nginx -V )

  • 패키지 설치를 진행할 경로에서 설치파일을 실행하고 install을 선택합니다. (엔터 입력 시 install)

정보

Unpack은 Package 내부에 구성된 파일들을 확인하는 용도로 사용

=====================================================
EXEM NGINX Module Setup
=====================================================
choise work
1. unpack
2. install(default)
:
  • 설치할 타겟 nginx 버전을 입력합니다. 
=====================================================
exem-nginx-module v3.0.9.3(3563ebd) 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.29.0 1.29.1 1.29.2 1.29.3
Install Nginx Version(version|all):

  • 설치 디렉토리를 입력합니다. (엔터 입력 시 기본 경로에 설치)
Install Directory (/path/to/nginx-module):
  • 모듈이 사용할 설정 파일 이름을 입력합니다. (엔터 입력 시 기본 값 exem_ngx_mod.conf 적용)
nginx module config filename(exem_ngx_mod.conf): 
  • agent ↔ module 간 사용 될 unique id를 고정할 지 선택합니다. 온프레미스 환경에서는 일반적으로 엔터를 눌러 기본으로 고정합니다. (엔터 입력 시 기본 값 yes 적용)
(optional)Do you want to fix the 'unique id'?[yes(default)/no]: 
  • 모듈의 Group ID를 등록합니다. (엔터 입력 시 기본 값 default 적용)
Group ID to register(default):
  • webserver 모니터링 대상으로 등록 될 이름을 입력합니다. (엔터 입력 시 기본 값 서버의 HostName 적용)
(optional)Module Name to register(t41a):
  • 설치 완료 문구 확인 (설정 적용 값)
Install Directory [/nginx-module] 
Group ID [default]
Module Name [no input]
Generated Unique ID [028535dc-test-test-test-2a0a3a5fcfde]
=====================================================
Copy tools from linux/xm-uuidgen
Copy tools from linux/mdl-ver
Copy module file from linux/ngx_http_exem_module_1.25.0.so

+--> Add the following line to 'nginx.conf' >--+
load_module "/nginx-module/modules/ngx_http_exem_module_1.25.0.so";
http {
include /nginx-module/conf/exem_ngx_mod.conf;
}

Add the following line to 'nginx.conf' 이후에 나온 내용을 아래 내용 참고하여 nginx.conf 에 추가

1.2 nginx.conf 설정

  • nginx.conf 파일 경로 확인
nginx -t
  • configuration file 출력 값으로 nginx.conf 파일 경로 확인
  • nginx.conf 파일을 열어서 설치 완료 시 출력된 load_module과 Include 설정을 추가
load_module "/nginx-module/modules/ngx_http_exem_module_1.25.0.so";

http {
include /nginx-module/conf/exem_ngx_mod.conf;
}
정보

httpd 모듈과 달리 load_module 지시자를 추가해야합니다. 

2. 설정 파일 (exem_ngx_mod.conf)

설치 시 자동 생성되는 설정 파일의 구조는 다음과 같습니다. (예시).

############################################
### EXEM Nginx Module Configuration File ###

exem_group_id default;
exem_unique_id {UUID};

# module name(defult: hostname)
#exem_module_name <input module_name>;

# EXEMBID with host agent
#exem_bid <input host bid>;

# log path (default:logs/exem_ngx_mod.log)
#exem_log_path logs/exem_ngx_mod.log;
# log level (default:none)
#exem_log_level debug;

# connection ip to agent (default:127.0.0.1)
#exem_connect_ip 127.0.0.1;

# connection ip to agent (default:12848)
#exem_connect_port 12848;

# skip collect exem metrics (default:true)
#exem_skip_metrics_req true;

# metrics configuration (default: 127.0.0.1:12849/exem/v1/metrics)
#server {
# listen 12849;
# server_name 127.0.0.1;
# location /exem/v1/metrics {
# stub_status_exem;
# }
#}

[필수] 수동 설정해야 할 옵션

  • exem-webserver-agent와 통신할 IP, Port 설정

    • 통신할 exem-webserver-agent의 ip, port는 exem_ngx_mod.conf 파일을 통해 직접 수정 합니다.
      • 통신할 exem-webserver-agent의 IP를 입력합니다. 
      [ 예시 ]
      # connection ip to agent (default:127.0.0.1)
      exem_connect_ip 10.10.10.10;
      • 통신할 exem-webserver-agent의 Port를 입력합니다. 
      [ 예시 ]
      # connection ip to agent (default:12848)
      exem_connect_port 12848;
  • exem-nginx-module의 log 폴더 설정

    • exem-nginx-modulelog 폴더를 생성하고 반드시 exem_ngx_mod.conf 파일을 통해 직접 log path를 설정해야합니다. (log 폴더가 없을 경우 nginx가 동작하지 않을 수 있다. 추후 httpd module 처럼 개선할 예정)
      • Install Directory로 설정한 경로에 log 폴더를 생성합니다.
      [ 예시 ]
      root@e0aaf4628fec:/nginx-module# pwd
      /path/to/nginx-module
      root@e0aaf4628fec:/nginx-module# mkdir log
      root@e0aaf4628fec:/nginx-module# ls
      conf log modules tools
      • 절대경로로 로그 파일명까지 포함하여 exem_log_path로 설정합니다.
      [ 예시 ]
      # log path (default:logs/exem_ngx_mod.log)
      exem_log_path /path/to/nginx-module/log/exem_ngx_mod.log;

[옵션] nginx metric을 수집하고 싶을 경우 설정해야 할 옵션

  • metric을 수집하고 싶다면 server 블럭의 주석을 해제하고 아래 예시를 참고하여 설정합니다.
  • listen에는 webserver agent에서 metric 수집에 필요한 연결 port를 입력합니다.
  • server_name 에는 nginx가 설치된 서버 자신의 IP를 입력합니다
[ 예시 ]
# metrics configuration (default: 127.0.0.1:12849/exem/v1/metrics)
server {
listen 12849;
server_name 10.20.30.40;
location /exem/v1/metrics {
stub_status_exem;
}
}
  • 위의 설정을 통해 exem-webserver-agent가 nginx에 request하는 엔드포인트이기 때문에 사용 시 webserver의 listen 포트(ex:12849)의 방화벽을 확인해야합니다.