Steps to Setup Sysdig to Monitor Linux System on Ubuntu 20.04 LTS

Sysdig is a free & open source monitoring tool & used to monitor system load. It helps to capture and analyze application logs and troubleshoot the system-related issues. It is used to monitor CPU usage, Processes CPU, memory usage & Users.

There are some steps to Install & Configure Sysdig Monitoring tool on Ubuntu:

Step 1: Update the System.

apt-get update

Step 2: Install Sysdig on system.

apt install sysdig

  • Here is the command output.

root@ip-172-31-31-20:/home/ubuntu# apt install sysdig
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
....
libmpc3 libonig5 libprotobuf17 libquadmath0 libstdc++-9-dev libtbb2 libtsan0 libubsan1 linux-libc-dev make manpages-dev sysdig-dkms
Suggested packages:
....
libtsan0 libubsan1 linux-libc-dev make manpages-dev sysdig sysdig-dkms
0 upgraded, 56 newly installed, 0 to remove and 40 not upgraded.
Need to get 47.9 MB of archives.
After this operation, 216 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
.....
sysdig-probe.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/5.11.0-1022-aws/updates/dkms/
depmod...
DKMS: install completed.
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...

  • Check Sysdig version.

sysdig --version

  • Here is the command output.

root@ip-172-31-31-20:/home/ubuntu# sysdig --version
sysdig version 0.26.4

Step 3: Sysdig Syntax & Examples:

  • Run the sysdig command to view the linux system stream of events updated in real-time:

sysdig

  • To print the running processes, CPU usage, and memory usage:

csysdig

  • Here is the command output.

  • Press F2 Key for more menu/options.

  • From here, we can use arrow key to select any things that we want to monitor in the left pane and Press Enter.
  • For Example: Select Processes CPU & Press Enter.

  • Here is Processes CPU details.

  • To monitor all network connections.

sysdig -c netstat

  • Here is the command output.

  • To capture the system events and save it to a target file.

sysdig -n 10 -w sysdig-file.scap

  • Now,read the captured data.

sysdig -r sysdig-file.scap

  • Here is the command output.

  • To display the process as per the CPU usage.

sysdig -c topprocs_cpu

  • Here is the command output.

  • List all the available Sysdig chisels.

sysdig -cl

  • Here is the command output.

  • To print the interactive user activity.

sysdig -c spy_users

  • Here is the command output.

root@ip-172-31-31-20:/home/ubuntu# sysdig -c spy_users
8582 08:17:01 root) cd /
8582 08:17:01 root) run-parts --report /etc/cron.hourly

  • To monitor the HTTP request log.

sysdig -c httplog

  • To display all the available options/commands of sysdig & csysdig.

man sysdig
&&
man csysdig

Leave a Reply