Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
CloudWatch から Mackerel にメトリックを送る方法 2019年版 / Mac...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
FUJIWARA Shunichiro
March 01, 2019
Technology
3.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CloudWatch から Mackerel にメトリックを送る方法 2019年版 / Mackerel Meetup 13
FUJIWARA Shunichiro
March 01, 2019
More Decks by FUJIWARA Shunichiro
See All by FUJIWARA Shunichiro
多摩川(.dev)ランニング入門 / Tamagawa.dev#3
fujiwara3
3
570
クラウドを使う側から、作る側へ / 大吉祥寺.pm 2026前夜祭
fujiwara3
8
2.2k
作るべきものと向き合う - ecspresso 8年間の開発史から学ぶ技術選定 / 技術選定con findy 2026
fujiwara3
9
6.3k
さくらのクラウドでのシークレット管理を考える/tamachi.sre#2
fujiwara3
2
420
Amazon ECS デプロイツール ecspresso の開発を支える「正しい抽象化」の探求 / YAPC::Fukuoka 2025
fujiwara3
13
14k
パフォーマンスチューニングのために普段からできること/Performance Tuning: Daily Practices
fujiwara3
9
7k
alecthomas/kong はいいぞ
fujiwara3
7
2.6k
ecspressoの設計思想に至る道 / sekkeinight2025
fujiwara3
12
3.8k
さくらのIaaS基盤のモニタリングとOpenTelemetry/OSC Hokkaido 2025
fujiwara3
4
5.7k
Other Decks in Technology
See All in Technology
夫婦で子育てするための育児標準化
codmoninc
PRO
0
340
10年後、Engineering 行為を剥奪されるとして、わたしたちは、どう、何を創ればいいだろうか。 / If Engineering Is Taken Away in 10 Years, How and What Should We Create?
bitkey
PRO
1
190
遠藤な_めぐろLT #38 「社内のAI活用推進」@麻布台_20261009
endonanana
0
130
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
8
2.4k
宣言型部分更新は何を解決しどこへ向かうのか
shuta13
1
450
How to Design Configuration for Rails Applications
willnet
1
780
AI駆動で「他アプリの音を加工できる」アプリを作った
satomasahiro2005
0
150
今さら理解するウェブフォントver.2026
takanorip
3
770
エンタメ企業のM&Aを支えるデータ基盤 ― 統合から店舗のリアルタイム分析まで / Data Engineering Summit 2026
genda
0
170
AI時代のPRレビューにどう向き合うか?
kairim0
1
240
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
940
自作バイナリを動かす「入口」8選
puhitaku
2
1.3k
Featured
See All Featured
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
From π to Pie charts
rasagy
1
400
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Music & Morning Musume
bryan
48
7.4k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
540
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
590
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
600
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
Transcript
CloudWatch ͔Β Mackerel ʹϝτϦοΫ ΛૹΔํ๏ 2019൛ 2019-03-01 Mackerel Meetup #13
@fujiwara
ΞϯόαμʔʹͳΓ·ͨ͠
CloudWatch → Mackerel ϝτϦοΫΛసૹ͍ͨ͠ AWS ΠϯςάϨʔγϣϯͰαϙʔτ͞Ε͍ͯͳ͍ͷ άϥϑɾΞϥʔτ Mackerel ଆͰݟ͍ͨ
fluentd + plugin AWSͷCloudWatchͷϝτϦοΫ͔ΒELBؔ࿈ͷϝτϦοΫΛ αʔϏεϝτϦοΫʹߘ͢Δ mackerel.io/ja/docs/entry/advanced/fluentd#example-elb fluent-plugin-cloudwatch (input plugin) Ͱऔಘ
fluent-plugin-mackerel (output plugin) Ͱૹ৴ Ͳ͜Ͱಈ͔͢? 1͚ͩઃఆ͢Δ? ͱ͔໘͕͍Ζ͍Ζ
Metrin - AWS CloudWatchͷ൚༻ࢹϓϥάΠϯ github.com/y13i/metrin $ metrin --namespace AWS/EC2 \
--metric-name CPUUtilization \ --statistic Average --dimension InstanceId:i-xxxxxxxxx \ --start-time -600 print --last-value-only CloudWatch.InstanceId.i-xxxxxxxxx.CPUUtilization.Average 1.468 1482596160 mackerel-agent ͕ѻ͑ΔܗࣜͰprint͢ΔͷͰ agent ͔Βୟ͘ 1ϝτϦοΫ͝ͱʹίϚϯυ࣮ߦ αʔϏεϝτϦοΫ mackerel-agent ͰߘͰ͖ͳ͍
mackerel-cloudwatch-forwarder github.com/shogo82148/mackerel-cloudwatch-forwarder Lambda function. JSONͰऔಘ͢ΔϝτϦοΫΛఆٛ { "service_metrics": [ { "service":
"your service name", "name": "metric name on mackerel", "metric": [ "Namespace", "MetricName", "Dimension1Name", "Dimension1Value", {} ], "stat": "Sum" } ], "host_metrics": [ { "hostId": "host id", "name": "metric name on mackerel", "metric": [ "Namespace", "MetricName", "Dimension1Name", "Dimension1Value", {} ], "stat": "Sum" } ] }
͜Ε·ͰͷιϦϡʔγϣϯ CloudWatch ͷ GetMetricStatistics API Λ͍ͬͯΔ → 1ϝτϦοΫ͝ͱʹ 1 API
call ͕ൃੜ͢Δ ઃఆͷ֬ೝ͕͍͠ → ಈ͔ͯ͠Έͳ͍ͱҙਤ͕ͨ͠సૹͰ͖͍ͯΔ͔͔ΓͮΒ ͍ (MackerelʹؒҧͬͨΛೖΕͯ͠·͏ͱফͮ͠Β͍)
cloudwatch-to-mackerel ෳͷϝτϦοΫΛҰׅऔಘͰ͖Δ GetMetricData API ͕ 20189݄ʹϦϦʔε ϝτϦοΫసૹπʔϧ & Go ϥΠϒϥϦΛ࡞Γ·ͨ͠
github.com/fujiwara/cloudwatch-to-mackerel MetricDataQuery JSON ͰऔಘɾసૹΛߦ͏ͷ
MetricDataQuery JSON [{ "Id": "m1", "Label": "service=MyService:alb.my-alb.response-time.p99", "MetricStat": { "Metric":
{ "Namespace": "AWS/ApplicationELB", "MetricName": "TargetResponseTime", "Dimensions": [{ "Name": "LoadBalancer", "Value": "app/my-alb/8e0641feccf3491c" }] }, "Period": 60, "Stat": "p99" } }, { "Id": "m2", "Label": "service=MyService:alb.my-alb.response-time.p90", "MetricStat": { "Metric": { "Namespace": "AWS/ApplicationELB", "MetricName": "TargetResponseTime", "Dimensions": [{ "Name": "LoadBalancer", "Value": "app/my-alb/8e0641feccf3491c" }] }, "Period": 60, "Stat": "p90" } }]
CLI $ cw2mkr metric-data-query.json ڥมͰೝূใ͕దʹઃఆͯ͋͠Ε͜Ε͚ͩ σϑΥϧτͰۙ3ͷϝτϦοΫΛసૹ -start-time -end-time Λࢦఆ͢Δͱաڈ্ॻ͖Ͱ͖Δ (Mackerelաڈ24࣌ؒ·Ͱड͚͚)
Go ϥΠϒϥϦ import ( "github.com/fujiwara/cloudwatch-to-mackerel/agent" ) query := []byte(`[ ...
]`) // MetricDataQuery JSON err := agent.Run(agent.Option{Query: query}) ڥมͰೝূใ͕దʹઃఆͯ͋͠Ε͜Ε͚ͩ Lambda Ͱಈ͔ͤ·͢
͍͍ͱ͜Ζ MetricDataQuery JSON aws-cli Ͱ͑ΔܗࣜͱಉҰ → aws cloudwatch get-metric-data
Ͱઃఆ֬ೝ͕༰қ ϗετɾαʔϏεϝτϦοΫ྆ରԠ Metric Math ʹରԠ → ෳϝτϦοΫͷԋࢉ݁ՌͰΞϥʔτͱ͔ Enjoy!