Hello, How can i monitor nginx web-server (linux)? I need a sensor like "Windows IIS Application sensor".
4 Replies
Have you seen this KB article already? https://kb.paessler.com/en/topic/60186
It describes monitoring NGiNX with a custom exe sensor :)
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;
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
Created on Jun 15, 2018 2:59:41 AM by
ek
(60)
Last change on Jun 15, 2018 6:23:46 AM by
Luciano Lingnau [Paessler]
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.
Add comment