By Sajid Qureshi, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud's incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.
Netdata is an open source performance and health monitoring system for Linux and MacOS. Metrics in Netdata are organized in collections called charts. Charts have a purpose and a scope. This makes Netdata extremely useful for learning the underlying technologies. It helps us to understand how things work and what is available. Real - time alarms are also supported in Netdata and these alarms can be setup on any metrics or any combination of them. Netdata is very resource efficient and you can control its resource consumption.
Before installing netdata on your CentOS server, we will have to install nginx web server. Nginx web server can be installed from epel repository. so first install EPEL repository using following command, if you do not have it.
yum -y install epel-release
(You can switch from non root user to root user using sudo -i
)
Now install nginx from following command.
yum -y install nginx
Once the installation is finished, start the service using the following command below.
systemctl start nginx
Next, enable it to launch automatically at system boot using below command.
systemctl enable nginx
Now you'll need to open HTTP and HTTPS ports using following commands, so execute following commands one-by-one.
firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent
firewall-cmd --reload
If in case you don't have firewalld services running then you can install it using below command.
yum -y install firewalld
To install netdata you'll have to enable 'stub_status' module and you can do that by editing the configuration file 'nginx.conf'. Go to the '/etc/nginx/' directory using following command.
cd /etc/nginx/
Next, edit the configuration with any text editor. Here we are using nano text editor.
nano nginx.conf
If in case you don't have it you can also install it using this command.
yum -y install nano
Paste the following content inside the 'server {}' block.
location /stub_status {
stub_status;
# Security: Only allow access from the IP below.
allow 127.0.0.1;
# Deny anyone else
deny all;
}
Save the file and exit from the text editor.
Now, test the nginx configuration and make sure there is no error and to do so execute following command.
nginx -t
Next, restart nginx using following command.
systemctl restart nginx
Now we will install netdata to monitor nginx server. You'll need to install some required packages before installing netdata and you can do so using following command.
yum -y install zlib-devel libuuid-devel libmnl-devel gcc make git autoconf autogen automake pkgconfig curl jq nodejs
Now download netdata source code from github using following git command.
cd ~
git clone https://github.com/firehol/netdata.git --depth=1
Go to netdata directory using following cd command.
cd netdata/
Next, run the Netdata installer script with sudo privileges and you can do so using following command.
sudo ./netdata-installer.sh
Press the Enter button to continue the netdata installation and complete the installation.
Netdata will run on port '19999' so you'll need to open this port using following command.
sudo firewall-cmd --permanent --add-port=19999/tcp
Reload firewalld service to apply changes that we just configured.
sudo firewall-cmd --reload
Netdata provides a systemd services script, so you can manage Netdata using the systemctl command. Restart netdata and enable it to launch automatically every time at system boot. So execute following commands one by one.
systemctl restart netdata
systemctl enable netdata
Next, make sure that port is opened to run netdata so execute following command and check if port 19999 on the 'LISTEN' state or NOT.
netstat -plntu
All the required packages have been installed and now we are ready to monitor our nginx server using netdata. To monitor system applications netdata provides modules. There are some applications like Apache, Nginx, MongoDB etc that use python modules for monitoring using Netdata.
Change your current directory to netdata 'python.d' directory using following command.
cd /etc/netdata/python.d/
Now edit the nginx configuration file 'nginx.conf' using any text editor. Here we are using nano text editor.
nginx.conf
Go to the bottom line and make sure you have a configuration as shown below.
localhost:
name : 'local'
url : 'http://localhost/stub_status'
Save the file and exit from text editor.
Finally restart the netdata service using following command.
systemctl restart netdata
Netdata is successfully installed and running on your server. Open your favorite web browser to test it. Point your web browser to YourServerIP with port 19999.
http://YourServerIPAddress:19999
Replace YourServerIPAddress
with your actual server IP address and you will be redirected to netdata dashboard. You can manage netdata operations like Nginx active connections, requests, status and the connection rate from that dashboard.
Congratulations! You have successfully installed Netdata on your server. Your Nginx services are being monitored using Netdata on your Alibaba Cloud Elastic Compute Service (ECS) CentOS 7 server.
5 posts | 0 followers
FollowAlibaba Clouder - August 27, 2020
liptanbiswas - July 15, 2018
Alibaba Clouder - December 30, 2020
Alibaba Clouder - December 7, 2017
Alibaba Cloud Native - June 9, 2023
Alibaba Clouder - May 13, 2019
5 posts | 0 followers
FollowOrganize and manage your resources in a hierarchical manner by using resource directories, folders, accounts, and resource groups.
Learn MoreA Web browser-based admin tool that allows you to use command line tools to manage Alibaba Cloud resources.
Learn MoreA configuration audit service that provides configuration history of enterprise resources in Alibaba Cloud and audits the compliance of resource configurations.
Learn MoreSimplify the Operations and Management (O&M) of your computing resources
Learn More