{"id":3276,"date":"2020-08-23T10:03:14","date_gmt":"2020-08-23T01:03:14","guid":{"rendered":"https:\/\/test.ji0vwl.net\/?p=3276"},"modified":"2021-04-02T09:42:55","modified_gmt":"2021-04-02T00:42:55","slug":"cloudwatchagent-%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%97%e3%81%a6%e3%83%aa%e3%82%bd%e3%83%bc%e3%82%b9%e7%9b%a3%e8%a6%96%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/ji0vwl.net\/index.php\/2020\/08\/23\/3276\/","title":{"rendered":"CloudWatchAgent \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u30ea\u30bd\u30fc\u30b9\u76e3\u8996\u3059\u308b"},"content":{"rendered":"<p><a href=\"https:\/\/test.ji0vwl.net\/index.php\/2020\/08\/22\/3254\/\">CentOS 8 \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210<\/a>\u3057\u307e\u3057\u305f\u304c\u3001\u6700\u5f8c\u306b\u6b8b\u3063\u3066\u3044\u305f\u3001ClooudWatch Agent \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068\u3001\u30e1\u30e2\u30ea\u30fc\u3084\u30c7\u30a3\u30b9\u30af\u5bb9\u91cf\u306e\u76e3\u8996\u65b9\u6cd5\u3092\u8a18\u8f09\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>CPU\u4f7f\u7528\u7387\u76e3\u8996\u306f\u6a19\u6e96\u3067\u5229\u7528\u3067\u304d\u308b\u306e\u3067\u3059\u304c\u3001\u30e1\u30e2\u30ea\u30fc\u3084\u30c7\u30a3\u30b9\u30af\u5bb9\u91cf\u306fCloudWatch Agent\u3092\u5165\u308c\u306a\u3044\u3068\u76e3\u8996\u3067\u304d\u306a\u3044\u306e\u3067\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<h3>7. AWS CloudWatch Agent \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3001\u30e1\u30e2\u30ea\u30fc\u3084\u30c7\u30a3\u30b9\u30af\u5bb9\u91cf\u3092\u76e3\u8996\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h3>\n<h5>-1. IAM \u30ed\u30fc\u30eb\u306b CloudWatch\u6a29\u9650\u3092\u4ed8\u4e0e\u3059\u308b<\/h5>\n<p>SSM\u6a29\u9650\u3092\u4ed8\u4e0e\u3057\u305f\u30ed\u30fc\u30eb\u3092CentOS 8\u306b\u30a2\u30bf\u30c3\u30c1\u3057\u307e\u3057\u305f\u304c\u3001\u3053\u306e\u30ed\u30fc\u30eb\u306b\u4ee5\u4e0b\u306eCloudWatch\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u3092\u4ed8\u4e0e\u3057\u307e\u3059\u3002\u3082\u3057\u304f\u306fSSM\u3068CloudWatch\u306e\u6a29\u9650\u3092\u542b\u3080\u3001\u65b0\u3057\u3044\u30ed\u30fc\u30eb\u3092\u4f5c\u3063\u3066\u3082\u826f\u3044\u3067\u3059\u3002\u65b0\u3057\u3044\u30ed\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u305f\u5834\u5408\u306f\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3078\u306e\u518d\u30a2\u30bf\u30c3\u30c1\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>\u30fbCloudWatchAgentAdminPolicy<\/p>\n<p>\u30fbCloudWatchAgentServerPolicy<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3278\" src=\"https:\/\/test.ji0vwl.net\/wp-content\/uploads\/2020\/08\/294ec3050fe2ef318757c700ac323df2-1.jpg\" alt=\"\" width=\"800\" height=\"728\" srcset=\"https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/294ec3050fe2ef318757c700ac323df2-1.jpg 800w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/294ec3050fe2ef318757c700ac323df2-1-150x137.jpg 150w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/294ec3050fe2ef318757c700ac323df2-1-768x699.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h5>-2. CloudWatch Agent\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h5>\n<p>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306bSSM\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>$ sudo dnf install -y wget\r\n$ sudo wget https:\/\/s3.amazonaws.com\/amazoncloudwatch-agent\/redhat\/amd64\/latest\/amazon-cloudwatch-agent.rpm\r\n$ sudo dnf install -y amazon-cloudwatch-agent.rpm\r\n<\/pre>\n<h5><\/h5>\n<h5>-3. CloudWatch Agent\u306e\u8a2d\u5b9a<\/h5>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u7d42\u308f\u3063\u305f\u3089\u3001\u5bfe\u8a71\u5f0f\u3067\u8a2d\u5b9a\u3092\u9032\u3081\u3066\u3044\u304d\u307e\u3059\u3002\u6700\u4f4e\u9650\u306e\u8a2d\u5b9a\u3068\u3057\u307e\u3057\u305f\u304c\u3001\u304a\u597d\u307f\u3067\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre>$ sudo \/opt\/aws\/amazon-cloudwatch-agent\/bin\/amazon-cloudwatch-agent-config-wizard\r\n=============================================================\r\n= Welcome to the AWS CloudWatch Agent Configuration Manager =\r\n=============================================================\r\nOn which OS are you planning to use the agent?\r\n1. linux\r\n2. windows\r\ndefault choice: [1]:\r\n1\r\nTrying to fetch the default region based on ec2 metadata...\r\nAre you using EC2 or On-Premises hosts?\r\n1. EC2\r\n2. On-Premises\r\ndefault choice: [1]:\r\n1\r\nWhich user are you planning to run the agent?\r\n1. root\r\n2. cwagent\r\n3. others\r\ndefault choice: [1]:\r\n1\r\nDo you want to turn on StatsD daemon?\r\n1. yes\r\n2. no\r\ndefault choice: [1]:\r\n1\r\nWhich port do you want StatsD daemon to listen to?\r\ndefault choice: [8125]\r\n8125\r\nWhat is the collect interval for StatsD daemon?\r\n1. 10s\r\n2. 30s\r\n3. 60s\r\ndefault choice: [1]:\r\n3\r\nWhat is the aggregation interval for metrics collected by StatsD daemon?\r\n1. Do not aggregate\r\n2. 10s\r\n3. 30s\r\n4. 60s\r\ndefault choice: [4]:\r\n4\r\nDo you want to monitor metrics from CollectD?\r\n1. yes\r\n2. no\r\ndefault choice: [1]:\r\n1\r\nDo you want to monitor any host metrics? e.g. CPU, memory, etc.\r\n1. yes\r\n2. no\r\ndefault choice: [1]:\r\n1\r\nDo you want to monitor cpu metrics per core? Additional CloudWatch charges may apply.\r\n1. yes\r\n2. no\r\ndefault choice: [1]:\r\n2\r\nDo you want to add ec2 dimensions (ImageId, InstanceId, InstanceType, AutoScalingGroupName) into all of your metrics if the info is available?\r\n1. yes\r\n2. no\r\ndefault choice: [1]:\r\n1\r\nWould you like to collect your metrics at high resolution (sub-minute resolution)? This enables sub-minute resolution for all metrics, but you can customize for specific metrics in the output json file.\r\n1. 1s\r\n2. 10s\r\n3. 30s\r\n4. 60s\r\ndefault choice: [4]:\r\n4\r\nWhich default metrics config do you want?\r\n1. Basic\r\n2. Standard\r\n3. Advanced\r\n4. None\r\ndefault choice: [1]:\r\n1\r\nCurrent config as follows:\r\n{\r\n......\r\n}\r\nAre you satisfied with the above config? Note: it can be manually customized after the wizard completes to add additional items.\r\n1. yes\r\n2. no\r\ndefault choice: [1]:\r\n1\r\nDo you have any existing CloudWatch Log Agent (http:\/\/docs.aws.amazon.com\/AmazonCloudWatch\/latest\/logs\/AgentReference.html) configuration file to import for migration?\r\n1. yes\r\n2. no\r\ndefault choice: [2]:\r\n2\r\nDo you want to monitor any log files?\r\n1. yes\r\n2. no\r\ndefault choice: [1]:\r\n2\r\nSaved config file to \/opt\/aws\/amazon-cloudwatch-agent\/bin\/config.json successfully.\r\nCurrent config as follows:\r\n{\r\n......\r\n}\r\nPlease check the above content of the config.\r\nThe config file is also located at \/opt\/aws\/amazon-cloudwatch-agent\/bin\/config.json.\r\nEdit it manually if needed.\r\nDo you want to store the config in the SSM parameter store?\r\n1. yes\r\n2. no\r\ndefault choice: [1]:\r\n1\r\nWhat parameter store name do you want to use to store your config? (Use 'AmazonCloudWatch-' prefix if you use our managed AWS policy)\r\ndefault choice: [AmazonCloudWatch-linux]\r\n\r\nTrying to fetch the default region based on ec2 metadata...\r\nWhich region do you want to store the config in the parameter store?\r\ndefault choice: [ap-northeast-1]\r\n\r\nWhich AWS credential should be used to send json config to parameter store?\r\n1. AKIxxxxxxxxxxxxxxxxxxxx(From SDK)\r\n2. Other\r\ndefault choice: [1]:\r\n1\r\nSuccessfully put config to parameter store AmazonCloudWatch-linux.\r\nProgram exits now.\r\n<\/pre>\n<h5><\/h5>\n<h5>-4. CloudWatch Agent \u306e\u8d77\u52d5<\/h5>\n<p>\u3053\u308c\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30c7\u30a3\u30b9\u30af\u5bb9\u91cf\u3084\u30e1\u30e2\u30ea\u4f7f\u7528\u7387\u306a\u3069\u304cCloudWatch\u306b\u3042\u304c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre>$ sudo \/opt\/aws\/amazon-cloudwatch-agent\/bin\/amazon-cloudwatch-agent-ctl -m ec2 -a start\r\n$ sudo systemctl enable amazon-cloudwatch-agent.service<\/pre>\n<p>&nbsp;<\/p>\n<h5>-5. CloudWatch\u30e1\u30c8\u30ea\u30af\u30b9\u3092\u76e3\u8996\u9805\u76ee\u306b\u8ffd\u52a0<\/h5>\n<p>CloudWatch \u304b\u3089 \u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304b\u3089\u4e0a\u304c\u3063\u3066\u304f\u308b\u30b9\u30c8\u30ec\u30fc\u30b8\u5bb9\u91cf\u3001\u30e1\u30e2\u30ea\u4f7f\u7528\u7387\u3092\u76e3\u8996\u9805\u76ee\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3287\" src=\"https:\/\/test.ji0vwl.net\/wp-content\/uploads\/2020\/08\/a6033f721c72f72637aeabc6b221f847.jpg\" alt=\"\" width=\"800\" height=\"576\" srcset=\"https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/a6033f721c72f72637aeabc6b221f847.jpg 800w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/a6033f721c72f72637aeabc6b221f847-150x108.jpg 150w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/a6033f721c72f72637aeabc6b221f847-768x553.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3286\" src=\"https:\/\/test.ji0vwl.net\/wp-content\/uploads\/2020\/08\/4d8c6012ab6dcb6612ca8262ebb54f07.jpg\" alt=\"\" width=\"800\" height=\"576\" srcset=\"https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/4d8c6012ab6dcb6612ca8262ebb54f07.jpg 800w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/4d8c6012ab6dcb6612ca8262ebb54f07-150x108.jpg 150w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/4d8c6012ab6dcb6612ca8262ebb54f07-768x553.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3285\" src=\"https:\/\/test.ji0vwl.net\/wp-content\/uploads\/2020\/08\/1f6258a8feabf228c030e7c43cf0bb40.jpg\" alt=\"\" width=\"800\" height=\"576\" srcset=\"https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/1f6258a8feabf228c030e7c43cf0bb40.jpg 800w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/1f6258a8feabf228c030e7c43cf0bb40-150x108.jpg 150w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/1f6258a8feabf228c030e7c43cf0bb40-768x553.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3290\" src=\"https:\/\/test.ji0vwl.net\/wp-content\/uploads\/2020\/08\/54f43ef7c1b3b87c351ab15fd38adb61.jpg\" alt=\"\" width=\"800\" height=\"576\" srcset=\"https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/54f43ef7c1b3b87c351ab15fd38adb61.jpg 800w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/54f43ef7c1b3b87c351ab15fd38adb61-150x108.jpg 150w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/54f43ef7c1b3b87c351ab15fd38adb61-768x553.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>\u30c7\u30a3\u30b9\u30af\u5bb9\u91cf\u306f\u3053\u3061\u3089\u304b\u3089\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3291\" src=\"https:\/\/test.ji0vwl.net\/wp-content\/uploads\/2020\/08\/03d9cdab36e52091599b9eec907c9363.jpg\" alt=\"\" width=\"800\" height=\"576\" srcset=\"https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/03d9cdab36e52091599b9eec907c9363.jpg 800w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/03d9cdab36e52091599b9eec907c9363-150x108.jpg 150w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/03d9cdab36e52091599b9eec907c9363-768x553.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3284\" src=\"https:\/\/test.ji0vwl.net\/wp-content\/uploads\/2020\/08\/7272aa1d6d9f23dea26c10f23b457f09.jpg\" alt=\"\" width=\"800\" height=\"576\" srcset=\"https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/7272aa1d6d9f23dea26c10f23b457f09.jpg 800w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/7272aa1d6d9f23dea26c10f23b457f09-150x108.jpg 150w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/7272aa1d6d9f23dea26c10f23b457f09-768x553.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>\u30e1\u30e2\u30ea\u30fc\u4f7f\u7528\u7387\u306f\u3053\u3061\u3089\u304b\u3089\u3002 \u00a0\u00a0 <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3288\" src=\"https:\/\/test.ji0vwl.net\/wp-content\/uploads\/2020\/08\/d676eb6762a3b030fe41a6de9d62a638.jpg\" alt=\"\" width=\"800\" height=\"576\" srcset=\"https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/d676eb6762a3b030fe41a6de9d62a638.jpg 800w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/d676eb6762a3b030fe41a6de9d62a638-150x108.jpg 150w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/d676eb6762a3b030fe41a6de9d62a638-768x553.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/> <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3289\" src=\"https:\/\/test.ji0vwl.net\/wp-content\/uploads\/2020\/08\/132abd41ac5d595bfe5bdb145b12b34c.jpg\" alt=\"\" width=\"800\" height=\"576\" srcset=\"https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/132abd41ac5d595bfe5bdb145b12b34c.jpg 800w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/132abd41ac5d595bfe5bdb145b12b34c-150x108.jpg 150w, https:\/\/ji0vwl.net\/wp-content\/uploads\/2020\/08\/132abd41ac5d595bfe5bdb145b12b34c-768x553.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u6a19\u6e96\u3067\u306fCPU\u4f7f\u7528\u7387\u3057\u304b\u76e3\u8996\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001\u3053\u308c\u3067\u30b9\u30c8\u30ec\u30fc\u30b8\u5bb9\u91cf\u3084\u30e1\u30e2\u30ea\u30fc\u306e\u903c\u8feb\u3082\u81ea\u52d5\u3067\u76e3\u8996\u3057\u3066\u901a\u77e5\u3092\u53d7\u3051\u308b\u3053\u3068\u3067\u5b89\u5fc3\u3057\u3066\u30b5\u30fc\u30d0\u30fc\u3092\u7dad\u6301\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CentOS 8 \u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u304c\u3001\u6700\u5f8c\u306b\u6b8b\u3063\u3066\u3044\u305f\u3001ClooudWatch Agent \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068\u3001\u30e1\u30e2\u30ea\u30fc\u3084\u30c7\u30a3\u30b9\u30af\u5bb9\u91cf\u306e\u76e3\u8996\u65b9\u6cd5\u3092\u8a18\u8f09\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 CPU\u4f7f\u7528\u7387\u76e3\u8996\u306f\u6a19\u6e96\u3067\u5229\u7528\u3067\u304d\u308b\u306e\u3067\u3059 &hellip; <a href=\"https:\/\/ji0vwl.net\/index.php\/2020\/08\/23\/3276\/\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">CloudWatchAgent \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u30ea\u30bd\u30fc\u30b9\u76e3\u8996\u3059\u308b<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3276","post","type-post","status-publish","format-standard","hentry","category-server"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/posts\/3276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/comments?post=3276"}],"version-history":[{"count":0,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/posts\/3276\/revisions"}],"wp:attachment":[{"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/media?parent=3276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/categories?post=3276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ji0vwl.net\/index.php\/wp-json\/wp\/v2\/tags?post=3276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}