Hello, friends. Linux is home to many servers and users who want a secure system without a lot of hassle. Of course, once they have it then they feel the need to know how these programs are performing. That’s why today we’re going to show you how to install Netdata on Debian 11.
Netdata is a tool to visualize and monitor metrics in real-time, optimized to accumulate all kinds of data, such as CPU usage, disk activity, SQL queries, website visits, among others. So, thanks to Netdata we can have multiple metrics and ways to visualize the performance of our Linux servers (and computers).
Netdata is very efficient because it is a lightweight tool, mostly written in C language, which presents low levels of consumption during its execution: around 2% usage for a single-threaded CPU and a few megabytes of RAM.
To make this tool even more useful, it is possible to integrate it with multiple platforms and applications, and we can even incorporate messaging services such as Slack and Telegram.
So, let’s go for it.
Install Netdata on Debian 11
One of the advantages of Netdata is that it is available in the main repositories of Debian 11. This indicates that the installation and integration with the system is the order of the day.
So open a terminal and update the entire distribution as follows
sudo apt update sudo apt upgrade
After that, you can install Netda with the following command
sudo apt install netdata [sudo] password for angelo: Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: fonts-font-awesome fonts-glyphicons-halflings libjs-bootstrap libjudydebian1 libnetfilter-acct1 libprotobuf23 libsnappy1v5 netdata-core netdata-plugins-bash netdata-web Suggested packages: apcupsd hddtemp iw lm-sensors nc fping Recommended packages: netdata-plugins-nodejs netdata-plugins-python The following NEW packages will be installed: fonts-font-awesome fonts-glyphicons-halflings libjs-bootstrap libjudydebian1 libnetfilter-acct1 libprotobuf23 libsnappy1v5 netdata netdata-core netdata-plugins-bash netdata-web 0 upgraded, 11 newly installed, 0 to remove and 3 not upgraded. Need to get 4,190 kB of archives. After this operation, 14.4 MB of additional disk space will be used. Do you want to continue? [Y/n]
After confirming the process start the download and installation.
Configuring Netdata properly
Netdata is installed on the system as a service. This means that using the systemctl
command you can start it, stop it, restart it, and so on.
So, let’s check the status of the service
sudo systemctl status netdata ● netdata.service - netdata - Real-time performance monitoring Loaded: loaded (/lib/systemd/system/netdata.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2021-09-29 15:56:38 CEST; 1min 14s ago Docs: man:netdata file:///usr/share/doc/netdata/html/index.html https://github.com/netdata/netdata Main PID: 8496 (netdata) Tasks: 23 (limit: 2276) Memory: 32.9M CPU: 1.164s CGroup: /system.slice/netdata.service ├─8496 /usr/sbin/netdata -D ├─8498 /usr/sbin/netdata --special-spawn-server ├─8668 bash /usr/lib/netdata/plugins.d/tc-qos-helper.sh 1 ├─8680 /usr/lib/netdata/plugins.d/apps.plugin 1 └─8682 /usr/lib/netdata/plugins.d/nfacct.plugin 1 Sep 29 15:56:39 osradar netdata[8496]: Found 0 legacy dbengines, setting multidb diskspace to 256MB Sep 29 15:56:39 osradar netdata[8496]: 2021-09-29 15:56:39: netdata INFO : MAIN : SIGNAL: Not enabling reaper Sep 29 15:56:39 osradar netdata[8496]: Created file '/var/lib/netdata/dbengine_multihost_size' to store the computed value Sep 29 15:56:39 osradar netdata[8496]: SIGNAL: Not enabling reaper Sep 29 15:56:53 osradar systemd[1]: /lib/systemd/system/netdata.service:55: Standard output type syslog+console is obsolete, automatically updating to journal+console.>ep 29 15:56:53 osradar systemd[1]: /lib/systemd/system/netdata.service:56: Standard output type syslog+console is obsolete, automatically updating to journal+console.>Sep 29 15:56:54 osradar systemd[1]: /lib/systemd/system/netdata.service:55: Standard output type syslog+console is obsolete, automatically updating to journal+console.>Sep 29 15:56:54 osradar systemd[1]: /lib/systemd/system/netdata.service:56: Standard output type syslog+console is obsolete, automatically updating to journal+console.>Sep 29 15:56:54 osradar systemd[1]: /lib/systemd/system/netdata.service:55: Standard output type syslog+console is obsolete, automatically updating to journal+console.>Sep 29 15:56:54 osradar systemd[1]: /lib/systemd/system/netdata.service:56: Standard output type syslog+console is obsolete, automatically updating to journal+console.>l
With an output similar to this, then we can conclude that it is working properly.
The next step is to open a web browser and visit http://your-server:3000/
.
However, we can install Nginx and use it as a reverse proxy to improve the security and handling of Netdata.
So, install Nginx
sudo apt install nginx
After that, create a configuration file for Netdata.
sudo nano /etc/nginx/conf.d/netdata.conf
And add the following
upstream backend { server 127.0.0.1:19999; keepalive 64; } server { listen 80; server_name domain; location / { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://backend; proxy_http_version 1.1; proxy_pass_request_headers on; proxy_set_header Connection "keep-alive"; proxy_store off; } }
Replace server_name
with your domain name.
Save the changes and close the editor.
Next, you may want to install Let’s Encrypt certificates using Certbot.
So, install Certbot
sudo apt install certbot python3-certbot-nginx
And now generate the certificates
sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email youremail@domain -d your-domain
Replace the email and domain values with the real ones.
Finally, restart Nginx.
sudo systemctl restart nginx
Now you can access https://your-domain
.
Conclusion
Netdata is a powerful tool to help you monitor a Linux server. It has many different features and its integration with other systems is very convenient and flexible.