Analyzing Servers and Monitoring Performance

Published On: 19 January 2025

Objective

One of the most important skills in Linux system administration is monitoring and tracking server performance. This is especially relevant for prospective RHCSA (Red Hat Certified System Administrator) candidates, as these activities are not just about passing the EX200 exam but also about making a competent and efficient system administrator who can deal with practical challenges.

This blog discusses the basics of monitoring server performance and troubleshooting problems with the help of tools such as SOS reports and Cockpit. These are essential tools in maintaining a safe, effective RHEL (Red Hat Enterprise Linux) environment.

Why Server Monitoring is Crucial in RHEL

Effective server analysis is crucial for several reasons. It ensures that servers run optimally, are secure, and can recover quickly in case of issues. Here’s a deeper look at why server analysis and monitoring are so important in an enterprise environment:

  1. Streamlined Troubleshooting:

    • Reports SOS are a better way of doing things for the administrators who need to fix and solve network or IT issues in the shortest time possible. They do this by providing a complete picture of critical system information that includes logs, configurations and runtime data.

    • Such a diagnostic tool reduces the need for painstaking searching through logs and configuration files, thereby speeding up the troubleshooting process when systems fail.

    • SOS reports give a detailed overview of the system's status at the time of request support by Red Hat or during audits, thus helping the Red Hat support team to troubleshoot quickly.

  2. Proactive Monitoring:

    • Cockpit offers on-demand real time status of your server health. It keeps and updates the basic metrics; for example, CPU Utilization, Memory Utilization, Disk I/O and Network Throughput.

    • Being monitored in a proactive manner, these metrics help system administrators to find potential performance bottlenecks or issues before they disrupt the service.

    • The web interface of Cockpit is pretty natural, so even if one has never logged into an admin interface before, it should be easy to get a quick overview of how the server is performing and take some action when needed.

  3. RHCSA Exam Relevance:

    • Many of the tasks you will face during the RHCSA exam require proficiency in generating diagnostic reports (SOS reports), monitoring server performance, and managing services such as Cockpit.

    • Additionally, you'll need to manage SELinux policies, including enabling and enforcing security measures. Understanding how to use Cockpit to manage SELinux will be directly tested in the exam.

    • Becoming comfortable with these tools will help you not only during the exam but also in managing and troubleshooting production systems.

Essential Tools for Server Monitoring and Management

  • SOS Reports

SOS reports are vital for gathering comprehensive diagnostic data in one convenient archive. These reports assist administrators in troubleshooting, auditing, and working with Red Hat support when problems arise.

  • Use Case: SOS reports are instrumental in diagnosing server issues quickly, especially during emergencies. They capture system logs, kernel logs, configuration files, hardware information, and more, allowing administrators to identify issues and patterns.

  • RHCSA Relevance: Understanding how to generate and analyze SOS reports is crucial for demonstrating troubleshooting skills. The EX200 exam will test your ability to work with system logs and generate diagnostic information under time constraints.

  • sosreport --batch --case-id=12345

  • This command generates a batch report with a specific case ID. The --batch flag skips interactive prompts, which is especially useful for automated reporting in large environments.
  • Cockpit

Cockpit is a simple, web-based engine management tool that allows real-time monitoring and system control. This means that it enables administrators to manage their servers with less command-line interaction, which makes Cockpit an especially great tool for quickly detecting problems and doing routine administrative tasks.

  • Use Case: Cockpit provides the administrator with real-time performance indicators like CPU usage, memory consumption, disk I/O operations, network throughput, and system uptime. It also permits management of system services, log viewing, and execution of simple administrative tasks.

  • RHCSA Relevance: Cockpit is integral to the RHCSA exam, where you must demonstrate competence in using it to monitor and manage services. You'll be tested on tasks like enabling Cockpit, starting/stopping services, and reviewing system logs.

What You’ll Learn in This Lab

In this lab, we’ll provide hands-on experience with generating SOS reports and using Cockpit for server monitoring and management. By the end of this lab, you'll gain practical skills for troubleshooting, monitoring, and securing RHEL servers.

LAB: Analyze Servers

LAB Link: https://rhcsa.guru/?name=rh124-analyze-servers-get-support

Step 1: Changing the Root Password

To begin, we will change the root password to a stronger, more secure one. This password is essential for accessing server management features. You can update the root password by executing the following command and entering the new password when prompted:

passwd

Note: Make sure to remember the new password as you will need it later.

Step 2: Generating an SOS Report

An SOS report is crucial when encountering server issues and needing support from Red Hat. This comprehensive report includes logs, system configurations, hardware details, and much more, which helps in diagnosing server problems.

To generate an SOS report, run the following command. Please note that this might take some time:

sos report

Step 3: Introduction to Cockpit

Cockpit is a web-based management interface for servers that simplifies administrative tasks. It allows you to monitor system metrics, manage services, and perform routine administrative tasks. In most cases, the Cockpit is already installed. If not, you can install it using the following command:

dnf install cockpit -y

Step 4: Allowing Root Access to Cockpit

By default, the root user might be restricted from accessing Cockpit. To change this, we need to remove the root user from the disallowed list. Open the /etc/cockpit/disallowed-users file with the vi editor:

vi /etc/cockpit/disallowed-users

Once open, navigate to the line containing 'root' and delete it by pressing d twice. Then, save and close the file by pressing :wq and hitting Enter.

Step 5: Starting Cockpit Service

Now that root access is granted, we can start the Cockpit service. Use the following command:

systemctl start cockpit

Step 6: Checking Cockpit Service Status

To ensure that Cockpit is running smoothly, check its status with:

systemctl status cockpit

Step 7: Finding the Server IP Address

Before accessing the Cockpit web interface, you need to know your server's IP address. Run the following command to find the IP address associated with the eth0 interface:

ifconfig

ipaddress

Take note of the IP address displayed next to inet.

Step 8: Accessing the Cockpit Web Interface

Next, open the web browser by clicking on Activities in the top left corner of your screen and selecting the Firefox icon.

Step 9: Navigating to Cockpit

In your browser, enter the following URL to access the Cockpit web interface. Replace IP_ADDRESS with the actual IP address you noted earlier:

https://IP_ADDRESS:9090

Step 10: Handling SSL Certificate Warnings

Since Cockpit uses a self-signed certificate, your browser may display a warning. To proceed, click on Advanced and then choose Accept the Risk and Continue.

Step 11: Logging into Cockpit

On the login page, enter root as the username and the root password you set earlier. Then, click Log In to access the Cockpit dashboard.

loginCockpit

Step 12: Exploring the Cockpit Dashboard

The Cockpit dashboard displays various system metrics, logs, and services. At the top left, you will see the server’s hostname. On the right side, you will find session configuration options, such as logging out, changing the display language, adding SSH keys, and customizing the Cockpit style.

Cockpit-Dashboard

Step 13: Managing Hosts

Click on the hostname in the top left corner to see a list of connected hosts and the option to add new hosts.

Managing-Hosts

Step 14: System Overview

The Overview tab provides a snapshot of the system, including CPU, memory, disk, and network usage. Additionally, system information and configuration details are readily accessible. You also have the option to reboot or shut down the server from this tab.

system-overview

Step 15: Viewing Logs

Under the Logs tab, you can view server logs, filter them by severity, and search for specific entries. This is crucial for diagnosing system issues.

viewing-logs

Step 16: Monitoring Storage and Networking

Cockpit also provides real-time insights into the server’s storage and networking status. Check the respective Storage and Networking tabs for detailed information.

Step 17: Managing Podman Containers

If you're working with containers, Cockpit makes it easy to manage Podman containers. Navigate to the Podman tab, click on Start Podman Service, and you will be able to view the dashboard where you can pull, run, and manage containers.

podman-container

Step 18: Managing Users and Groups

Under the Accounts tab, you can see a list of users and groups on the server. To add a new user, click Create new account.

managing-user-groups

Step 19: Creating a New User

For example, to create a user named student, enter the user details and click Create. You can assign the user to groups and set their password directly in the Cockpit interface.

create-new-user

Step 20: Verifying the New User

To verify that the student user has been added successfully, navigate back to the Accounts tab and check the list of users.

verify-new-user

Step 21: Managing Services

In the Services tab, you'll find a list of services running on the server. You can start, stop, or restart any service. For example, search for the sshd service, which is enabled by default, to manage SSH connections.

managing-services

Step 22: Stopping the SSH Service

To stop the SSH service, simply toggle the switch next to OpenSSH server daemon. Once stopped, you will see the service status change to "Stopped" under the Status tab.

stop-ssh-service

Step 23: Configuring SELinux

Under the SELinux tab, you can view and change the status of SELinux. If it’s set to Permissive, toggle it to Enforcing to enhance security.

configure-selinux

Step 24: Confirming SELinux Status

Once you’ve toggled SELinux to Enforcing, you can verify its status on the SELinux tab.

confirm-status

Step 25: Accessing the Terminal

Cockpit also provides access to the server’s terminal. You can execute commands and perform administrative tasks directly from the Terminal tab.

access-terminal

Step 26: Exploring More Features

Cockpit is a robust tool that allows administrators to manage and monitor servers easily. Take some time to explore the dashboard, experiment with different features, and gain hands-on experience with server management tasks.

Learning Outcomes

By completing this lab, you will:

  • Simplify Troubleshooting: Master generating and utilizing SOS reports to diagnose server issues efficiently.

  • Monitor Server Health: Use Cockpit to continuously monitor and respond to real-time system health metrics.

  • Enhance Security: Gain hands-on experience in securing systems by managing SELinux configurations.

  • Manage Services: Understand how to start, stop, and restart services to keep systems operational.

Real-World Applications

  • Server Monitoring: Proactively monitoring server health with Cockpit and SOS reports reduces downtime, optimizes server performance, and enables rapid issue resolution.

  • Security Management: Policy management in SELinux is one of the requirements for servers to be secured and compliant with the organization's security requirements.

  • Troubleshooting: These tools are specifically for system administrators so that they are able to identify and fix the problems with quite good speed, which in turn prevents users and operations from being affected too much.

RHCSA Exam Tips

  • SOS Reports: Practice using sosreport with different options such as --batch for non-interactive mode to familiarize yourself with its output.

  • Cockpit Proficiency: Be familiar with starting and stopping services, viewing logs, and monitoring real-time metrics in Cockpit. It’s a tool you will use regularly in the exam and in production.

  • SELinux Management: Know how to toggle SELinux between "Permissive" and "Enforcing" using both the command line and Cockpit interface.

Conclusion

Monitoring servers and troubleshooting them are the core parts of preparing for the RHCSA certification. This practical approach to SOS reports and Cockpit prepares you for the examination as well as practical system administration tasks in real life. These skills will be beneficial in your Linux system administration career, whether you are preparing for the EX200 exam or dealing with production RHEL servers.