Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docker plugin #436

Merged
merged 6 commits into from
Nov 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions mackerel-plugin-docker/lib/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var graphdef = map[string]mp.Graphs{
},
"docker.memory.#": {
Label: "Docker Memory",
Unit: "integer",
Unit: "bytes",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker.memory.#.{cache,rss} are taken from cgroup memory.stat

https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt

memory.stat file includes following statistics

# per-memory cgroup local status
cache		- # of bytes of page cache memory.
rss		- # of bytes of anonymous and swap cache memory (includes
		transparent hugepages).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, in many Linux distributions these stats are always zero (but in Docker for Mac non-zero).
ref: https://docs.docker.com/engine/admin/runmetrics/#memory-metrics-memorystat

Therefore, many distros chose to not enable it by default.

Metrics: []mp.Metrics{
{Name: "cache", Label: "Cache", Diff: false, Stacked: true},
{Name: "rss", Label: "RSS", Diff: false, Stacked: true},
Expand All @@ -55,17 +55,17 @@ var graphdef = map[string]mp.Graphs{
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt

- blkio.io_queued
	- Total number of requests queued up at any given instant for this
	  cgroup. This is further divided by the type of operation - read or
	  write, sync or async.

"docker.blkio.io_serviced.#": {
Label: "Docker BlkIO IOPS",
Unit: "integer",
Unit: "iops",
Metrics: []mp.Metrics{
{Name: "read", Label: "Read", Diff: true, Stacked: true, Type: "uint64"},
{Name: "write", Label: "Write", Diff: true, Stacked: true, Type: "uint64"},
{Name: "sync", Label: "Sync", Diff: true, Stacked: true, Type: "uint64"},
{Name: "async", Label: "Async", Diff: true, Stacked: true, Type: "uint64"},
{Name: "read", Label: "Read", Diff: true, Stacked: true, Type: "uint64", Scale: (1.0 / 60.0)},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt

- blkio.io_serviced
	- Number of IOs (bio) issued to the disk by the group. These
	  are further divided by the type of operation - read or write, sync
	  or async. First two fields specify the major and minor number of the
	  device, third field specifies the operation type and the fourth field
	  specifies the number of IOs.

{Name: "write", Label: "Write", Diff: true, Stacked: true, Type: "uint64", Scale: (1.0 / 60.0)},
{Name: "sync", Label: "Sync", Diff: true, Stacked: true, Type: "uint64", Scale: (1.0 / 60.0)},
{Name: "async", Label: "Async", Diff: true, Stacked: true, Type: "uint64", Scale: (1.0 / 60.0)},
},
},
"docker.blkio.io_service_bytes.#": {
Label: "Docker BlkIO Bytes",
Unit: "integer",
Unit: "bytes",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt

- blkio.io_service_bytes
	- Number of bytes transferred to/from the disk by the group. These
	  are further divided by the type of operation - read or write, sync
	  or async. First two fields specify the major and minor number of the
	  device, third field specifies the operation type and the fourth field
	  specifies the number of bytes.

Metrics: []mp.Metrics{
{Name: "read", Label: "Read", Diff: true, Stacked: true, Type: "uint64"},
{Name: "write", Label: "Write", Diff: true, Stacked: true, Type: "uint64"},
Expand Down