Nginx is one of the most widely used open source web servers, it is better to monitor such servers. Amplify is one such capable monitoring tool which has a great role for the better handling of the server. It is based on a SaaS (Software as a Service) monitoring platform. It also has support for Nginx Plus, php-fpm and other components of the underlying operating system.
It has support for all Linux distributions such as Ubuntu, Debian, Fedora, Centos, RHEL, and so on. It has great monitoring capabilities for almost all the things involved on the Nginx server like Network traffic, Memory Usage, CPU Usage, HTTP errors, HTTP version, Nginx traffic.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Nginx queries.
In this context, we shall look into the installation process and use cases with its feature of the Web user interface where you can see all the reports and statistics involved on the Nginx server.
To begin, visit Nginx Amplify website to create an account. After creating the account, you will receive an email to verify the account.
Nginx Amplify Site is https://amplify.nginx.com/
After verifying the account, connect to your server through ssh where you have installed nginx. Then you are good to download the amplify agent script with the below link:
$ wget https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh
Or you can also download with below curl command:
$ curl -L -O https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh
Here, run the below command with the sudo user to install the amplify agent script on the server:
$ sudo API_KEY='4ddc68e6077eaa0b08b5c1ef50c760e0' sh ./install.sh
Note: API_KEY might be different in your case.
You can click on continue on the amplify site after the successful installation of nginx-amplify-agent package. See the picture below for the details.
Now, add the stub_status configuration file on nginx Which builds the key graphs for Nginx.
First, navigate to the nginx directory with the following command:
$ cd /etc/nginx
Now add the stub_status configuration file for Nginx as below command:
$ sudo vim conf.d/sub_status.conf
Then, add the configuration below:
server {
listen 127.0.0.1:80;
server_name 127.0.0.1;
location /nginx_status {
stub_status on;
allow 127.0.0.1;
deny all;
}
}
Now to activate the configuration module stub_status, restart the Nginx service with the following command:
$ sudo systemctl restart nginx.service
You can click on continue on the amplify site after the successful configuration of stub_status module.
Let's set up additional Nginx metrics for better monitoring. You can add and set up the files like access_log, error_log and log_format. Edit your main nginx configuration file /etc/nginx/nginx.conf file as follows:
for Access_log and error_log,
$ sudo vim nginx.conf
access_log /var/log/nginx/access.log main_ext;
error_log /var/log/nginx/error.log warn;
Log_format
Next, Add the configurations as shown below for the log_format:
log_format main_ext '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'"$host" sn="$server_name" ' 'rt=$request_time '
'ua="$upstream_addr" us="$upstream_status" '
'ut="$upstream_response_time" ul="$upstream_response_length" '
'cs=$upstream_cache_status' ;
Finally, Restart the Nginx server with the following command:
$ sudo systemctl restart nginx.service
Now, you can monitor Nginx web server with the Amplify Agent by watching the results and reports on the amplify dashboard Web UI portal:
https://amplify.nginx.com/dashboard
For a more clear view of the reports on Nginx web server, go through the Overview section:
https://amplify.nginx.com/overview
This article covers Amplify which is an important monitoring tool having a significant role for the better handling of the server that is based on a SaaS monitoring platform. In fact, Amplify support for Nginx Plus, php-fpm and other components of the underlying operating system is a great advantage for the Nginx users to monitor all the involved systems through a WEB UI portal.
Nginx Amplify Agent collects the following types of data: