Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Nginx stub status module

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

    Code Block
    linenumberstrue
    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

    Code Block
    title/etc/nginx/sites-enabled/default
    linenumberstrue
    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

    Code Block
    linenumberstrue
    systemctl restart nginx


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

    Code Block
    linenumberstrue
    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
      you need to install the agent plugin nginx_status into your agent's plugins directory (usually /usr/lib/check_mk_agent/plugins). The plugin tries to autodetect all running NGINX servers. If that fails for some reason you need to create the configuration file /etc/check_mk/nginx_status.cfg. Here is one example:

      Code Block
      linenumberstrue
      servers = [{'address': '127.0.0.1',
        'page': 'nginx_status',
        'port': 8081,
        'protocol': 'http'}]


    2. via Bakery
      WATO - CONFIGURATION → Monitoring Agents → Rules → NGINX webservers (Linux)

      1. Autodetect instances, expect HTTPS on the following ports: nginx_status will try autodetect all running NGINX servers.

      2. Specific list of instances: You can specify NGINX instances

  6. Test the plugin

    :

Now you can execute the plugin manually and see if it works:

...