[AWS] 「CloudWatch」collectdのインストール
CloudWatchエージェントでcollectdプロトコルを使用してアプリケーションまたはサービスからカスタムメトリクスを取得できます。
1. IAMロールの割り当て
- 「サービス」メニューより「コンピューティング」→「EC2」をクリックします。
- 左側のメニューより「インスタンス」を選択します。
- 該当のインスタンスを選択して、「アクション」→「インスタンスの設定」→「IAMロールの割り当て/置換」
IAMロール |
CloudWatchAgentServerRole |
2. collectdのインストール
$ sudo yum --enablerepo=epel install collectd
自動起動設定を行います。
$ sudo systemctl enable collectd.service
3. collectdのCloudWatchプラグインのインストール
(1) ソースのダウンロード
GITHUBにソースがありますので、これをダウンロードします。
$ cd /usr/local/src
$ sudo git clone https://github.com/awslabs/collectd-cloudwatch.git
(2) プラグインのインストール
$ cd collectd-cloudwatch/src
$ sudo ./setup.py
Installing dependencies ... OK
Installing python dependencies ... OK
Downloading plugin ... OK
Extracting plugin ... OK
Moving to collectd plugins directory ... OK
Copying CloudWatch plugin include file ... OK
DEBUG:urllib3.util.retry:Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 169.254.169.254:80
DEBUG:urllib3.connectionpool:http://169.254.169.254:80 "GET /latest/meta-data/placement/availability-zone/ HTTP/1.1" 200 15
Choose AWS region for published metrics:
1. Automatic [ap-northeast-1]
2. Custom
Enter choice [1]:
DEBUG:urllib3.util.retry:Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 169.254.169.254:80
DEBUG:urllib3.connectionpool:http://169.254.169.254:80 "GET /latest/meta-data/instance-id/ HTTP/1.1" 200 19
Choose hostname for published metrics:
1. EC2 instance id [i-02805cf6cc6cd57d6]
2. Custom
Enter choice [1]:
DEBUG:urllib3.util.retry:Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): 169.254.169.254:80
DEBUG:urllib3.connectionpool:http://169.254.169.254:80 "GET /latest/meta-data/iam/security-credentials/ HTTP/1.1" 200 25
Choose authentication method:
1. IAM Role [CloudWatchAgentServerRole]
2. IAM User
Enter choice [1]:
Enter proxy server name:
1. None
2. Custom
Enter choice [1]:
Enter proxy server port:
1. None
2. Custom
Enter choice [1]:
Include the Auto-Scaling Group name as a metric dimension:
1. No
2. Yes
Enter choice [1]:
Include the FixedDimension as a metric dimension:
1. No
2. Yes
Enter choice [1]:
Enable high resolution:
1. Yes
2. No
Enter choice [2]:
Enter flush internal:
1. Default 60s
2. Custom
Enter choice [1]:
Choose how to install CloudWatch plugin in collectd:
1. Do not modify existing collectd configuration
2. Add plugin to the existing configuration
3. Use CloudWatch recommended configuration (4 metrics)
Enter choice [3]: 2
Plugin configuration written successfully.
Stopping collectd process ... NOT OK
Starting collectd process ... OK
最終更新:2019年08月30日 19:13