How to Install Netdata Monitoring on Linux – Ubuntu, Debian, Fedora, CentOS

This tutorial explains, how to install netdata and also how to configure it with Nginx, Php-fpm and MSql Serevr. Now a days, everyone wants to analyse or monitor system on web chart dashboard. Netdata provides awesome facilities to monitor almost everything on Linux, FreeBSD, and macOS.

What is Netdata?

Don't Miss

Netdata is open source tool to monitor real time performance of system. It is highly optimized monitoring agent to accumulate all types of data, such as CPU usage, Sql Queries, disk activity etc. It provides interactive web dashboard thats make life easy to monitor. Popular collectors Nginx, Apache, Mysql

Install Netdata Monitoring

This method is fully automatic on all Linux distributions, including Ubuntu, Debian, Fedora, CentOS, and others. To install Netdata from source and get automatic nightly updates, run the below command. Once the script has completed building and installing netdata, it will automatically start the netdata service, and enables it to start at system boot. After installed you run http://domain_name:19999.

sudo apt-get update
bash <(curl -Ss https://my-netdata.io/kickstart.sh)

Configure Netdata

Main config file of netdata is /etc/netdata/netdata.conf. It binds to address 127.0.0.1 and port 19999 by default. You can set your custom port by register default port under [web]. Uncomment defaut port and replace 19999 from 8081 under [web].

[web]
       default port = 8081

Monitor Nginx and php-fpm & Configure Nginx to forward requests to netdata

We need to enable stub_status in Nginx to get detailed server info, also update php-fpm config file to enable similar feature.

upstream netdata {
        server 127.0.0.1:8081;
        keepalive 64;
}
server {
        -----

	location = /netdata {
		return 301 /netdata/;
	}

	# Added to enable NGINX monitoring through NETDATA
	location /stub_status {
		stub_status;
	}

	location ~ /netdata/(?&amp;lt;ndpath&amp;gt;.*) {
		#auth_basic "Restricted Content";
		#auth_basic_user_file /etc/nginx/.htpasswd;

		proxy_redirect off;
		proxy_set_header Host $host;

		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_http_version 1.1;
		proxy_pass_request_headers on;
		proxy_set_header Connection "keep-alive";
		proxy_store off;
		proxy_pass http://netdata/$ndpath$is_args$args;

		gzip on;
		gzip_proxied any;
		gzip_types *;
	} 

        ----
}

Restart Nginx Server

After editig nginx configutaion file. We need to restart to reflect our changes.

sudo service nginx restart

Monitor Nginx Server

Netdata auto detect nginx sever by enable stub_status module. Earlier we added stub_status module in the nginx config file. We can monitor many remote Nginx servers other than local Nginx server by editing the configuration file of Netdata’s Nginx module with the following command:

/etc/netdata/edit-config python.d/nginx.conf

At the bottom of the file uncomment below code:

localhost:
  name: "local"
  url: "http://localhost/stub_status"

remote1:
  name: "local"
  url: "http://[REMOTE_IP_ADDRESS]/stub_status"

If code is already uncomment then no need to change code

Nginx chart shown on Netdata Dashboard

nginx-local-netdata

Monitor MySQL/MariaDB server

We need to create a netdata mysql user with privilege usage to connect the Mysql Server on the localhost. To create the netdata user, execute the following in the MySQL shell:

create user 'netdata'@'localhost';
grant usage on *. * to 'netdata'@'localhost';
flush privileges;

Now connect the mysql with netdata. We can connet local or remote mysql server. Run the following code to view or edit the mysql module configuration:

sudo /etc/netdata/edit-config python.d/mysql.conf

The file content

tcp:
    name: 'local'
    host: '127.0.0.1'
    port: '3306'
    user: 'netdata'
    pass: ''

Mysql Chart shown Netdata Dashboard
mysql-local-netdata

Monitor PHP-FPM

Netdata will autodetect and monitor one or more PHP-FPM instances if php-fpm is enabled with status page and the status page can be accessed via a web server.

Enable Status Page for php-fpm

Open /etc/php/7.3/fpm/pool.d file via terminal.

sudo nano /etc/php/7.3/fpm/pool.d

Search for the status path directive and enable below command:

pm.status_path = /status

In our nginx config file we need to add below command:

sudo nano /etc/nginx/sites-enabled/default
server {
   ---
location ~ ^/(status|ping)$ {
     access_log off;
     include fastcgi_params;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
 }
  -----

}

Php-fpm chart shown on dashbaord
php-fpm-local-netdata

Restart Nginx & Php-fpm from below command

sudo service nginx restart
sudo service php7.3-fpm restart

Run the following code to view or edit the php-fpm module configuration:

/etc/netdata/edit-config python.d/phpfpm.conf

The file content

update_every : 3
priority     : 90100

local:
  url     : 'http://localhost/status'

Next, open a web browser and use the the following URL:

http://domain_name/netdata

LEAVE A REPLY

Please enter your comment!
Please enter your name here

564FansLike

Recent Posts

Concept of Session in Laravel Tutorial

Sessions are used to store details about the user throughout the requests. Laravel supplies various drivers like file, cookie, apc, array, Memcached, Redis, and database to handle session data. By default, file driver is used as a result of it's light-weight....

Laravel Url Generation Tutorial

Our web application revolves around routes and URLs. After all, they're what direct our users to our pages. At the end of the day, serving pages is what any web application should do. Our users may...

Concept of Laravel Views Tutorial

In MVC framework, the letter "V" stands for Views. It separates the application logic and presentation logic. Views are saved in resources/views listing. Generally, the view contains the HTML which might be served by the application.

Related Articles

Concept of Session in Laravel Tutorial

Sessions are used to store details about the user throughout the requests. Laravel supplies various drivers like file, cookie, apc, array, Memcached, Redis, and database to handle session data. By default, file driver is used as a result of it's light-weight....

Laravel Url Generation Tutorial

Our web application revolves around routes and URLs. After all, they're what direct our users to our pages. At the end of the day, serving pages is what any web application should do. Our users may...

Concept of Laravel Views Tutorial

In MVC framework, the letter "V" stands for Views. It separates the application logic and presentation logic. Views are saved in resources/views listing. Generally, the view contains the HTML which might be served by the application.
WP2Social Auto Publish Powered By : XYZScripts.com