LoginSignup
9
9

More than 5 years have passed since last update.

cloudwatchの内容をNewRelicにて表示する

Posted at

metorics管理をnewrelicに一元化したいので、awsのcloudwatch情報もnewrelicへ連携します。

newrelic-platform/newrelic_aws_cloudwatch_plugin

require

  • newrelic account
  • t1.micro instance
  • readonly権限のIAM account

IAMにてreadonly権限を持ったユーザーを作成

create group 'NewRelicCloudWatch'

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "autoscaling:Describe*",
        "cloudwatch:Describe*",
        "cloudwatch:List*",
        "cloudwatch:Get*",
        "ec2:Describe*",
        "ec2:Get*",
        "ec2:ReportInstanceStatus",
        "elasticache:DescribeCacheClusters",
        "elasticloadbalancing:Describe*",
        "sqs:GetQueueAttributes",
        "sqs:ListQueues",
        "rds:DescribeDBInstances",
        "SNS:ListTopics"
      ],
      "Effect": "Allow",
      "Resource": "*"
    }
  ]
}

create user 'NewRelicCloudWatch'

  • credentialをdownloadしておく

t1.microをnewrelicのAMI使って作成

AMIはここ

https://aws.amazon.com/marketplace/pp/B00DMMUO0O/

鍵とかはmonitoringなんで別にしておくと良いかも。

cookbook

さて、manualで入れんのはだるいのでcookします。

cookbookはココ

まずひな形作成

$ knife solo init monitoring
$ cd monitoring
$ berks init .
$ vim Berksfile

cookbook 'newrelic_plugins', '~> 1.0.0'

$ berks install

これでまず下ごしらえ。

次にrunlist作ります。めんどうなので1個

$ vim nodes/foo-newrelic.json
{
  "newrelic": {
    "license_key": "LICENSE_KEY",
    "aws_cloudwatch": {
      "install_path": "/opt/aws_cloudwatch",
      "user": "newrelic",
      "aws_access_key": "AWS_ACCESS_KEY",
      "aws_secret_key": "AWS_SECRET_KEY",
      "agents": [
        "ec2",
        "ebs",
        "rds",
        "elasticache",
        "sqs",
        "elb"
      ]
    }
  },
  "run_list": [
    "newrelic_plugins::aws_cloudwatch"
  ]
}

cook

$ knife solo bootstrap ubuntu@INSTANCE_IP_ADDRESS nodes/foo-newrelic.json

その他

このままだとアレなので、cookbookに

  • fwの設定を見直す
  • 作業ユーザーを作る
  • アクセスユーザーを作って鍵交換

とかやった方がいいかもです。

その他Reference

9
9
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
9
9