Red Hat Certified Engineer RHCE · Free Practice Question Hard
Question 4
A storage system in your environment is showing signs of I/O bottlenecks during peak usage hours, causing application performance to degrade. Using Ansible, how would you automate the monitoring of disk I/O performance on managed servers and identify if hardware upgrades are necessary?
-
A
- - name: Monitor Disk I/O Performance
- hosts: all
- tasks:
- - name: Install iostat package
- yum:
- name: sysstat
- state: present
- - name: Run iostat to monitor disk performance
- command: iostat -dx 5
- register: iostat_output
- - name: Analyze %iowait and utilization
- debug:
- msg: >
- "{{ item }}"
- with_items: "{{ iostat_output.stdout_lines }}"
-
B
This is a performance based question and not multiple choice. Therefore the answer is in #1. If you require additional explanation, please ask your question in the Q&A section.
Reveal correct answer
Correct answer: A
A.
This Ansible playbook automates the monitoring of disk I/O performance on managed servers to identify bottlenecks and evaluate if hardware upgrades are necessary. It installs the sysstat package, which provides the iostat tool for monitoring disk I/O. The playbook then runs the iostat command to gather disk performance metrics, including %iowait and utilization. The results are captured and displayed for analysis, enabling administrators to pinpoint performance issues during peak usage and make informed decisions about resource upgrades.
Line-by-Line Explanation
- - name: Monitor Disk I/O Performance
Provides a descriptive name for the playbook, indicating its purpose.
- hosts: all
Specifies that the playbook will apply to all managed nodes.
- tasks:
Defines the tasks to be executed in the playbook.
- - name: Install iostat package
Describes the task to install the sysstat package, which includes the iostat utility.
- yum:
Uses the yum module to manage package installation on CentOS/RHEL systems.
- name: sysstat
Specifies the package to install (sysstat).
- state: present
Ensures the package is installed if it is not already present.
- - name: Run iostat to monitor disk performance
Describes the task to execute the iostat command for collecting disk I/O metrics.
- command:
Uses the command module to execute shell commands.
- cmd: iostat -dx 5
Runs the iostat command to display extended statistics (-x) for all devices every 5 seconds.
- register: iostat_output
Captures the output of the iostat command for further processing.
- - name: Analyze %iowait and utilization
Describes the task to display the captured output for analysis.
- debug:
Uses the debug module to print messages or data.
- msg: "{{ item }}"
Specifies the format for displaying each line of the iostat output.
- with_items: "{{ iostat_output.stdout_lines }}"
Iterates over the captured lines of the iostat output and displays each one.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
