LoginSignup
4
2

More than 5 years have passed since last update.

EOLになったNewRelicのServersからInfrastructureに移行する

Posted at

infrastructure-events-feed-screen-79957577e0f3270c082bd4fc0d3860d8.png

サーバのリソース監視とアラートを提供していたNewRelic Serversが2018年の5月15日にサービスを終了します。(無料アカウントで使っていた場合は、2017年の11月14日にサービス提供が終了しています。)

New Relic Servers and the legacy alerting features will reach End-Of Life (EOL) on May 15th, 2018
...
who do not have a paid subscription to one or more of our products, the EOL date will be November 14, 2017.

参考: https://discuss.newrelic.com/t/important-upcoming-changes-for-new-relic-servers-and-legacy-alerting-features/49474

この記事ではServersから後継のNewRelic Infrastructureに移行する方法をまとめています。

Amazon Linuxを想定したコマンドを例として挙げていますが、他のOSの方は適宜参考リンク先を参照してください。

Serversエージェントのアンインストール

まず、不要になるServersのエージェントをアンインストールします。

sudo yum remove -y newrelic-sysmond

参考: https://docs.newrelic.com/docs/servers/new-relic-servers-linux/installation-configuration/install-ubuntu-debian-new-relic-servers#uninstalling

Infrastructureエージェントのインストール

次にインストールを行います。ライセンスキーはお持ちのものを設定してください。

echo "license_key: ****" | sudo tee -a /etc/newrelic-infra.yml
sudo curl -o /etc/yum.repos.d/newrelic-infra.repo https://download.newrelic.com/infrastructure_agent/linux/yum/el/6/x86_64/newrelic-infra.repo
sudo yum -q makecache -y --disablerepo='*' --enablerepo='newrelic-infra'
sudo yum install newrelic-infra -y
sudo vim /etc/newrelic-infra.yml

参考: https://docs.newrelic.com/docs/infrastructure/new-relic-infrastructure/installation/install-infrastructure-linux

newrelic-infraの設定ファイルを編集

/etc/newrelic-infra.yml
license_key: ****
display_name: 表示したい名前をここに入れる
custom_attributes:
  environment: 環境を分けたい場合はこちらに設定

custom_attributesにはenvironment以外にserviceteamが使えます。

参考: https://docs.newrelic.com/docs/infrastructure/new-relic-infrastructure/configuration/configure-infrastructure-agent

設定ファイル更新後はプロセスを再起動しておきます。

sudo initctl restart newrelic-infra

参考: https://docs.newrelic.com/docs/infrastructure/new-relic-infrastructure/configuration/start-stop-restart-check-infrastructure-agent-status

アラートをSlackに飛ばす設定


アラートに必要な設定は3つです。

  1. Alert policyの作成
  2. Alert conditionの作成
  3. Notification channelの設定

Alert policy(アラートポリシー)の作成

まずアラートポリシーの作成はログイン後の画面右上の"Alerts" > "Alert plicies" > "New alert policy"から行います。

Alert condition(アラート条件)の作成

ポリシーを作成したら、ポリシーの詳細画面からアラート条件を設定します。

とりあえず以下の3点あたりは設定しておきましょう。

  • CPU使用率
  • メモリ使用率
  • サーバ死活

アラート条件のサンプル: https://docs.newrelic.com/docs/infrastructure/new-relic-infrastructure/infrastructure-alert-conditions/infrastructure-alerting-examples

アラート条件を作成したら必ずincident(インシデント)の作成条件を確認します。

デフォルトでは「By Policy(ポリシー毎)」にインシデント作成となっていますが、「By condition and entity(条件・エンティティ毎)」に変えておくとServersでの運用感覚に近くなります。

Screen Shot 2017-12-15 at 19.24.02.png

Screen Shot 2017-12-15 at 19.24.14.png

インシデントが1つしか作られず、アラートが飛ばないなと思ったらここの設定を見直しましょう。

Notification channel(通知チャンネル)の設定

デフォルトだとメールに通知が飛ぶようになっているので、ここではSlackの設定を行います。

まずアラートポリシーの作成はログイン後の画面右上の"Alerts" > "Notification channels" > "New notification channel"から行います。

チャンネルタイプのSlackを選択して、webhookのURLを入れましょう。

AWSアカウントと接続するための設定

もしもAWS上にしかない現在の請求価格や、ECSのクラスタメトリクス、RDSなどの情報を監視したい場合はIAMキーを作成して監視することもできます。

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "budgets:ViewBudget"
      ],
      "Resource": "*"
    }
  ]
}

細かい手順は公式ドキュメントをご参照ください。

参考: https://docs.newrelic.com/docs/infrastructure/amazon-integrations/getting-started/connect-aws-services-infrastructure

利用料金

Serversと異なり、Infrastructureには無料プランがありません。代わりに無料のトライアル期間があります。

Infrastructureの利用料金は以下から計算できます。

この記事を書いている時点で、以下の見積もりをすると月々6.3ドルでした。

  • AWSのt2.largeのインスタンスを1ヶ月監視
  • 月払い
  • ESSENTIALSプラン

手軽に設定できることや、便利なAPMと同じプラットフォームで監視できることを考えるとInfrastructureの費用対効果は高そうです。

おわりに

NewRelic Infrastructureへの移行方法の紹介でした。

Alert周りの概念が変わったことで、以下の設定が特に個人的には見つけにくかったので気をつけてください。

  • Incidentの作成条件
  • Slackの追加方法

これから移行・導入を検討されている方の参考になれば幸いです。

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2