Differences
This shows you the differences between two versions of the page.
linux_maintenance_tracing [2019/10/18 20:04] – external edit 127.0.0.1 | linux_maintenance_tracing [2020/05/01 14:16] (current) – andonovj | ||
---|---|---|---|
Line 3: | Line 3: | ||
- | ====Locate a session==== | ||
- | First thing is to locate the session PID, in our example we want to monitor a NAGIOS client, therefore we have to minitor a process called: " | ||
- | <sxh bash> | ||
- | [root@oraback libexec]# ps -leaf | grep -i xinet | ||
- | 0 S root 4622 31523 0 78 0 - 15298 pipe_w 10:33 pts/0 00:00:00 grep -i xinet | ||
- | 1 S root 6177 | ||
- | </ | ||
- | |||
- | |||
- | ====Trace==== | ||
- | Once we have located the parent process, we can start tracing: | ||
- | |||
- | |||
- | <sxh bash> | ||
- | [root@oraback libexec]# strace -o /tmp/x -fp 6177 | ||
- | Process 6177 attached - interrupt to quit | ||
- | Process 4644 attached (waiting for parent) | ||
- | Process 4644 resumed (parent 6177 ready) | ||
- | Process 4645 attached (waiting for parent) | ||
- | Process 4645 resumed (parent 4644 ready) | ||
- | Process 4644 suspended | ||
- | Process 4646 attached (waiting for parent) | ||
- | Process 4646 resumed (parent 4645 ready) | ||
- | Process 4647 attached (waiting for parent) | ||
- | </ | ||
- | |||
- | This command, will trace all info, into a file called: /tmp/x | ||
- | |||
- | ====Verbose==== | ||
- | In case of need, the trace can be extended to include more data using: | ||
- | |||
- | |||
- | <sxh bash> | ||
- | [root@oraback libexec]# strace -vo /tmp/x -fp 6177 | ||
- | Process 6177 attached - interrupt to quit | ||
- | Process 5089 attached (waiting for parent) | ||
- | Process 5089 resumed (parent 6177 ready) | ||
- | Process 5091 attached (waiting for parent) | ||
- | Process 5091 resumed (parent 5089 ready) | ||
- | Process 5089 suspended | ||
- | Process 5093 attached (waiting for parent) | ||
- | Process 5093 resumed (parent 5091 ready) | ||
- | Process 5093 detached | ||
- | Process 5089 resumed | ||
- | Process 5091 detached | ||
- | </ | ||
- | |||
- | After that we can examine the content of a trace file: | ||
- | |||
- | |||
- | <sxh bash> | ||
- | [root@oraback libexec]# less /tmp/x | ||
- | 2280 <... nanosleep resumed> NULL) = 0 | ||
- | 2280 nanosleep({1, | ||
- | 2286 <... futex resumed> ) = -1 ETIMEDOUT (Connection timed out) | ||
- | 2286 futex(0x38891f8, | ||
- | 2286 futex(0x3889224, | ||
- | 2287 <... futex resumed> ) = -1 ETIMEDOUT (Connection timed out) | ||
- | 2279 <... futex resumed> ) = -1 ETIMEDOUT (Connection timed out) | ||
- | 2287 futex(0x38d5658, | ||
- | 2279 futex(0x31f49f8, | ||
- | 2287 <... futex resumed> ) = 0 | ||
- | 2279 <... futex resumed> ) = 0 | ||
- | 2287 futex(0x38d5684, | ||
- | 2279 futex(0x31f4a24, | ||
- | 2278 <... futex resumed> ) = -1 ETIMEDOUT (Connection timed out) | ||
- | 2277 <... futex resumed> ) = -1 ETIMEDOUT (Connection timed out) | ||
- | 2275 <... futex resumed> ) = -1 ETIMEDOUT (Connection timed out) | ||
- | 2278 futex(0x31f4968, | ||
- | 2277 futex(0x3884a78, | ||
- | 2275 futex(0x31f4b18, | ||
- | 2278 <... futex resumed> ) = 0 | ||
- | 2277 <... futex resumed> ) = 0 | ||
- | 2275 <... futex resumed> ) = 0 | ||
- | 2278 futex(0x31f4994, | ||
- | 2277 futex(0x3884aa4, | ||
- | </ |