-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathmega-proc.sh
executable file
·46 lines (42 loc) · 1.29 KB
/
mega-proc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
ps="ps aux --forest | grep -v grep | grep -v container-processes | grep $f | sed 's/.*/&\n/' | sed 's/\(--[a-zA-Z]*\)/\n\t&/g' | sed 's/\(-[a-zA-Z] .* \)/\n\t&/g' | sed 's/[a-z,0-9]\{30,\}/\n\t&/g'"
case $1 in
docker)
echo "USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND"
ps aux --forest \
| grep -v grep \
| grep -v openshift \
| grep -v etcd \
| grep -v $0 \
| grep docker \
| sed 's/.*/&\n/' \
| sed 's/\(--[a-zA-Z]*\)/\n\t&/g' \
| sed 's/\(-[a-zA-Z] .* \)/\n\t&/g' \
| sed 's/[a-z,0-9]\{30,\}/\n\t&/g'
;;
openshift)
echo "USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND"
ps aux --forest \
| grep -v grep \
| grep -v $0 \
| grep openshift \
| sed 's/.*/&\n/' \
| sed 's/\(--[a-zA-Z]*\)/\n\t&/g' \
| sed 's/\(-[a-zA-Z] .* \)/\n\t&/g' \
| sed 's/[a-z,0-9]\{30,\}/\n\t&/g'
;;
kubernetes)
echo "USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND"
ps aux --forest \
| grep -v grep \
| grep -v $0 \
| grep kube \
| sed 's/.*/&\n/' \
| sed 's/\(--[a-zA-Z]*\)/\n\t&/g' \
| sed 's/\(-[a-zA-Z] .* \)/\n\t&/g' \
| sed 's/[a-z,0-9]\{30,\}/\n\t&/g'
;;
*)
echo "Usage: container-processes {docker|openshift|kubernetes}"
;;
esac