aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/monitor
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-04-19 22:13:44 +0200
committerjohannst <johannes.stoelp@gmail.com>2020-04-19 22:13:44 +0200
commitfef4d6ff2ad9f48e6dccde0f061453e6a3ac624e (patch)
treec21dfcf8e7c8895a94e1c72cb9588c94794656b1 /src/monitor
parent43e402ba2320ced7972d33c9442b2745afe230f6 (diff)
downloadnotes-fef4d6ff2ad9f48e6dccde0f061453e6a3ac624e.tar.gz
notes-fef4d6ff2ad9f48e6dccde0f061453e6a3ac624e.zip
added new hierarchy
Diffstat (limited to 'src/monitor')
-rw-r--r--src/monitor/README.md1
-rw-r--r--src/monitor/lsof.md40
-rw-r--r--src/monitor/pgrep.md15
-rw-r--r--src/monitor/pidstat.md31
-rw-r--r--src/monitor/pmap.md7
-rw-r--r--src/monitor/pstack.md6
6 files changed, 100 insertions, 0 deletions
diff --git a/src/monitor/README.md b/src/monitor/README.md
new file mode 100644
index 0000000..545e774
--- /dev/null
+++ b/src/monitor/README.md
@@ -0,0 +1 @@
+# Resource analysis & monitor
diff --git a/src/monitor/lsof.md b/src/monitor/lsof.md
new file mode 100644
index 0000000..8253003
--- /dev/null
+++ b/src/monitor/lsof.md
@@ -0,0 +1,40 @@
+# lsof(8)
+
+```markdown
+lsof
+ -a ......... AND slection filters instead ORing (OR: default)
+ -p <pid> ... filter by <pid>
+ +fg ........ show file flags for file descripros
+ -n ......... don't convert network addr to hostnames
+ -P ......... don't convert network port to service names
+ -i <@h[:p]>. show connections to h (hostname|ip addr) with optional port p
+```
+
+```markdown
+file flags:
+ R/W/RW ..... read/write/read-write
+ CR ......... create
+ AP ......... append
+ TR ......... truncate
+```
+
+# Examples
+
+## File flags
+Show open files with file flags for process:
+```markdown
+lsof +fg -p <pid>
+```
+## Open TCP connections
+Show open tcp connections for `$USER`:
+```markdown
+lsof -a -u $USER -i tcp
+```
+**Note**: `-a` _ands_ the results. If `-a` is not given all open files matching
+`$USER` and all tcp connections are listed (_ored_).
+
+## Open connection to specific host
+Show open connections to `localhost` for `$USER`:
+```markdown
+lsof -a -u $USER -i @localhost
+```
diff --git a/src/monitor/pgrep.md b/src/monitor/pgrep.md
new file mode 100644
index 0000000..2b52a73
--- /dev/null
+++ b/src/monitor/pgrep.md
@@ -0,0 +1,15 @@
+# pgrep(1)
+
+```markdown
+pgrep [opts] <pattern>
+ -n only list newest matching process
+ -u <usr> only show matching for user <usr>
+ -l additionally list command
+ -a additionally list command + arguments
+```
+
+## Debug newest process
+For example attach gdb to newest zsh process from `$USER`.
+```markdown
+gdb -p $(pgrep -n -u $USER zsh)
+```
diff --git a/src/monitor/pidstat.md b/src/monitor/pidstat.md
new file mode 100644
index 0000000..b57f231
--- /dev/null
+++ b/src/monitor/pidstat.md
@@ -0,0 +1,31 @@
+# pidstat(1)
+
+```markdown
+pidstat [opt] [interval] [cont]
+ -U [user] show username instead UID, optionally only show for user
+ -r memory statistics
+ -d I/O statistics
+ -h single line per process and no lines with average
+```
+
+# Page fault and memory utilization
+```markdown
+pidstat -r -p <pid> [interval] [count]
+```
+
+```markdown
+minor_pagefault: Happens when the page needed is already in memory but not
+ allocated to the faulting process, in that case the kernel
+ only has to create a new page-table entry pointing to the
+ shared physical page (not required to load a memory page from
+ disk).
+
+major_pagefault: Happens when the page needed is NOT in memory, the kernel
+ has to create a new page-table entry and populate the
+ physical page (required to load a memory page from disk).
+```
+
+# I/O statistics
+```markdown
+pidstat -d -p <pid> [interval] [count]
+```
diff --git a/src/monitor/pmap.md b/src/monitor/pmap.md
new file mode 100644
index 0000000..7c905ae
--- /dev/null
+++ b/src/monitor/pmap.md
@@ -0,0 +1,7 @@
+# pmap(1)
+
+```markdown
+pmap <pid>
+ Dump virtual memory map of process.
+ Compared to /proc/<pid>/maps it shows the size of the mappings.
+```
diff --git a/src/monitor/pstack.md b/src/monitor/pstack.md
new file mode 100644
index 0000000..c135844
--- /dev/null
+++ b/src/monitor/pstack.md
@@ -0,0 +1,6 @@
+# pstack(1)
+
+```markdown
+pstack <pid>
+ Dump stack for all threads of process.
+```