Using the troubleshooting tools available within the RHEL environment

Hands-On Lab

 

Photo of Michael Christian

Michael Christian

Course Development Director in Content

Length

01:30:00

Difficulty

Advanced

In this activity, you will practice using the troubleshooting tools available with RHEL 7.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Using the troubleshooting tools available within the RHEL environment

Introduction

In this activity, you will practice using the troubleshooting tools available with RHEL 7.

Users are complaining of general slowness on this particular host ever since a junior employee was using it. They are also complaining about a lack of disk space available. You will need to log in and assess the situation and resolve any issues contributing to these complaints, if necessary.

Solution

Start by logging in to the lab server using the credentials provided on the hands-on lab page:

ssh cloud_user@PUBLIC_IP_ADDRESS

Become the root user:

sudo su -

Collect system information

You should begin by logging in to the host and obtaining the following information to verify the user complaints:

  • Current system load:

    uptime
  • Note the load average shown and compare it to how many processors this server has:

    nproc
  • Current disk usage:

    df -h
  • Swap usage:

    free -m

Performance Co-Pilot is installed. You should use it to help assess the problems.

  • Enable pmcd

    systemctl enable pmcd
  • Start pmcd

    systemctl start pmcd

Resolve disk space issues

  1. Start by using du to find large directories in /:

    du -h --max-depth=1 /
  2. We have narrowed down which directory is consuming the largest amount of space. Let's try and narrow it down a little more:

    du -h --max-depth=1 /home/
  3. Narrow it down a little further:

    du -h --max-depth=1 /home/cloud_user/
  4. The space is being consumed by a file in this directory. Let's list the files in this directory:

    ll /home/cloud_user/
  5. We can see a rather large file called old_personal_files.copy in this directory. Let's delete this file:

    rm -rf /home/cloud_user/old_personal_files.copy
  6. Verify the disk space issue is now resolved:

    df -h

Resolve CPU load issues

  1. Since we have pmcd running, let's use one of it's tools to see what is causing our CPU load issue:

    pcp atop
  2. The list of processes are sorted by CPU usage. This makes it easy to see that the cpuhog.sh process is using the largest amount of CPU. Copy the process ID (PID) for the cpuhog.sh process and close pcp atop.

  3. Now we can kill that process. Replace PID in the following command with the PID of the process:

    kill -9 PID
  4. Verify that the CPU issue is resolved by running pcp atop again. After a moment, we should see the CPU usage return to a normal value:

    pcp atop

Resolve disk I/O issues

  1. With pcp atop still running, sort the list of processes by disk I/O by pressing SHIFT+D.

  2. We can see an iohog.sh command is causing the issue. Same as before, copy the PID for that process and close pcp atop.

  3. We can now kill that process. Replace PID in the following command with the PID of the process:

    kill -9 PID
  4. Verify that the disk I/O issue is resolved by running pcp atop again. After a moment, we should see disk I/O return to normal.

    pcp atop

Conclusion

Congratulations, you've completed this hands-on lab!