...
Info |
---|
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 this information and processes it. |
Status |
---|
colour | Green |
---|
title | LAST TESTED ON CHECKMK 2.2.0P1 |
---|
|
...
Nginx stub status module
Make sure that the server process is configured with the stub status module. Use the command:
Code Block |
---|
|
root@linux:~# nginx -V 2>&1 | grep -o with-http_stub_status_module
with-http_stub_status_module |
If the stub status module is not installed, you can follow this guide for the installation: https://www.tecmint.com/enable-nginx-status-page/
Add a new server block configuration inside /etc/nginx/sites-enabled/default
Code Block |
---|
language | bash |
---|
theme | RDark |
---|
title | /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;
}
} |
- restart
Restart nginx service
Code Block |
---|
|
root@linux:~# systemctl restart nginx |
Now the Url 127.0.0.1:8081/nginx_status should be available
Code Block |
---|
|
root@linux:~# 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 |
Manually
You need to must 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 must create the configuration file /etc/check_mk/nginx_status.cfg. Here is one example:
Code Block |
---|
|
servers = [{'address': '127.0.0.1',
'page': 'nginx_status',
'port': 8081,
'protocol': 'http'}] |
via Bakery
Setup → Agents → Windows, Linux, Solaris... → Agent rules →NGINX webservers (Linux)
Test the plugin
...
Check_MK will create one service for each web server.
Image RemovedImage Added
Debugging
Port Checking
Code Block |
---|
language | bash |
---|
theme | RDark |
---|
linenumbers | true |
---|
|
root@klappanasroot@linux:~# 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
Code Block |
---|
|
root@klappanas |
root@linux:~# systemctl status nginx |
Stub status module
Code Block |
---|
languagelinenumbers | bash |
---|
theme | trueRDark |
---|
|
root@klappanasroot@linux:~# nginx -V 2>&1 | grep -o with-http_stub_status_module
with-http_stub_status_module |
...
Checking the status page
Code Block |
---|
languagelinenumbers | bash |
---|
theme | trueRDark |
---|
|
root@klappanasroot@linux:~# 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 |
Related articles
Filter by label (Content by label) |
---|
showLabels | false |
---|
max | 5 |
---|
spaces | KB |
---|
showSpace | false |
---|
sort | modified |
---|
reverse | true |
---|
type | page |
---|
cql | label in ("nginx","nginx_status","webserver") and type = "page" and space = "KB" |
---|
labels | nginx webserver nginx_status |
---|
|
...