Server/모니터링 Zabbix NGINX 모니터링 하기





    이번 포스팅에서는 Zabbix NGINX 모니터링 설정 방법에 대해서 알아보도록 하겠습니다.




    서버 모니터링 관련 글 :


    오픈소스 서버 모니터링 툴 - http://server-talk.tistory.com/120


    이전 글 :


    Server/모니터링 Zabbix 알아보기 - https://server-talk.tistory.com/342


    Server/모니터링 Zabbix 설치 환경구축 - https://server-talk.tistory.com/343


    Server/모니터링 Zabbix 컴파일 설치 - https://server-talk.tistory.com/344


    Server/모니터링 Zabbix 웹사이트 설정 및 설치하기 - https://server-talk.tistory.com/345


    Server/모니터링 Zabbix 한글 설정하기 - https://server-talk.tistory.com/346


    Server/모니터링 Zabbix 웹사이트 계정설정 알아보기 - https://server-talk.tistory.com/347


    Server/모니터링 Zabbix 로컬호스트 모니터링 설정하기 - https://server-talk.tistory.com/348


    Server/모니터링 Zabbix 리눅스 서버 모니터링 설정하기 - https://server-talk.tistory.com/349







     NGINX 모니터링 설정하기




    1. NGINX http_stub_status_module 모듈 확인


    [root@zabbix zabbix]# /usr/local/nginx/sbin/nginx -V 2>&1 | grep -o with-http_stub_status_module
    with-http_stub_status_module
    


    NGINX http_stub_status_module 모듈이 설치되어 있는지 확인해야 되며, 설치가 되지 않았을 경우 다시 설치하셔야 됩니다




    2. NGINX 모니터링 설정


    [root@zabbix zabbix]# vi /usr/local/nginx/conf/nginx.conf
    . . . . .
    server {
            listen       [IP 입력]:80;
            server_name  [도메인 입력];
            root /data/zabbix/web;
    
            access_log  /usr/local/nginx/logs/zabbix.access.log;
            error_log   /usr/local/nginx/logs/zabbix.error.log;
    
            location / {
                    #include    /usr/local/nginx/conf/naxsi.rules;
                    error_log  /usr/local/nginx/logs/zabbix_naxsi_err.log;
                    index      index.php index.html index.htm;
            }
    
            error_page   404              /usr/local/nginx/html/50x.html;
    
            error_page   500 502 503 504  /usr/local/nginx/html/50x.html;
    
    	location = /basic_status {
    		stub_status;
    		allow 192.168.85.184;
    		deny all;
    	}
    }
    


    NGINX SERVER블록 안에 LOCATION 블록에 stub_tatus를 추가 합니다.


    location = /basic_status : 접속 URL 지정 입니다

    stub_status : NGINX 모니터링 모듈 활성화 설정 입니다

    allow [IP] : 특정 IP에게만 모니터링 설정하는 부분 입니다

    deny all : 허용된 IP 외에 접근 하지 못하다록 설정하는 부분 입니다.






    3. NGINX 모니터링 설정 확인




    브라우저를 접근하여 NGINX 상태 정보를 확인합니다.



    브라우저 상태 정보


    Active connections(총 연결) : 총 연결수를 의미합니다.

    server accepts handled requests :

    1) accepts : 허용 된 총 연결 수 입니다.

    2) handled : 총 처리된 연결 수 입니다.

    3) requests : 총 클라이언트 요청 수 입니다.

    Reading : 요청 헤더를 읽는 현재 연결 수 입니다

    Writing : 클라이언트에 응답을 다시 요청하는 현재 연결 수 입니다.

    Waitng : 현재 대기하고 있는 사용자 연결 수 입니다.







     Zabbix NGINX 호스트 추가하기





    상단 탭 설정 -> 호스트를 선택합니다.






    우측 상단에 호스트 작성을 선택합니다.






    그룹 항목에서 생성할 그룹명을 입력합니다.






    모니터링 하실 NGINX 서버의 이름과 IP를 입력하신 후 추가를 선택합니다.






    위에서 생성한 호스트가 추가된 것을 확인하실 수 있습니다.







     Zabbix NGINX 템플릿 추가하기






    위에서 추가한 서버의 호스트를 선택합니다.






    상단 탭에서 템플릿을 선택합니다.






    템플릿 탭에서 선택을 클릭합니다.






    Template App Nginx by Zabbix agent 항목을 체크하고 선택을 클릭합니다.






    추가한 템플릿을 반영하기 위한 갱신을 선택합니다






    추가한 템플릿이 호스트 항목에 추가된 것을 확인하실 수 있습니다.

    Posted by 서버이야기