Skip to content

Commit 2448fb5

Browse files
committed
Merge remote-tracking branch 'origin/checking_resources' into checking_resources
2 parents 958c1ba + 130691b commit 2448fb5

File tree

3 files changed

+100
-4
lines changed

3 files changed

+100
-4
lines changed

34_checking_resources/CGROUPS.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# README
2+
Demonstrate how to work with cgroups
3+
4+
## cgroups
5+
```sh
6+
# man pages
7+
man cgroups
8+
9+
# list filesystems and look at cgroups
10+
cat /proc/filesystems
11+
12+
# see where they a virtually mounted
13+
mount
14+
```
15+
16+
## Install tooling
17+
```sh
18+
# install tooling
19+
sudo apt install cgroup-tools
20+
21+
# list cgroup tools
22+
dpkg -L cgroup-tools | grep bin
23+
24+
```
25+
26+
## Walk the filesystem
27+
```sh
28+
# cgroups v1
29+
ls /sys/fs/cgroup/
30+
31+
# cgroups v2
32+
ls /sys/fs/cgroup/unified
33+
```
34+
35+
36+
## Resources
37+
https://medium.com/nttlabs/cgroup-v2-596d035be4d7
38+
39+
40+
https://opensource.com/article/20/10/cgroups
41+
42+
https://www.linuxjournal.com/content/everything-you-need-know-about-linux-containers-part-i-linux-control-groups-and-process
43+
44+
https://www.linuxjournal.com/content/everything-you-need-know-about-linux-containers-part-ii-working-linux-containers-lxc
45+
46+
47+
SSH in a cgroup
48+
https://unix.stackexchange.com/questions/209199/how-to-ensure-ssh-via-cgroups-on-centos
49+
50+
https://unix.stackexchange.com/questions/56538/controlling-priority-of-applications-using-cgroups
51+
52+
cgroupsv2
53+
https://unix.stackexchange.com/questions/471476/how-do-i-check-cgroup-v2-is-installed-on-my-machine

37_checking_resources/README.md renamed to 34_checking_resources/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Demonstrate how to use various commands to verify resource usage in the OS.
33

44

55
TODO:
6+
* cgroups
67
* Open sockets
78
* Free memory
89
* File handles
@@ -12,6 +13,33 @@ TODO:
1213
* debugfs
1314
https://github.com/raboof/nethogs
1415

16+
17+
```sh
18+
# booted with
19+
cat /proc/cmdline
20+
21+
# built with
22+
cat /boot/config-5.8.0-49-generic | grep CGROUP
23+
24+
# global limits
25+
systemctl show
26+
```
27+
28+
## Check limits
29+
```sh
30+
# limits inside a container
31+
docker run -it ubuntu:20.04 /bin/bash -c "ulimit -a"
32+
33+
# limits on host
34+
ulimit -a
35+
36+
# limits for current pid
37+
cat /proc/$$/limits
38+
39+
# show global config
40+
systemctl show
41+
```
42+
1543
## Disk
1644

1745
```sh
@@ -22,9 +50,20 @@ df -h
2250
## Sockets
2351

2452
```sh
53+
# summary of all the sockets
54+
ss -s
55+
2556
# listening sockets
2657
ss -l
58+
59+
# listening sockets with processes
60+
sudo ss -lp
61+
62+
# tcp connections with information
63+
ss -ti
2764
```
65+
66+
2867
## Memory
2968

3069
```sh

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,21 @@ Steps [README.md](./32_jq/README.md)
159159
Demonstrates using awscli to query resources in an AWS account.
160160
Steps [README.md](./33_awscli/README.md)
161161

162+
## Example 34 - Checking Resources
163+
Demonstrate how to use various commands to verify resource usage in the OS.
164+
Steps [README.md](./34_checking_resources/README.md)
165+
162166
## Example 35 - APT and DPKG
163167
Demonstrate examples of working with APT and DPKG
164168
Steps [README.md](./35_apt_and_dpkg/README.md)
165169

166170
## Example 36 - Git Querying
167-
Demonstrates some examples of using git queries
168-
Steps [README.md](./36_git_querying/README.md)
171+
Demonstrates some examples of using git queries
172+
Steps [README.md](./36_git_querying/README.md)
169173

170174
## Example 37 - Checking Resources
171-
Demonstrate how to use various commands to verify resource usage in the OS.
172-
Steps [README.md](./37_checking_resources/README.md)
175+
Demonstrate how to use various commands to verify resource usage in the OS.
176+
Steps [README.md](./37_checking_resources/README.md)
173177

174178
## TODO:
175179
* Globbing

0 commit comments

Comments
 (0)