Monitoring (multiple) nginx containers (on the same host)

Hi All,

What would be the best approach for monitoring Nginx (Docker) container statistics?

Normally the ‘nginx_status’ page can be retrieved on a single host, but how to do this on a dockerized Nginx container (and eventually on multiple different containers on the same host)?

I tried to create a rule using the ‘Nginx Status’ and pinned this to the specific container but this does not show any new discovered services for this container.

The nginx config allows retrieval of the status page from the check_mk server IP, as wel as from the hosts IP addresses (localhost, and docker interface)

Many thanks!


The agent plugin can be configured to query specific instances and not to auto-detect them.

Use the agent bakery or put a file nginx_status.cfg into /etc/check_mk on your Docker node with the list of instances:

servers = [{'address': '',
  'page': 'nginx_status',
  'port': 80,
  'protocol': 'http'},
 {'address': '',
  'page': 'nginx_status',
  'port': 80,
  'protocol': 'http'}]

Hi Robert,

Many thanks for the response.
I have created the config file:

cat /etc/check_mk/nginx_status.cfg
servers = [
“protocol” : “http”,
“address” : “localhost”,
“port” : 80,
“protocol” : “http”,
“address” : “”,
“port” : 80,
“page” : “nginx_status”,

whereby the second entry is the container. With curl I can visit the nginx_status page:

Active connections: 6
server accepts handled requests
3371 3371 3837
Reading: 0 Writing: 6 Waiting: 0

Next to this I have the nginx_status plugin installed:

ls -al /usr/lib/check_mk_agent/plugins/nginx_status
-rwxr-xr-x 1 XXXXX XXXXX 3164 Jan 4 23:07 /usr/lib/check_mk_agent/plugins/nginx_status

However, when running the agent, this does not seem to provide the output:

/usr/bin/check_mk_agent | grep “<<<nginx_”
10:devices:/user.slice,8:blkio:/user.slice,7:pids:/user.slice/user-1002.slice/session-366.scope,6:cpu,cpuacct:/user.slice,4:memory:/user.slice/user-1002.slice/session-366.scope,1:name=systemd:/user.slice/user-1002.slice/session-366.scope,0::/user.slice/user-1002.slice/session-366.scope root 9232 2676 00:00:00 00:02 1269118 grep --color=auto <<<nginx_

I’m running the latest 2.0.0b3 version of CMK CRE, including the agent + plugins.

I have used this guide :

Am I still forgetting something?

Best regards,


Sorry, without further debugging I cannot help you.

Hi Robert,

Thanks for the response. I understand that you need some more info, but I am a little stuck at where to do this troubleshooting.

Should I be able to run the nginx_status plugin as standalone script:

python nginx_status

Traceback (most recent call last):
File “nginx_status”, line 43, in
NameError: name ‘get_parsed_item_data’ is not defined

In other words, is the error related to the issue I am observing, or do I need to run this in another fashion?

Thanks for the help,


Running into the exact same issue - have configured nginx_status location and can pull data via wget in the example posted however the agent is not pulling this information nor is it possible to execute the plugin independently receiving the name NameError.

What kind of information will you require for further troubleshooting? Is there a specific version of python3 required?

:zap: root@df  /usr/lib/check_mk_agent/plugins  ./nginx_status
Traceback (most recent call last):
File “./nginx_status”, line 43, in
NameError: name ‘get_parsed_item_data’ is not defined

Small update here and might be relevant to @acfnews, the python2 version of nginx_status works fine.

<<<nginx_status>>> 80 Active connections: 1 80 server accepts handled requests 80 149 149 146 80 Reading: 0 Writing: 1 Waiting: 0

Hi Latez,

Just wondering if you are using a complete other script, or updated the hashbang?
I don’t get it working by changing the first line into:
#!/usr/bin/env python2


Someone here at check_mk kindly granted me upload rights this morning so here you go -

nginx_status2.txt (4.6 KB)

Aha !
That script provides correct output, thank you !

python ./nginx_python2

localhost 80 Active connections: 4
localhost 80 server accepts handled requests
localhost 80 18243 18243 254955
localhost 80 Reading: 0 Writing: 3 Waiting: 1 80 Active connections: 4 80 server accepts handled requests 80 18244 18244 254956 80 Reading: 0 Writing: 3 Waiting: 1

I guess it would be nice if the script from check_mk itself also would work :unamused:

This code is part of the check plugin that runs on the monitoring server and not the agent plugin that has to be copied to your nginx host.

You got the wrong file.

The agent plugin is available via WATO → Monitoring Agents.