Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

This check parses the information provided by the NGINX stub status module. If you have enabled that module, then the URL /nginx_status shows interesting information about the inner state of the web server when accessed from localhost. The agent plugin nginx_status fetches these information and processes it.

Step-by-step guide

After installing and configuring nginx you can follow this steps to monitor Nginx status.

  1. Nginx stub status module

    Make sure that the server process is configured with the stub status module. Use the command:

    root@klappanas:~# nginx -V 2>&1 | grep -o with-http_stub_status_module   
    with-http_stub_status_module

    If stub status module is not installed, you can follow this guide for the installation: https://www.tecmint.com/enable-nginx-status-page/

  2. Add a new server block configuration inside /etc/nginx/sites-enabled/default

    /etc/nginx/sites-enabled/default
    server {
            listen 8081;
            listen [::]:8081;
    
            server_name _;
    
            root /var/www/html;
            index index.html;
    
            location /nginx_status
    {
                    stub_status on;
                    access_log off;
                    allow 127.0.0.1;
                    deny all;
    
            }
    }
  3. restart nginx service

    systemctl restart nginx
  4. Now the Url 127.0.0.1:8081/nginx_status should be available

    wget -qO - http://127.0.0.1:8081/nginx_status
    Active connections: 1 
    server accepts handled requests
     1 1 1 
    Reading: 0 Writing: 1 Waiting: 0 
  5. Configure nginx_status

    1. manually
    2. via Bakery
MK_CONFDIR=/etc/check_mk /usr/lib/check_mk_agent/plugins/nginx_status 

<<<nginx_status>>>
127.0.0.1 8081 Active connections: 1 
127.0.0.1 8081 server accepts handled requests
127.0.0.1 8081  380 380 380 
127.0.0.1 8081 Reading: 0 Writing: 1 Waiting: 0 


Debugging

Port Checking

root@klappanas:~# netstat -tulpen |grep 8081
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN      0          43044      1353/nginx: master  
tcp6       0      0 :::8081                 :::*                    LISTEN      0          43045      1353/nginx: master  


Nginx Service

root@klappanas:~# systemctl status nginx

Stub status module

root@klappanas:~# nginx -V 2>&1 | grep -o with-http_stub_status_module   
with-http_stub_status_module


Checking the status page

root@klappanas:~# wget -qO - http://127.0.0.1:8081/nginx_status
Active connections: 1 
server accepts handled requests
 398 398 398 
Reading: 0 Writing: 1 Waiting: 0



  • No labels