Articles on: Plugins

Monitoring Docker

This module keeps track of docker instances on your machine. The module uses the "docker stats" command to retrieve the statistics.


Docker Metrics



Memory usage
Total memory
Network in
Network out
Disk write
Disk read
CPU usage
Docker container count

Installing the Docker Monitoring Plugin



The nixstats user needs sudo access to run docker stats. Open /etc/sudoers and append the following at the end of the file.

nixstats ALL=(ALL) NOPASSWD: /usr/bin/docker

This is considering docker is install in /usr/bin/docker.

Now open /etc/nixstats.ini and append the following lines at the end of the file.

[docker]
enabled = yes


Testing the docker plugin



Run sudo -u nixstats nixstatsagent test docker to see if everything is installed correctly.

root@nixstats:~# sudo -u nixstats nixstatsagent test docker
docker:
{
    "containers": 2,
    "goofy_lewin": {
        "cpu": "0.00",
        "disk_in_bytes": 0,
        "disk_out_bytes": 0,
        "mem_pct": "0.05",
        "mem_total_bytes": 1040501964.8,
        "mem_usage_bytes": 483328.0,
        "net_in_bytes": 0,
        "net_out_bytes": 0
    },
    "pensive_austin": {
        "cpu": "0.00",
        "disk_in_bytes": 0,
        "disk_out_bytes": 0,
        "mem_pct": "0.05",
        "mem_total_bytes": 1040501964.8,
        "mem_usage_bytes": 483328.0,
        "net_in_bytes": 0,
        "net_out_bytes": 0
    }
}


If the test is successful you can restart the agent to start sending data to Nixstats.

service nixstatsagent restart



Create a Docker Monitoring chart



Click on the Metrics link on the top menu, now select "docker" as metric type. You should see a list of available docker containers with their statistics. Choose the servers you would like to graph and save it to your dashboard.

Updated on: 07/03/2018

Was this article helpful?

Share your feedback

Cancel

Thank you!