本文共 5010 字,大约阅读时间需要 16 分钟。
amplify color
Amplify is a powerful, lightweight, and intuitive SaaS-based monitoring platform used for monitoring Nginx and Nginx Plus. It monitors and displays Nginx metrics such as
Amplify是一个功能强大,轻巧且直观的基于SaaS的监视平台,用于监视Nginx和Nginx Plus。 它监视并显示Nginx指标,例如
In addition, it also monitors the Operating system’s metrics such as CPU usage, Load average, Memory usage, Network traffic, and Swap space. In this guide, we will learn how you can monitor Nginx with Amplify monitoring SaaS platform.
此外,它还监视操作系统的指标,例如CPU使用率,平均负载,内存使用率,网络流量和交换空间。 在本指南中,我们将学习如何使用Amplify监控SaaS平台来监控Nginx。
In this guide, we have an instance of Nginx installed on a CentOS 7 server system (Hostname: spikey).
在本指南中,我们在CentOS 7服务器系统(主机名:spikey)上安装了Nginx实例。
Let’s jump right in and see how we can monitor Nginx with Amplify.
让我们直接进入,看看如何使用Amplify监视Nginx。
First off, you need to create an account to get started with configuration. Follow to create an account in Amplify site.
首先,您需要创建一个帐户以开始配置。 单击在Amplify网站中创建一个帐户。
Thereafter, you will receive an email notification with a confirmation link. Click on the link to Sign in to Amplify.
此后,您将收到带有确认链接的电子邮件通知。 单击链接以登录以放大。
Upon logging in, the following page will be displayed with instructions to follow. First on the line will be logging into your server via SSH.
登录后,将显示以下页面以及说明。 首先,将通过SSH登录到您的服务器。
The next step will be to download the install script using either curl or wget command:
下一步将使用curl或wget命令下载安装脚本:
# wget https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh
Sample Output
样本输出
Next, run the second command to install Amplify Agent package
接下来,运行第二个命令以安装Amplify Agent软件包
# API_KEY='bf7dfaa516e060f9b3b1fe527d48466d' sh ./install.sh
Sample Output
样本输出
After successfully installing the Amplify agent package, the server will be listed on Amplify and metrics will start being gathered.
成功安装Amplify代理程序包后,服务器将在Amplify上列出,并且指标将开始收集。
Hit the ‘Continue’ button to go to the next step.
点击“继续”按钮转到下一步。
The next page will display another set of instructions as shown. Change your present working directory to /etc/nginx
下一页将显示另一组说明,如下所示。 将您当前的工作目录更改为/etc/nginx
# cd /etc/nginx
Next, verify that conf.d
files are automatically added in Nginx configuration
接下来,确认conf.d
文件已自动添加到Nginx配置中
grep -i include\.*conf nginx.conf
Next, create a new file called stub_status.conf
接下来,创建一个名为stub_status.conf
的新文件。
# cat > conf.d/stub_status.conf
Copy and paste the following content into the file
复制以下内容并将其粘贴到文件中
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; }}
Verify that the stub_status.conf
file was added
验证是否已添加stub_status.conf
文件
Sample Output
样本输出
Next, run the command below to reload Nginx for the stub_status module to become active.
接下来,运行以下命令重新加载Nginx,以使stub_status模块变为活动状态。
kill -HUP `cat /var/run/nginx.pid`
Click on the ‘Continue’ button to proceed to the Next page.
单击“继续”按钮进入下一页。
The final step will require modifying the /etc/nginx/nginx.conf
file. We are specifically going to make adjustments to 3 sections
最后一步将需要修改/etc/nginx/nginx.conf
文件。 我们将专门对3个部分进行调整
error_log
error_log
Ensure that the attribute reads as shown below
确保属性读取如下所示
error_log /var/log/nginx/error.log warn;
access_log
Edit this attribute as shownaccess_log
如图所示编辑此属性access_log /var/log/nginx/access.log main_ext
log_format
log_format
Finally, make the changes to this attribute as shown
最后,对该属性进行更改,如下所示
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' ;
Reload Nginx and click on ‘Finish’ button.
重新加载Nginx并单击“完成”按钮。
We’re good to go now! Be sure to observe as the metrics start streaming on the graphs as shown
我们现在走了! 如图所示,请确保在指标开始流式传输时进行观察
To have a more general view of your Nginx application, click on ‘OVERVIEW’
要更全面地了解您的Nginx应用程序,请单击“概述”
Thank you for coming this far. Feel free to send your feedback in the comments sections below.
谢谢你走这么远。 欢迎在下面的评论部分中发送您的反馈。
翻译自:
amplify color
转载地址:http://oumzd.baihongyu.com/