How to install Netdata on CentOS/RHEL 8

Install Netdata on CentOS / Red Hat Enterprise Linux (RHEL) 8

Step by Step guide to install Netdata on CentOS / Red Hat Enterprise Linux (RHEL) 8 or similar Linux distros.

 

Table of Contents:

 

What is Netdata?:

Netdata is an open source tool designed to collect real-time metrics, such as CPU usage, disk activity, bandwidth usage, website visits, etc., and then display them in live, easy-to-interpret charts.

The tool is designed to visualize activity in the greatest possible detail, allowing the user to obtain an overview of what is happening and what has just happened in their system or application.

Netdata consists of a daemon that, when executed, is responsible for collecting and displaying information in real-time.

It is a lightweight tool, mostly written in C, Python, and JavaScript, which uses minimal resources: about 2% on a single-CPU system.

It can be run in any Linux system to monitor any system or application, and is capable of running on PCs, servers, and embedded Linux devices. (Source: Wikipedia)

Install Netdata on CentOS / Red Hat Enterprise Linux (RHEL) 8

Netdata Features:

Netdata is designed to be installed on a system without interrupting any of the applications running on it. It operates according to the memory requirements specified by the user, using only idle CPU cycles. Once the application begins, it will not perform disk I/O beyond logging. The tool saves to disk at the end of its execution and reloads at startup.

By default it contains certain plugins that collect key system metrics, but its behavior is extensible by using its plugin API.

Netdata can be run on virtually anything utilizing a Linux kernel and its graphics can be embedded into web pages. It has an interface with customizable themes and can be manually configured by the user, through simple HTML.

There are no dependencies, as it operates as its own web server, with static web files.

Starting with v1.12, Netdata collects anonymous usage information by default and sends it to Google Analytics, a feature which can be disabled via manual configuration.

 

Environment Specification:

We are using a minimal Red Hat Enterprise Linux 8 virtual machine with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - Red Hat Enterprise Linux 8.5
  • Hostname – netdata-01.centlinux.com
  • IP Address - 192.168.116.243 /24

 

Update Linux Operating System:

By using a ssh client, connect with netdata-01.centlinux.com as root user.

Rebuild cache of enabled yum repositories.

# dnf makecache
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - BaseOS  3.2 kB/s | 4.1 kB     00:01
Red Hat CodeReady Linux Builder for RHEL 8 x86_ 4.9 kB/s | 4.5 kB     00:00
Red Hat Enterprise Linux 8 for x86_64 - AppStre 5.4 kB/s | 4.5 kB     00:00
Metadata cache created.

Update your Linux operating system by executing following command.

# dnf update -y

The above command may updates your Linux Kernel. In this case, you should reboot your Linux server with newly installed Linux Kernel.

# reboot

Check the Linux operating system and Kernel versions.

# uname -r
4.18.0-348.12.2.el8_5.x86_64

# cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.5 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.5"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.5 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.5
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.5"

 

Install Third Party Yum Repositories:

Netdata software requires some packages that are not available in standard yum repositories. Therefore, you are required to install a few third party yum repositories on your Linux server.

First of all, install EPEL (Extra Packages for Enterprise Linux) yum repository by executing following command.

# dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

You also need to enable PowerTools repository.

For CentOS / Rocky Linux you can execute following command to enable PowerTools repository.

# dnf install -y 'dnf-command(config-manager)'
# dnf -y config-manager --set-enabled PowerTools

Whereas, for RHEL, execute the following command.

# subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
1 local certificate has been deleted.
Repository 'codeready-builder-for-rhel-8-x86_64-rpms' is enabled for this system.
Build cache for newly installed yum repositories.

You may also required to add Okay yum repository, Because some of the Netdata required packages are provided thereby.

# dnf install -y http://repo.okay.com.mx/centos/8/x86_64/release/okay-release-1-3.el8.noarch.rpm

After installing Okay repository, you may need to edit the okay.repo file to make it usable.

Edit okay.repo by using vim text editor.

# vi /etc/yum.repos.d/okay.repo

Locate following lines therein.

failovermethod=priority
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OKAY

And amend them as follows.

#failovermethod=priority
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OKAY

Remove any cached packages from the Linux operating system.

# dnf clean packages
Updating Subscription Management repositories.
89 files removed

Update Okay repository as follows.

# dnf update -y okay-release

Edit the okay.repo file again. Because, the update process also remove the changes that you have made in previous steps.

# vi /etc/yum.repos.d/okay.repo

Locate and comment following directive in this file.

#failovermethod=priority

Build cache for newly installed yum repositories.

# dnf makecache
Updating Subscription Management repositories.
Extra Packages for Enterprise Linux 8 - x86_64   32 kB/s |  18 kB     00:00
Extra Packages for Enterprise Linux Modular 8 -  32 kB/s |  18 kB     00:00
Extra OKay Packages for Enterprise Linux - x86_ 150 kB/s | 4.3 MB     00:29
Red Hat Enterprise Linux 8 for x86_64 - BaseOS  4.4 kB/s | 4.1 kB     00:00
Red Hat CodeReady Linux Builder for RHEL 8 x86_ 3.3 kB/s | 4.5 kB     00:01
Red Hat Enterprise Linux 8 for x86_64 - AppStre 6.1 kB/s | 4.5 kB     00:00

 

Install Netdata Prerequisites:

Since, you have already setup the required yum repositories, therefore, you can easily install Netdata prerequisites packages on your Linux server by executing following command.

# dnf install -y autoconf automake curl gcc git cmake libuuid-devel openssl-devel libuv-devel lz4-devel make nc pkgconfig python3 zlib-devel gcc-c++ libbpf-devel

Netdata also requires Judy-devel package from Okay yum repository. But it's installation is little bit tricky.

Judy is a dependency of Judy-devel package. But an older version of Judy package is also available in Red Hat Enterprise Linux (RHEL) Appstream repository.

Therefore, you need to disable the RHEL Appstream before install Judy-devel package.

# subscription-manager repos --disable rhel-8-for-x86_64-appstream-rpms
Repository 'rhel-8-for-x86_64-appstream-rpms' is disabled for this system.

Now install Judy-devel package as follows.

# dnf install -y Judy-devel

After successful installation of Judy-devel, enable the RHEL Appstream again.

# subscription-manager repos --enable rhel-8-for-x86_64-appstream-rpms
Repository 'rhel-8-for-x86_64-appstream-rpms' is enabled for this system.

 

Install Netdata on CentOS / RHEL 8:

Netdata is available to download at GitHub. Therefore, execute git command to clone Netdata repository.

# cd
# git clone https://github.com/netdata/netdata.git --depth=100 --recursive

The Netdata software has been downloaded into netdata directory.

Now execute the Netdata installation script with following command switches, to install Netdata on your Linux server.

# cd netdata
# ./netdata-installer.sh --stable-channel --dont-wait --install /opt

  ^
  |.-.   .-.   .-.   .-.   .  netdata
  |   '-'   '-'   '-'   '-'   real-time performance monitoring, done right!
  +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->


  You are about to build and install netdata to your system.

  The build process will use /tmp for
  any temporary files. You can override this by setting $TMPDIR to a
  writable directory where you can execute files.

  It will be installed at these locations:

   - the daemon     at /opt/netdata/usr/sbin/netdata
   - config files   in /opt/netdata/etc/netdata
   - web files      in /opt/netdata/usr/share/netdata
   - plugins        in /opt/netdata/usr/libexec/netdata
   - cache files    in /opt/netdata/var/cache/netdata
   - db files       in /opt/netdata/var/lib/netdata
   - log files      in /opt/netdata/var/log/netdata
   - pid file       at /opt/netdata/var/run/netdata.pid
   - logrotate file at /etc/logrotate.d/netdata

  This installer allows you to change the installation path.
  Press Control-C and run the same command with --help for help.


  NOTE:
  Anonymous usage stats will be collected and sent to Netdata.
  To opt-out, pass --disable-telemetry option to the installer or export
  the environment variable DO_NOT_TRACK to a non-zero or non-empty value
  (e.g: export DO_NOT_TRACK=1).
...
...
...
Memory de-duplication instructions

You have kernel memory de-duper (called Kernel Same-page Merging,
or KSM) available, but it is not currently enabled.

To enable it run:

    echo 1 >/sys/kernel/mm/ksm/run
    echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs

If you enable it, you will save 40-60% of netdata memory.

 --- Check version.txt ---
 --- Check apps.plugin ---
 --- Copy uninstaller ---
 --- Basic netdata instructions ---

netdata by default listens on all IPs on port 19999,
so you can access it with:

  http://this.machine.ip:19999/

To stop netdata run:

  systemctl stop netdata

To start netdata run:

  systemctl start netdata

Uninstall script copied to: /opt/netdata/usr/libexec/netdata/netdata-uninstaller.sh

 --- Installing (but not enabling) the netdata updater tool ---
Failed to disable unit: Unit file netdata-updater.timer does not exist.
Update script is located at /opt/netdata/usr/libexec/netdata/netdata-updater.sh

 --- Check if we must enable/disable the netdata updater tool ---
You chose *NOT* to enable auto-update, removing any links to the updater from cron (it may have happened if you are reinstalling)

 --- Wrap up environment set up ---
Preparing .environment file
[/root/netdata]# chmod 0644 /opt/netdata/etc/netdata/.environment
 OK

Setting netdata.tarball.checksum to 'new_installation'

 --- We are done! ---

  ^
  |.-.   .-.   .-.   .-.   .-.   .  netdata                          .-.   .-
  |   '-'   '-'   '-'   '-'   '-'   is installed and running now!  -'   '-'
  +----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+--->

  enjoy real-time performance and health monitoring...

Netdata software has been installed and the relevant network services has been started by the installation process.

 

Configure Linux Firewall:

Netdata software uses default service port 19999/tcp. Therefore, you may need to allow this port in Linux firewall to make it accessible across the network.

# firewall-cmd --permanent --add-port=19999/tcp
success
# firewall-cmd --reload
success

 

Access Netdata Web Application:

Open URL http://netdata-01.centlinux.com:19999 in a web browser.

Netdata Dashboard

You have reached at the dashboard of Netdata web application. It is now showing the performance statistics of your Linux server.

 

Conclusion:

In this article, you have successfully learned how to install Netdata on CentOS / Red Hat Enterprise Linux 8 or similar Linux distros.

Post a Comment

Previous Post Next Post