What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

nginx monitoring

Votes:

0

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

monitoring nginx prtg

Created on May 27, 2014 8:19:54 AM



4 Replies

Votes:

0

Have you seen this KB article already? https://kb.paessler.com/en/topic/60186

It describes monitoring NGiNX with a custom exe sensor :)

Created on May 27, 2014 8:36:14 AM by  Stephan Linke [Paessler Support]



Votes:

0

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;

Created on May 29, 2014 8:13:52 AM



Votes:

2

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

Last change on Jun 15, 2018 6:23:46 AM by  Luciano Lingnau [Paessler]



Votes:

0

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.

Created on Apr 11, 2019 8:12:27 PM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.