Module: check_mk
Branch: master
Commit: 518101b613835009e404d720a19e715f62b483cc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=518101b6138350…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 6 15:56:11 2018 +0200
docker_container_diskstat: Check Disk IO of a docker container
Change-Id: Ibbe038a44c66111fa700f9f31896f7c8119fa903
---
agents/check_mk_agent.linux | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 258a7cd..cabbc97 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -467,16 +467,24 @@ if type multipath >/dev/null ; then
fi
# Performancecounter Platten
-echo '<<<diskstat>>>'
-date +%s
-egrep '
(x?[shv]d[a-z]*[0-9]*|cciss/c[0-9]+d[0-9]+|emcpower[a-z]+|dm-[0-9]+|VxVM.*|mmcblk.*|dasd[a-z]*|bcache[0-9]+|nvme[0-9]+n[0-9]+)
' < /proc/diskstats
-if type dmsetup >/dev/null ; then
- echo '[dmsetup_info]'
- dmsetup info -c --noheadings --separator ' ' -o name,devno,vg_name,lv_name
-fi
-if [ -d /dev/vx/dsk ] ; then
- echo '[vx_dsk]'
- stat -c "%t %T %n" /dev/vx/dsk/*/*
+if [ -z "$MK_IN_CONTAINER" ]; then
+ echo '<<<diskstat>>>'
+ date +%s
+ grep -E '
(x?[shv]d[a-z]*[0-9]*|cciss/c[0-9]+d[0-9]+|emcpower[a-z]+|dm-[0-9]+|VxVM.*|mmcblk.*|dasd[a-z]*|bcache[0-9]+|nvme[0-9]+n[0-9]+)
' < /proc/diskstats
+ if type dmsetup >/dev/null ; then
+ echo '[dmsetup_info]'
+ dmsetup info -c --noheadings --separator ' ' -o
name,devno,vg_name,lv_name
+ fi
+ if [ -d /dev/vx/dsk ] ; then
+ echo '[vx_dsk]'
+ stat -c "%t %T %n" /dev/vx/dsk/*/*
+ fi
+else
+ echo '<<<docker_container_diskstat>>>'
+ for F in io_service_bytes io_serviced; do
+ echo "[$F]"
+ echo "$(</sys/fs/cgroup/blkio/blkio.throttle.$F)"
+ done
fi