博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
amplify color_如何使用Amplify监视Nginx
阅读量:2532 次
发布时间:2019-05-11

本文共 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指标,例如

  1. Current connections

    当前连接
  2. Current requests

    当前请求
  3. HTTP errors

    HTTP错误
  4. HTTP version

    HTTP版本
  5. Nginx memory usage

    Nginx内存使用情况
  6. Nginx CPU usage

    Nginx CPU使用率
  7. Nginx traffic

    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。

先决条件 (Prerequisites)

  1. An instance of Nginx installed on a server. Recommended Read:

    服务器上安装的Nginx实例。 推荐阅读:
  2. SSH access to the server. Recommended Read:

    SSH访问服务器。 推荐阅读:

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。

步骤1:在Nginx Amplify网站上注册 (Step 1: Sign up in Nginx Amplify website)

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.

此后,您将收到带有确认链接的电子邮件通知。 单击链接以登录以放大。

步骤2:下载Amplify Install脚本 (Step 2: Download the Amplify Install script)

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:

下一步将使用curlwget命令下载安装脚本:

# wget https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh

Sample Output

样本输出

步骤3:安装Amplify Agent套件 (Step 3: Install the Amplify Agent Package)

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.

点击“继续”按钮转到下一步。

步骤4:配置Nginx以可视化关键指标 (Step 4: Configure Nginx to visualize crucial metrics)

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.

单击“继续”按钮进入下一页。

步骤5:修改nginx.conf文件 (Step 5: Modify the nginx.conf file)

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 shown

access_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/

你可能感兴趣的文章
linux工作调度(计划任务)
查看>>
hdu--1698 Just a Hook(线段树+区间更新+懒惰标记)
查看>>
Python学习笔记-EXCEL操作
查看>>
二月二——头牙诗词
查看>>
《吴忠与富平》之四:汉三水属国(北地属国、安定属国)
查看>>
丁酉立秋喜逢风雨
查看>>
vim删除#开头的行和正则表达式笔记
查看>>
python3 提成计算
查看>>
VBA赋值给指定单元格
查看>>
抽象类和接口总结回顾
查看>>
【语言处理与Python】5.3使用Python字典映射词及其属性
查看>>
设备信息
查看>>
Android Volley框架的使用(三)
查看>>
[错误总结] 控件frame设置无效
查看>>
Redis Java API
查看>>
oracle 查询表的定义语句
查看>>
Android 笔记之 Android 系统架构
查看>>
状压dp终极篇(状态转移的思想)
查看>>
AtCoder Grand Contest 031 B - Reversi
查看>>
完整成功配置wamp server小记
查看>>