Linux+ Linux+ System Monitoring and Logging 2 — Questions and Answers
Question 1: Which command displays real-time disk I/O statistics per process?
- iostat -x
- iotop (Correct answer)
- vmstat -d
- dstat --disk
Correct answer: iotop
iotop shows real-time disk I/O usage per process, similar to how top shows CPU usage.
Question 2: In journald, which option to journalctl shows only kernel messages?
- -u kernel
- -k (Correct answer)
- --kernel-only
- -f kernel
Correct answer: -k
The -k flag (short for --dmesg) filters journalctl output to show only kernel ring buffer messages.
Question 3: A sysadmin wants to monitor network bandwidth usage per interface in real time. Which tool is best suited?
- netstat -s
- ss -t
- nload (Correct answer)
- ip -s link
Correct answer: nload
nload provides a real-time graphical display of network bandwidth usage per interface in the terminal.
Question 4: What does the 'wa' field represent in the output of the top command?
- Waiting processes in run queue
- CPU time spent waiting for I/O (Correct answer)
- Web application CPU usage
- Wakeup events per second
Correct answer: CPU time spent waiting for I/O
The 'wa' field in top shows the percentage of CPU time spent idle while waiting for I/O operations to complete.
Question 5: Which rsyslog directive sets the maximum log file size before rotation is triggered?
- $MaxFileSize
- rotate size
- $outchannel with size limit (Correct answer)
- $FileOwner
Correct answer: $outchannel with size limit
rsyslog's $outchannel directive can specify a size limit that triggers an action (such as rotation) when reached.
Question 6: Which command shows the number of file descriptors currently open by all processes?
- lsof | wc -l
- cat /proc/sys/fs/file-nr (Correct answer)
- ulimit -n
- fdcount
Correct answer: cat /proc/sys/fs/file-nr
The file /proc/sys/fs/file-nr contains three fields: allocated FDs, free FDs, and the system-wide maximum.
Question 7: A log file is growing very quickly and consuming disk space. Which logrotate directive forces immediate rotation regardless of size?
- minsize
- maxsize
- size (Correct answer)
- notifempty
Correct answer: size
The 'size' directive rotates the log file when it exceeds the specified size, regardless of the rotation schedule.
Which command displays real-time disk I/O statistics per process?