How to install Sysdig to Monitor System Load on Ubuntu 20.04

Sysdig is an open-source and comprehensive activity monitoring tool for Linux. It is used to capture and analyze application logs and helps you to troubleshoot system-related issues. It displays a complete overview of CPU usage, Memory usage, Users, IO in a command-line interface. It is available for Linux, OS X, and Windows operating systems.

In this post, we will show you how to install and use the Sysdig monitoring tool on Linux.

Prerequisites

  • A server running Ubuntu 20.04.
  • A root password is configured on the server.

Install Sysdig

For Debian based operating systems like, Ubuntu and Debian, install the Sysdig with the following command:

apt-get install gnupg software-properties-common curl -y
curl -s https://s3.amazonaws.com/download.draios.com/stable/install-sysdig | bash

For RPM-based operating systems like CentOS, RHEL, and Fedora, install the Sysdig with the following command:

rpm --import https://s3.amazonaws.com/download.draios.com/DRAIOS-GPG-KEY.public
curl -s -o /etc/yum.repos.d/draios.repo https://s3.amazonaws.com/download.draios.com/stable/rpm/draios.repo
yum install sysdig -y

After installing Sysdig, verify the installed version of Sysdig using the following command:

sysdig --version

You should get the following output:

sysdig version 0.27.1

Working with Sysdig

You can run the csysdig command to display the running processes, CPU usage, and memory usage:

csysdig

You should see the following screen:

csysdig

Now press F2 to open the other menu as shown below:

processes

From here, you can arrow key to choose any things that you want to monitor in the left pane and hit Enter. For example, select the connections and hit Enter. You should see all incoming connections on the following screen:

connections

To view Processes and CPU information, select Processes CPU and hit Enter. You should see the following page:

CPU processes

If you want to monitor all network connections directly from the command-line interface, run the following command:

sysdig -c netstat

You should see the following screen:

sysdig netstat

You can see the HTTP request log using the following command:

sysdig -c httplog

You should see all incoming HTTP requests in the following output:

2021-07-24 15:23:26.228051410 < method=GET url=69.87.220.62/ response_code=200 latency=1ms size=3138B
2021-07-24 15:23:53.139933688 < method=GET url=69.87.220.62/ response_code=200 latency=1ms size=3138B

To monitor the process as per the CPU usage, run the following command:

sysdig -c topprocs_cpu

You should see the following screen:

sysdig -c topprocs_cpu

Run the following command to see all options available with sysdig command:

sysdig -cl

You should see the following screen:

sysdig -cl

You can use sysdig with spy_users to display interactive user activity.

sysdig -c spy_users

You should see the following output:

13133 15:38:03 root) free -m
13133 15:38:22 root) df -h

Conclusion

In the above guide, we explained how to install and use Sysdig to monitor the system activity in real-time. I hope this will help you to troubleshoot system-related issues.

Share this page:

Suggested articles

0 Comment(s)

Add comment