mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-29 21:41:00 +08:00
538 lines
18 KiB
Markdown
538 lines
18 KiB
Markdown
[#]: subject: "How To Install Netdata Performance Monitoring Tool In Linux"
|
|
[#]: via: "https://ostechnix.com/netdata-real-time-performance-monitoring-tool-linux/"
|
|
[#]: author: "sk https://ostechnix.com/author/sk/"
|
|
[#]: collector: "lkxed"
|
|
[#]: translator: " "
|
|
[#]: reviewer: " "
|
|
[#]: publisher: " "
|
|
[#]: url: " "
|
|
|
|
How To Install Netdata Performance Monitoring Tool In Linux
|
|
======
|
|
|
|
This guide explains **what is Netdata**, how to **install Netdata in Linux** and how to analyze and **monitor a Linux system performance and resource usage** with Netdata.
|
|
|
|
### 1. What is Netdata?
|
|
|
|
**NetData** is a distributed, real-time, performance and health monitoring tool for systems and applications. It provides unparalleled insights of everything happening on a system in real-time. You can view the results in a highly interactive web-dashboard.
|
|
|
|
Using Netdata, you can get a clear idea of what is happening now, and what happened before in your systems and applications.
|
|
|
|
Netdata runs on all physical and virtual servers, containers, even IoT/edge devices.
|
|
|
|
You don't need to be an expert to deploy this tool in your Linux systems. Netdata just works fine out of the box with zero configuration, and zero dependencies. Just install this utility and sit back, Netdata will take care of the rest.
|
|
|
|
Netdata has its own **built-in webserver** to display the result in graphical format. Netdata is quite fast and efficient, and it will immediately start to analyze the performance of your system in no time after installing it.
|
|
|
|
Netdata is written using **C** programming language, so it is extremely light weight. It consumes less than 3% of a single core CPU usage and a 10-15MB of RAM.
|
|
|
|
We can easily embed the Netdata charts on any existing web pages. It has a plugin API, so that you can monitor any application.
|
|
|
|
Here is the list of things that will be monitored by Netdata utility in your Linux system.
|
|
|
|
- CPU usage,
|
|
- RAM Usage,
|
|
- Swap memory usage,
|
|
- Kernel memory usage,
|
|
- Hard disks and its usage,
|
|
- Network interfaces,
|
|
- IPtables,
|
|
- Netfilter,
|
|
- DDoS protection,
|
|
- Processes,
|
|
- Applications,
|
|
- NFS server,
|
|
- Web server (Apache & Nginx),
|
|
- Database servers (MySQL),
|
|
- DHCP server,
|
|
- DNS server,
|
|
- Email serve,r
|
|
- Proxy server,
|
|
- Tomcat,
|
|
- PHP,
|
|
- SNP devices,
|
|
- And many more.
|
|
|
|
Netdata is free, open source tool and it supports Linux, FreeBSD and Mac OS.
|
|
|
|
### 2. Install Netdata In Linux
|
|
|
|
Netdata can be installed on any Linux distributions that have **Bash** installed. There are two ways to install Netdata in Linux.
|
|
|
|
We can **install Netdata using an automatic one-liner script** or **install Netdata from git** checkout. First, we will see how to install
|
|
|
|
#### 2.1. Install Netdata using Automatic One-line Installation Script
|
|
|
|
The best as well as the easiest way to install Netdata is to run the following one-liner command as normal user:
|
|
|
|
```
|
|
$ wget -O /tmp/netdata-kickstart.sh https://my-netdata.io/kickstart.sh && sh /tmp/netdata-kickstart.sh
|
|
```
|
|
|
|
If `wget` is not available, use `curl` instead:
|
|
|
|
```
|
|
$ curl https://my-netdata.io/kickstart.sh > /tmp/netdata-kickstart.sh && sh /tmp/netdata-kickstart.sh
|
|
```
|
|
|
|
This method is fully automatic on any Linux and Unix distributions, such as Debian, Fedora, RHEL, CentOS, AlmaLinux, Rocky Linux, openSUSE and macOS etc.
|
|
|
|
The automatic installation script will download and install everything needed to up and run Netdata. It will also enable automatic and nightly updates.
|
|
|
|
If you don't like the auto-installer script method, you can follow the steps below to install Netdata from Git checkout.
|
|
|
|
#### 2.2. Install Netdata from Git
|
|
|
|
First, we need to install required dependencies. The prerequisites can be installed using automatic requirements installer script or manually using the package manager.
|
|
|
|
##### 2.2.1. Install Prerequisites using Automatic Requirements Installer
|
|
|
|
To install the necessary dependency packages for having a **basic Netdata installation** only, run:
|
|
|
|
```
|
|
$ curl -Ss 'https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh' >/tmp/install-required-packages.sh && bash /tmp/install-required-packages.sh -i netdata
|
|
```
|
|
|
|
To install the necessary dependency packages for having a **full Netdata installation** to monitor everything, run:
|
|
|
|
```
|
|
$ curl -Ss 'https://raw.githubusercontent.com/netdata/netdata/master/packaging/installer/install-required-packages.sh' >/tmp/install-required-packages.sh && bash /tmp/install-required-packages.sh -i netdata-all
|
|
```
|
|
|
|
If you prefer manual prerequisites installation, follow the steps in the section below.
|
|
|
|
##### 2.2.2. Install Prerequisites using Manually Package Manager
|
|
|
|
Depending upon the Linux distribution, use any one of the following commands to install the necessary prerequisites using your distribution's default package manager.
|
|
|
|
**Debian / Ubuntu:**
|
|
|
|
```
|
|
$ sudo apt-get install zlib1g-dev uuid-dev libuv1-dev liblz4-dev libssl-dev libelf-dev libmnl-dev libprotobuf-dev protobuf-compiler gcc g++ make git autoconf autoconf-archive autogen automake pkg-config curl python cmake
|
|
```
|
|
|
|
**Fedora:**
|
|
|
|
```
|
|
$ sudo dnf install zlib-devel libuuid-devel libuv-devel lz4-devel openssl-devel elfutils-libelf-devel libmnl-devel protobuf-devel protobuf-compiler gcc gcc-c++ make git autoconf autoconf-archive autogen automake pkgconfig curl findutils python cmake
|
|
```
|
|
|
|
**CentOS / Red Hat Enterprise Linux older versions:**
|
|
|
|
```
|
|
$ sudo yum install autoconf automake curl gcc gcc-c++ git libmnl-devel libuuid-devel openssl-devel libuv-devel lz4-devel elfutils-libelf-devel protobuf protobuf-devel protobuf-compiler make nc pkgconfig python zlib-devel cmake
|
|
```
|
|
|
|
**RHEL 8.x / CentOS 8.x / AlmaLinux 8.x. / Rocky Linux 8.x:**
|
|
|
|
```
|
|
# Enable config-manager
|
|
$ sudo dnf install -y 'dnf-command(config-manager)'
|
|
|
|
# Enable PowerTools
|
|
$ sudo dnf config-manager --set-enabled powertools
|
|
|
|
# Enable EPEL
|
|
$ sudo dnf install -y epel-release
|
|
|
|
# Install Repo for libuv-devl (NEW)
|
|
$ sudo dnf install -y http://repo.okay.com.mx/centos/8/x86_64/release/okay-release-1-3.el8.noarch.rpm
|
|
|
|
# Install Devel Packages
|
|
$ sudo dnf install autoconf automake curl gcc git cmake libuuid-devel openssl-devel libuv-devel lz4-devel make nc pkgconfig python3 zlib-devel
|
|
```
|
|
|
|
**openSUSE:**
|
|
|
|
```
|
|
$ sudo zypper install zlib-devel libuuid-devel libuv-devel liblz4-devel libopenssl-devel libelf-devel libmnl-devel protobuf-devel gcc gcc-c++ make git autoconf autoconf-archive autogen automake pkgconfig curl findutils python cmake
|
|
```
|
|
|
|
After installing the required dependencies, install NetData from Git checkout as shown below.
|
|
|
|
##### 2.2.3. Install Netdata
|
|
|
|
Git clone the Netdata repository:
|
|
|
|
```
|
|
$ git clone https://github.com/netdata/netdata.git --depth=100 --recursive
|
|
```
|
|
|
|
The above command will create a directory called **'netdata'**in the current working directory.
|
|
|
|
Change to the 'netdata' directory:
|
|
|
|
```
|
|
$ cd netdata/
|
|
```
|
|
|
|
Finally, install and start Netdata using command:
|
|
|
|
```
|
|
$ sudo ./netdata-installer.sh
|
|
```
|
|
|
|
**Sample output:**
|
|
|
|
```
|
|
^
|
|
|.-. .-. .-. .-. .-. . 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 /usr/sbin/netdata
|
|
- config files in /etc/netdata
|
|
- web files in /usr/share/netdata
|
|
- plugins in /usr/libexec/netdata
|
|
- cache files in /var/cache/netdata
|
|
- db files in /var/lib/netdata
|
|
- log files in /var/log/netdata
|
|
- pid file at /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 DISABLE_TELEMETRY to a non-zero or non-empty value
|
|
(e.g: export DISABLE_TELEMETRY=1).
|
|
|
|
Press ENTER to build and install netdata to your system > **## Press ENTER Key**
|
|
|
|
[...]
|
|
|
|
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: /usr/libexec/netdata/netdata-uninstaller.sh
|
|
|
|
--- Installing (but not enabling) the netdata updater tool ---
|
|
Update script is located at /usr/libexec/netdata/netdata-updater.sh
|
|
|
|
--- Wrap up environment set up ---
|
|
Preparing .environment file
|
|
[/home/ostechnix/netdata]# chmod 0644 /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...
|
|
```
|
|
|
|
![Install Netdata in Linux][1]
|
|
|
|
Install Netdata in Linux
|
|
|
|
Congratulations! Netdata has been installed and started.
|
|
|
|
#### 2.3. Install Netdata using Package Manager
|
|
|
|
Netdata is available in the default repositories of some Linux distributions. These packages might be bit outdated.
|
|
|
|
**Alpine Linux:**
|
|
|
|
To install Netdata in Alpine Linux, use **[apk][2]** package manager:
|
|
|
|
```
|
|
$ sudo apk add netdata
|
|
```
|
|
|
|
**Arch Linux:**
|
|
|
|
The Netdata is available in the Arch Linux `**[community]**` repository. So, we can install it with [**pacman**][3] using command:
|
|
|
|
```
|
|
$ sudo pacman -S netdata
|
|
```
|
|
|
|
**Debian / Ubuntu:**
|
|
|
|
```
|
|
$ sudo apt install netdata
|
|
```
|
|
|
|
**Fedora:**
|
|
|
|
```
|
|
$ sudo dnf install netdata
|
|
```
|
|
|
|
**RHEL / CentOS / AlmaLinux / Rocky Linux:**
|
|
|
|
In Enterprise Linux operating systems, you need to enable **`[EPEL]`** repository and then install Netdata.
|
|
|
|
```
|
|
$ sudo dnf install epel-release
|
|
```
|
|
|
|
```
|
|
$ sudo dnf install netdata
|
|
```
|
|
|
|
**SUSE / openSUSE:**
|
|
|
|
```
|
|
$ sudo zypper install netdata
|
|
```
|
|
|
|
To know other installation methods, refer the [**official installation instructions page**][4].
|
|
|
|
### 3. Allow Netdata Default Port via Firewall or Router
|
|
|
|
If your system stays behind any firewall or router, you must allow the default port **19999** to access the NetData web interface from any remote systems on the network,.
|
|
|
|
**On Debian, Ubuntu:**
|
|
|
|
```
|
|
$ sudo ufw allow 19999
|
|
```
|
|
|
|
**On Fedora, RHEL, CentOS, AlmaLinux and Rocky Linux:**
|
|
|
|
```
|
|
$ sudo firewall-cmd --permanent --add-port=19999/tcp
|
|
```
|
|
|
|
```
|
|
$ sudo firewall-cmd --reload
|
|
```
|
|
|
|
### 4. Starting and Stopping Netdata Service
|
|
|
|
To enable and start Netdata service on systems that use **Systemd**, run:
|
|
|
|
```
|
|
$ sudo systemctl enable netdata
|
|
```
|
|
|
|
```
|
|
$ sudo systemctl start netdata
|
|
```
|
|
|
|
To stop Netdata service, run:
|
|
|
|
```
|
|
$ sudo systemctl stop netdata
|
|
```
|
|
|
|
To enable and start Netdata service on systems that use **Init**, run:
|
|
|
|
```
|
|
$ sudo service netdata start
|
|
```
|
|
|
|
```
|
|
$ sudo chkconfig netdata on
|
|
```
|
|
|
|
To stop Netdata service:
|
|
|
|
```
|
|
$ sudo service netdata stop
|
|
```
|
|
|
|
### 5. Access Netdata via Web Browser
|
|
|
|
Open your web browser, and navigate to **http://127.0.0.1:19999** or **http://localhost:19999/** or **http://ip-address:19999**. You will be pleased with Netdata dashboard as shown in the following screenshot.
|
|
|
|
![Netdata Main Dashboard][5]
|
|
|
|
Netdata Main Dashboard
|
|
|
|
From the dashboard, you will find the complete statistics of your Linux system. Scroll down to view each section. You can also click on any section on the right corner to immediately jump to that particular section.
|
|
|
|
### 6. Netdata Configuration
|
|
|
|
As stated already, Netdata requires zero configuration. It works out of the box.
|
|
|
|
The main configuration file of Netdata is located at **`/etc/netdata/netdata.conf`**. You can view it using any text editors to find most configuration options.
|
|
|
|
You can also download and/or view Netdata default configuration file at any time by simply navigating to **http://localhost:19999/netdata.conf**.
|
|
|
|
![Netdata Configuration File][6]
|
|
|
|
Netdata Configuration File
|
|
|
|
If you want to edit the Netdata configuration file, you can use `**edit-config**` script, which is the officially recommended way.
|
|
|
|
```
|
|
$ cd /etc/netdata
|
|
$ sudo ./edit-config netdata.conf
|
|
```
|
|
|
|
### 7. Netdata Metrics
|
|
|
|
Netdata gathers thousands of metrics with zero configuration using **[300+ pre-installed collectors][7]**. These collectors will search your node in default locations and ports to find running applications and gather as many metrics as possible without you having to configure them individually.
|
|
|
|
As I already stated, Most collectors will work without any configuration. However, you should know **[how collectors work][8]** and how to **[enable or configure collectors][9]** individually.
|
|
|
|
### 8. Updating Netdata
|
|
|
|
If you have installed Netdata using the Automatic one-liner installation script, Netdata will automatically update itself.
|
|
|
|
If you have installed Netdata using your package manager, you can run the distribution-specific update command to update Netdata. For example in Arch Linux, just run the following command to update Netdata. If the updated version is available in the repository, it will be automatically installed.
|
|
|
|
```
|
|
$ sudo pacman -Syyu
|
|
```
|
|
|
|
If you have installed Netdata using Git, just go to the directory where you have cloned it (In our case it's netdata).
|
|
|
|
```
|
|
$ cd netdata
|
|
```
|
|
|
|
Pull the latest update:
|
|
|
|
```
|
|
$ git pull
|
|
```
|
|
|
|
Then, rebuild and update it using command:
|
|
|
|
```
|
|
$ sudo ./netdata-installer.sh
|
|
```
|
|
|
|
### 9. Uninstalling Netdata
|
|
|
|
If you have installed Netdata from Git, go to the location where you have cloned Netdata:
|
|
|
|
```
|
|
$ cd netdata
|
|
```
|
|
|
|
Then, uninstall it using command:
|
|
|
|
```
|
|
$ sudo ./netdata-uninstaller.sh --force
|
|
```
|
|
|
|
If you have installed Netdata using the package manager, just use the appropriate command. For example in Arch Linux, the following command can be used to uninstall Netdata:
|
|
|
|
```
|
|
$ sudo pacman -Rns netdata
|
|
```
|
|
|
|
### 10. Frequently Asked Questions
|
|
|
|
#### What is Netdata?
|
|
|
|
Netdata is an Enterprise-grade, real-time infrastructure monitoring application. It is opensource and completely free. Netdata works on Linux, FreeBSD, and macOS. It also works on container platforms like Kubernetes clusters, and Docker.
|
|
|
|
#### Which platforms are supported by Netdata?
|
|
|
|
Netdata supports most Linux distributions (Ubuntu, Debian, CentOS, and more), container platforms (Kubernetes clusters, Docker), and many other operating systems (FreeBSD, macOS).
|
|
|
|
#### Where can I find the Netdata main configuration file?
|
|
|
|
Netdata main configuration file is located at **`/etc/netdata/netdata.conf`**. If you're not sure where to find it, simply open your web browser and point it **http://localhost:19999/netdata.conf**.
|
|
|
|
#### How to download Netdata configuration file?
|
|
|
|
Yes. After finding the location of the Netdata config file, use any one of the following commands to download Netdata configuration file.
|
|
|
|
```
|
|
wget -O /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
|
|
```
|
|
|
|
Or
|
|
|
|
```
|
|
curl -o /etc/netdata/netdata.conf http://localhost:19999/netdata.conf
|
|
```
|
|
|
|
#### Who can use Netdata?
|
|
|
|
Netdata can be used by any user who wants to view the real-time performance metrics of their Linux or Unix system. It is used by system administrators, DevOps engineers, and developers to collect everything.
|
|
|
|
#### Is Netdata fast?
|
|
|
|
Yes, it is amazingly fast. It is optimized to utilize 1% of the CPU and consumes a few MB of RAM.
|
|
|
|
#### Is Netdata requires special system administration skills?
|
|
|
|
Absolutely NOT. It requires **zero configuration** as well as **zero maintenance**. Just run it on your machine and Netdata does everything on its own.
|
|
|
|
#### Can Netdata send notifications when something goes wrong?
|
|
|
|
Yes! Netdata's health watchdog sends warning and critical alarms to your favorite platform to inform you of anomalies just seconds after they affect your node.
|
|
|
|
#### Can I use Netdata to monitor my Cloud infrastructure?
|
|
|
|
Yes! Netdata Cloud works with Netdata's free, open-source monitoring agent to monitor and troubleshoot every layer of your systems to find weaknesses before they turn into outages.
|
|
|
|
Netdata Cloud provides:
|
|
|
|
- Infrastructure level dashboards (each chart aggregates data from multiple nodes)
|
|
- Central dispatch of alert notifications,
|
|
- Custom dashboards editor,
|
|
- Intelligence assisted troubleshooting, to help surface the root cause of issues.
|
|
|
|
### Conclusion
|
|
|
|
In this guide, we looked at what is Netdata and different ways to install Netdata in Linux. We also looked at how to access the Netdata dashboard, update Netdata and uninstall it.
|
|
|
|
Netdata is simple yet powerful real-time performance monitoring application. It requires zero configuration and works out of the box. If you ever looking for a easiest way to monitor your system performance, resource and application usage, Netdata is highly recommended.
|
|
|
|
**Resources:**
|
|
|
|
- [**NetData website**][10]
|
|
- [**NetData GitHub page**][11]
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
via: https://ostechnix.com/netdata-real-time-performance-monitoring-tool-linux/
|
|
|
|
作者:[sk][a]
|
|
选题:[lkxed][b]
|
|
译者:[译者ID](https://github.com/译者ID)
|
|
校对:[校对者ID](https://github.com/校对者ID)
|
|
|
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
|
|
[a]: https://ostechnix.com/author/sk/
|
|
[b]: https://github.com/lkxed
|
|
[1]: https://ostechnix.com/wp-content/uploads/2022/11/Install-Netdata-in-Linux.png
|
|
[2]: https://ostechnix.com/alpine-linux-apk-command-examples/
|
|
[3]: https://ostechnix.com/getting-started-pacman/
|
|
[4]: https://docs.netdata.cloud/packaging/installer/
|
|
[5]: https://ostechnix.com/wp-content/uploads/2022/11/Netdata-Main-Dashboard.png
|
|
[6]: https://ostechnix.com/wp-content/uploads/2022/11/Netdata-Configuration-File.png
|
|
[7]: https://learn.netdata.cloud/docs/agent/collectors/collectors
|
|
[8]: https://learn.netdata.cloud/docs/collect/how-collectors-work
|
|
[9]: https://learn.netdata.cloud/docs/collect/enable-configure
|
|
[10]: https://netdata.firehol.org/
|
|
[11]: https://github.com/firehol/netdata
|