How to Install Sysdig to Monitor Your Linux System

choubertsprojects

The Best WordPress plugins!

1. WP Reset

2. WP 301 Redirects

3. WP Force SSL

Sysdig is a powerful Linux system monitor that helps you troubleshoot and maintain your computer. Here’s how to install it on Ubuntu 18.04 LTS so you can get started with the important tasks of managing, securing, and improving your workstation as soon as possible!

The “install sysdig centos 7” is a guide that explains how to install the Sysdig system into your Linux. The guide also includes information on why you might want to use the tool, and how it can help you monitor your system.

How to Install Sysdig to Monitor Your Linux System

Your Linux system is an outstanding server and desktop platform. However, like with any other complicated system, regular monitoring is required to maintain your system running at its best. Fortunately, Sysdig is just a short distance away!

Sysdig is a powerful Linux monitoring tool that can keep an eye on threats, failures, and use trends, among other things. And in this article, you’ll learn how to install Sysdig while also learning about specific configuration settings for better monitoring your Linux system.

Continue reading to ensure you never miss another ‘alarm’!

Prerequisites

This will be a hands-on presentation in this course. If you want to follow along, make sure you have the following items on hand.

  • A Linux system – Ubuntu 20.04 LTS is used in this tutorial, although any Linux distribution will work.

How to Install Ubuntu 20.04 LTS (How to Install Ubuntu 20.04 LTS (How to Install Ubuntu 20.04 LTS

  • A user with sudo rights who isn’t root.

Sysdig installation on Linux

Most recent Linux distributions include the Sysdig command-line tool, which you may install just like any other program you’ve installed so far on your system.

To ensure you have the most recent updates from your distribution’s repositories, open your terminal and perform the apt update command below. This command will update the package listings on your system and may take a few minutes to finish.

Updating your System's Package ListsUpdating the Package Lists on your System

Associated:Examples of Ubuntu Apt Learning

2. After that, use the apt install command to download (curl) and install the Sysdig packages. This script also installs the following extra modules, which will be needed later in this tutorial:

  • gnupg – The GNU Privacy Guard is an utility for secure data storage and transmission. This package allows you to get Sysdig’s public GPG key, which you may use to check the legitimacy of Sysdig packages.
  • software-properties-common — Allows you to manage your software sources quickly from the command line or a GUI. The add-apt-repository command may be used to add the Sysdig package repositories with this package.
  • linux-headers-$(uname -r) — This package contains the files needed to generate kernel modules for your operating kernel. Because Sysdig may be installed on a computer with an earlier stock kernel, this package is necessary.

sudo apt install gnupg software-properties-common curl -y && sudo apt install linux-headers-$(uname -r) -y

Sysdig Installation's Requisite PackagesSysdig Installation’s Requisite Packages

3. Add Sysdig’s GPG public key (GPG) to your APT’s keyring using the curl command below. This tool allows you to check if the packages you obtained from sysdig.com are genuine and unaltered.

-s curl apt-key add – https://s3.amazonaws.com/download.draios.com/DRAIOS-GPG-KEY.public

After you’ve successfully inserted the key, you’ll get an OK message, as seen below.

APT's Keyring with the GPG keyAPT’s Keyring with the GPG key

4. Now use the curl command below to secretly (-s) download and install the Sysdig repositories as draios.list on your machine. The.list extension informs APT that the file is a collection of URLs for repositories rather than a single URL.

curl -s -o draios.list in /etc/apt/sources.list.d http://download.draios.com/stable/deb/draios.list

5. Rerun the apt update command to download the new Sysdig repositories and update your APT package lists with the information from the new repositories.

If your APT is setup properly, you should receive the following output.

Updating your APT's Package ListsUpdating the Package Lists in APT

6. To install Sysdig on your PC, perform the apt install command following after obtaining the Sysdig repositories. The sysdig package, as well as its accompanying packages, are downloaded and installed using this command.

sysdig -y sudo apt install

Sysdig InstallationSysdig Installation

7. Finally, run the sysdig command to see what Sysdig version you have installed.

The version number is used to identify whether or not your Sysdig package is current. The version also indicates whether or not Sysdig’s release has an influence on system performance.

As of this writing, the most recent version of sysdig is 0.28.0. It’s possible that your version number is different.

Installed Sysdig Version VerificationInstalled Sysdig Version Verification

csysdig is a tool for monitoring Linux systems.

Now that you’ve installed Sysdig, you can use it to see what’s happening on with your system. There are several options in the Sysdig command-line tool that provide you multiple perspectives of your system and its activities. The csysdig command is the most basic example.

To observe what’s going on on your system right now, use the command csysdig without any parameters. The command will display the activity of all presently executing processes.

To gain complete access to your system, you must execute Sysdig commands with sudo capability. Some system activities, such as the output of the /proc file system, may be concealed by default from non-root users. Many of Sysdig’s gimmicks, such as the sysdig-probe kernel module, need sudo access to auto-load the kernel symbols required.

You’ll need to reinstall the ncurses-term package if you get the following problem. After a new Sysdig installation, the ncurses-term package is prone to corruption. Sysdig’s ncurses UI is supported via the ncurses-term package.

When running csysdig, an error occurs.When running csysdig, an error occurs.

If the csysdig command is successful, the output will be arranged into tabs as seen below.

  Description
PID The Linux kernel assigns a Process ID to each process. PIDs are used to monitor and manage processes.
PPID The process’s parent process ID. PPID is used to track a process back to its parent processes. PID and PPID work together to identify a process on your system.
CPU On a scale of 0 to 100 percent, the proportion of CPU utilized by the program since it began may be viewed, with 100 percent equaling entire CPU utilization. You may utilize CPU use to identify apps that are using too much of the system’s resources.
USER The username of the person who initiated the procedure. USER is used to determine who is running a process that you are interested in.
TH The username of the person who initiated the procedure. USER is used to determine who is running a process that you are interested in.
VIRT The application’s overall virtual memory use. You use VIRT to locate apps that are using too much memory on your computer.
RES The number of physical memory pages mapped to a process’s resident memory pages. You utilize RES to locate apps that are using too much memory on your computer.
FILE The application’s file descriptor on the disk. FILE allows you to observe which files are regularly read or written, which is generally a sign of I/O activity.
NET This is the application’s network socket descriptor. You may use NET to examine which network connections the process is using and how much data is being sent each second in bytes.
Command This is the application’s network socket descriptor. You may use NET to examine which network connections the process is using and how much data is being sent each second in bytes.

The csysdig interface resembles that of monitoring tools such as htop at first sight.

Using Csysdig to monitor system processesUsing Csysdig to monitor system processes

When you press F2, the top tabs will alter to display a new set of information on the left, arranged into tabs, as illustrated below.

These are referred to as “views” by Sysdig because they are distinct system perspectives that are arranged by the kind of information they display and provide greater context. Because these views are built on LUA scripts, you may alter the view and adapt the scripts to extract various data from the system.

Using the Csysdig Views to see system informationUsing the Csysdig Views to see system information

As illustrated below, the LUA scripts are placed by default in the /usr/share/sysdig/chisels directory.

ls /usr/share/sysdig/chisels /usr/share/sysdig/chisels /usr/share/sys

Files (scripts) in the /usr/share/sysdig/chisels directory are listed here.Files (scripts) in the /usr/share/sysdig/chisels directory are listed here.

Sysdig Chisels are used to keep track of CPU-intensive processes.

Known as “chisels,” Sysdig includes various ready-to-use chisels that automatically capture certain system information. Perhaps your computer’s processor is running slowly. If that’s the case, using the sysdig command with a specific chisel will show you which applications/processes are using the majority of your CPU.

1. To see a list of available chisels, use the sysdig command.

Only a few chisels are visible in the screenshot below. However, the official literature has a comprehensive list of all possible chisels, which you may read about.

Sysdig chisels are LUA scripts as well. You can make your own chisels to track particular system data or construct custom views, but this is outside the scope of this article.

Sysdig Chisels are shown.Sysdig Chisels are shown.

2. Then, to get detailed information (-i) about a single chisel, such as topprocs cpu in our sample, use the command below.

sysdig -i topprocs cpu sudo sysdig -i topprocs cpu

Below is a list of all the details about the topprocs cpu chisel, including its name, category, and a short explanation of what it performs.

The topprocs cpu chisel is classed as CPU Usage in this example, and it displays the top process with the greatest CPU consumption.

You may begin utilizing a chisel after you have a good understanding of how it works.

displaying all topprocs cpu Chisel informationdisplaying all topprocs cpu Chisel information

3. Use the sysdig command with the correct chisel (-c topprocs cpu) to locate the apps that are utilizing the most CPU on your system.

sysdig -c topprocs cpu sudo sysdig -c topprocs cpu

In this video, Sysdig catches the top ten CPU-intensive processes and publishes them on the console. The most CPU-intensive process (sshd) will be listed first, making it easier to locate.

The process with the greatest CPU use is listed first.The process with the greatest CPU use is listed first.

Monitoring System Data That Has Been Filtered

The output may be huge in certain circumstances, making it difficult to filter system information based on a particular purpose. Fortunately, Sysdig has a robust filtering option that use Lua syntax for efficient filtering.

Let’s say you’re just searching for sshd processes that use a lot of CPU. A filter expression may be defined using a PID or process name.

To see just the sshd process that utilizes a lot of CPU, use the sysdig command below.

proc.name=sshd sudo sysdig

You’ll obtain a filtered output without any extra process details, as seen below.

More information on the sshd process may be obtained from the output, such as why the sshd process requires more CPU or memory, and so on.

The SSHD procedure is listed below.The SSHD procedure is listed below.

Creating an Event Log File for System Monitoring

Event log files are one of Sysdig’s best features, since they enable you to capture all information about what your application or system performs for subsequent study. The information in the event log files is the same as the command-line outputs in the previous instances, but it is stored to a file on disk.

1. Execute the command below. Syslog will save all sysdig outputs in a file named ata.scap that you generate with the -w option in your home directory.

The.scap file extension is used to save data streams as human-readable text.

2. Then, to list all files in the working directory, use the ls -la command.

As illustrated below, you’ll notice a new file entitled ata.scap in your home directory.

All Files in the Home DirectoryAll Files in the Home Directory

3. Finally, when you SSH into your server, use the following command to have Sysdig read (-r) the Sysdig event log file (ata.scap) and report your system’s behavior.

Viewing the.scap file (ata.scap)Viewing the.scap file (ata.scap)

Conclusion

You learnt how to install Sysdig on Ubuntu 20.04 and how to use csysdig to gather information about your system, apps, and security in this post. You also mentioned generating an event log file to document the activity of your system.

You’ve learned that having Sysdig installed on your system gives you access to a variety of useful tools. These tools also assist you in gaining a better understanding of how your system, applications, and infrastructure operate.

Why not use Sysdig to decode your HTTP traffic now that you have this newfound knowledge? Or how to use Sysdig tracers to find application bottlenecks?

The “sysdig system calls” is a tool that allows users to monitor the Linux system. The installation process is straightforward and easy to follow.

Related Tags

  • sysdig linux
  • sysdig agent configuration
  • sysdig cli
  • sysdig install
  • sysdig agent install

Table of Content