Commit 3aa80720 authored by djtm's avatar djtm
Browse files

add docker processes table

It would be possible to use docker ps and docker top with
--format, but that's not compatible with docker 1.6, e.g. ubuntu 14.04 LTS.
parent 9a1a280f
......@@ -189,6 +189,10 @@
name: 'cpuIntensiveProcesses',
template: '<table-data heading="CPU Intensive Processes" module-name="cpu_intensive_processes" info="Processes which are using most CPU."></table-data>'
},
{
name: 'dockerProcesses',
template: '<table-data heading="Docker Processes" module-name="docker_processes" info="Processes in Docker Containers sorted by CPU."></table-data>'
},
{
name: 'networkConnections',
template: '<table-data heading="Network Connections" module-name="network_connections"></table-data>'
......
#!/bin/bash
result=""
containers="$(docker ps | awk '{if(NR>1) print $NF}')"
for i in $containers; do
result="$result $(/usr/bin/docker top $i axo pid,user,pcpu,pmem,comm --sort -pcpu,-pmem \
| head -n 15 \
| /usr/bin/awk -v cnt="$i" 'BEGIN{OFS=":"} NR>1 {print "{ \"cname\": \"" cnt \
"\", \"pid\": " $1 \
", \"user\": \"" $2 "\"" \
", \"cpu%\": " $3 \
", \"mem%\": " $4 \
", \"cmd\": \"" $5 "\"" "},"\
}')"
done
echo "[" ${result%?} "]"
......@@ -3,5 +3,6 @@
<cpu-utilization-chart></cpu-utilization-chart>
<ram-intensive-processes></ram-intensive-processes>
<cpu-intensive-processes></cpu-intensive-processes>
<docker-processes></docker-processes>
<swap-usage></swap-usage>
<disk-space></disk-space>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment