Hello, How can i monitor nginx web-server (linux)? I need a sensor like "Windows IIS Application sensor".


Article Comments

Have you seen this KB article already? https://helpdesk.paessler.com/en/support/solutions/articles/60186

It describes monitoring NGiNX with a custom exe sensor :)


May, 2014 - Permalink

Hi MAA,

I have been monitoring nginx with the status page for some time, but have had to patch the source code to make it PRTG compatible. See the patch below, then use a HTTP Content sensor with 6 channels.

--- src/http/modules/ngx_http_stub_status_module.c      2013-05-06 11:26:50.000000000 +0100
+++ src/http/modules/ngx_http_stub_status_module.cmh    2013-06-14 14:51:05.303729784 +0100
@@ -131,14 +131,14 @@
     wr = *ngx_stat_writing;
     wa = *ngx_stat_waiting;

-    b->last = ngx_sprintf(b->last, "Active connections: %uA \n", ac);
+    b->last = ngx_sprintf(b->last, "Active connections: [%uA] \n", ac);

     b->last = ngx_cpymem(b->last, "server accepts handled requests\n",
                          sizeof("server accepts handled requests\n") - 1);

-    b->last = ngx_sprintf(b->last, " %uA %uA %uA \n", ap, hn, rq);
+    b->last = ngx_sprintf(b->last, " [%uA] [%uA] [%uA] \n", ap, hn, rq);

-    b->last = ngx_sprintf(b->last, "Reading: %uA Writing: %uA Waiting: %uA \n",
+    b->last = ngx_sprintf(b->last, "Reading: [%uA] Writing: [%uA] Waiting: [%uA] \n",
                           rd, wr, wa);

     r->headers_out.status = NGX_HTTP_OK;

May, 2014 - Permalink

If you're merely interested in recording the connection information from the status page, you can use the embedded variables that the status module exposes, and format them for consumption by the HTTP Content sensor directly in the NGINX configuration:

location /prtg {
    return 200 [$connections_active][$connections_reading][$connections_writing][$connections_waiting];
    access_log off;
    allow x.x.x.x/y;
    deny all;
}

Reference: https://nginx.org/en/docs/http/ngx_http_stub_status_module.html


Jun, 2018 - Permalink

The HTTP Content sensor option provided by above worked perfectly. Thanks!

Note: for reference, and common sense would prevail on this, when creating the sensor increase the # channels to 4 corresponding with the # of embedded variables. Additionally, after creating the sensor, edited the channel names to reflect the variables. Channel ID #'s in order of listing order in NGiNX config from above.


Apr, 2019 - Permalink