NGINX Amplifyを触ってみる

Nginxが提供する、クラウドサービスNGINX Amplifyをざっと触ってみた。


サーバにエージェントをインストールすることで、メトリックのグラフ化・Nginxのconfに関するレポート・アラート等をWebから確認できる。

グラフ

OSのCPU・メモリ・ネットワーク等のメトリックの他、Nginxのメトリックもデフォルトで表示される

レポート

Nginxの設定のレポート。
Nginxのバージョン、OpenSSLのバージョン、ファイルの更新日等がレポートとして表示される。


あわせて、推奨事項も表示される

Warning – It is recommended to include default_server parameter for each uniquelistenIP:port
combination. If none of the listen directives have the default_server parameter, then the first server
with a particular IP:port tuple becomes the default one. Default server is the server that will process
requests that can’t be matched against any of the configured server_name’s.

Check the following file(s):
/etc/nginx/conf.d/example_ssl.conf, line 4
/etc/nginx/conf.d/stub_status.conf, line 2

アラート

メトリックスを元にアラートを送信できる。任意のメトリックスを設定でき、OSやNginxのメトリックスと閾値を設定する。


こんな感じのアラートが届く

nginx-1.9.12 @ vagrant.vm 
Sum of nginx.http.status.4xx > 10.0 during the last 2m [28.00 > 10.00] 
Created: 28, Mar 2016 09:43:47 GMT 

エージェントのインストールと設定

現在はbeta版なので、公式サイトの「REQUEST ACCESS」より登録をする
https://www.nginx.com/amplify/


登録をするとAPI_KEYが届くので、インストールするサーバで以下のコマンドを叩くとインストールできる

curl -L -O https://github.com/nginxinc/nginx-amplify-agent/raw/master/packages/install.sh
API_KEY='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' sh ./install.sh


インストールすると、起動し自動でメトリックスの送信が開始されWeb側で確認できるようになります。


一部のメトリックを取得するためには、「stub_status」を有効にしたり、「log_format」の設定外必要。
詳しくは、ドキュメントの通り( https://github.com/nginxinc/nginx-amplify-doc/blob/master/amplify-guide.md )