Skip to main content
Version: Cloud

Monitor Docker Platform

Docker is an open platform for developing, shipping, and running applications. Docker provides the ability to package and run an application in a loosely isolated environment called a container. The container becomes the unit for distributing and testing your application.

Docker monitoring

Docker running on linux can be monitored using Snappyflow sfagent. Refer the link for installation of sfagent.

Configuration 

Add the following configuration to the config.yaml file:

key: <profile key> 
tags:
Name: <unique instance name or will be generated from IP>
appName: <add application name>
projectName: <add project name>
metrics:
plugins:
- name: docker
enabled: true
interval: 30

Metrics list

CPU Statistics
MetricDescriptionUnit
systemUsageTotal System time consumedSeconds
totalUsageTotal CPU time consumedSeconds
usagePercentCPU Usage in percentagePercent
usageInKernelModeTime spent by tasks of the cgroup in kernel modeSeconds
usageinUserModeTime spent by tasks of the cgroup in user modeSeconds
throttledPeriodsNumber of periods when the container hits its throttling limitCount
periodsNumber of periods with throttling activeCount
throttledTimeAggregate time the container was throttled for in secondsSeconds
systemTimeThe CPU system time metric represents the percentage of time that CPU is executing system calls on behalf of processes.Seconds
Block IO Statistics
MetricDescriptionUnit
ioServicedRecursiveSyncCount of sync performedRegardless of size
ioServicedRecursiveAsyncCount of async performedRegardless of size
ioServicedRecursiveReadCount of read performedRegardless of size
ioServicedRecursiveWriteCount of write performedRegardless of size
ioServiceBytesRecursiveSyncCount of sync performedBytes
ioServiceBytesRecursiveAsyncCount of sync performedBytes
ioServiceBytesRecursiveReadCount of sync performedBytes
Network Statistics
MetricDescriptionUnit
rxPacketsNetwork packet count receivedCount
txPacketsNetwork packet count sentcount
rxErrorsPackets received with errorsError
txErrorErrors in packet transmissionError
rxBytesNetwork traffic volume receivedBytes
txBytesNetwork traffic volume sentBytes
rxDroppedPackets dropped receivedError
txDroppedPackets dropped sentError
Swarm Statistics
MetricDescriptionUnit
tasksDesiredNo of task desiredCount
serviceNameSwarm service service NameString
serviceModeSwarm service service ModeString
ServicedSwarm service service IdString
tasksRunningNo of task RunningCount
Memory Statistics
MetricDescriptionUnit
cacheCache memory reflects data stored on disk that is currently cachedBytes
totalCacheTotal cache memory reflects data stored on disk that is currently cachedBytes
activeAnonRSS itself can be further decomposed into activeBytes
totalActiveAnonTotal active anonBytes
inactiveAnonRSS itself can be further decomposed into inactiveBytes
totalInactiveFileTotal inactive anonBytes
activeFileCache can be further decomposed into active fileBytes
totalActiveFileTotal active fileBytes
inactiveFileCache can be further decomposed into inactivefileBytes
totalInactiveFileTotal Inactive fileBytes
unevictableUnreclaimable memory  consumed by userspaceBytes
totalUnevictableTotal unreclaimable memory consumed by userspaceBytes
pgFaultSegmentation faultBytes
pgpgOutPage outBytes
pgpgInPage inBytes
totalPgpgoutTotal page outBytes
totalPgfaultTotal segmentation faultBytes
pgmajFaultsegmentation faultsBytes
totalPgmajFaultFetching data from disk instead of memoryBytes
writebackMemory usage of a container for write backBytes
mappedFileNo of mapped filesBytes
totalMappedFileTotal no of mapped filesBytes
hierarchicalMemswLimitHierarchical Memory sw LimitBytes
hierarchicalMemoryLimitHierarchical Memory LimitBytes
totalWritebackTotal no of writebackBytes
rssNon-cache memory for a processBytes
totalRssTotal Non-cache memory for a processBytes
rssHugeResident set size hugeBytes
totalRssHugeTotal resident set size hugeBytes
note

Health status of docker is displayed as "unknown" if no healthcheck is added to the Docker file.

Enabling swarm will display the swarm statistics on the dashboard, else an empty box is displayed.

Follow the steps below to know how to enable:

  1. Add health check
  2. Add swarm to the docker container

Health Check

A HEATHCHECK instruction determines the state of a Docker Container. It determines whether the Container is running in a normal state or not. It performs health checks at regular intervals. The initial state is starting and after a successful checkup, the state becomes healthy. If the test remains unsuccessful, it turns into an unhealthy state.

Some options provided by the HEALTHCHECK instruction are:

  • --interval=: It determines the interval between 2 health check-ups. The default interval is the 30s.
  • --timeout=: If the HEALTHCHECK command exceeds the specified duration, it is categorized as a failure. The default duration is the 30s.
  • --retries=: If it reaches the specified number of retries, the state is unhealthy. The default number of retries is 3.

Add the health check instruction with options and a command or a blank health check in the Docker File , refer the given example.

HEALTHCHECK --interval=35s --timeout=4s CMD curl -f <protocol>://<IP>/ || exit 1
EXPOSE <port>
#Replace the protocol, IP and port as per requirements
#Ex: HEALTHCHECK --interval=35s --timeout=4s CMD curl -f https://localhost/ || exit 1
EXPOSE 80

OR

  HEALTHCHECK NONE

Re-build of docker is required after adding healthcheck in the docker file. Use the following command to build the docker.

docker build

Docker Swarm

Docker Swarm is an orchestration management tool that runs on Docker applications. It helps end-users in creating and deploying a cluster of Docker nodes. Each node of a Docker Swarm is a Docker daemon, and all Docker daemons interact using the Docker API. Docker Swarm can reschedule containers on node failures. Swarm node has a backup folder which we can use to restore the data onto a new Swarm.

There are two types of nodes in Docker Swarm:

  1. Manager node-Maintains cluster management tasks
  2. Worker node-Receives and executes tasks from the manager node

Steps to be followed to add swarm

  1. Run the command

    docker swarm init
  2. Follow the instruction from the docker swarm init

    docker swarm join –token “token”
    docker swarm join -token manager

    Docker swarm info details are shown only when a service is running.

    To add services, run the following command

    docker service create --name <service name> -p 80:80 httpd

Viewing data and dashboards

Data collected by plugins can be viewed in SnappyFlow’s browse data section    

  • Plugin = docker
  • documentType= docker, containerStatic, containerUtils, containerNetwork, dockerSwarm
  • Dashboard template: Docker