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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
AgentCoreで実践するハーネスエンジニアリング
yakumo
1
300
事業活動を AI Ready にする攻めと守りのデータエンジニアリング / data-engineering-for-ai-ready-business
pei0804
7
2.6k
大型犬好きによるPugの紹介
yamanoku
1
150
Snapshot Testing in Practice: Predictable and Reliable SwiftUI Views
fespinoza
0
200
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
140
AI時代に必要な脅威モデリング― 変化の速度に負けない理解とリスク判断
masakane55
5
1.3k
M5Stackで作る BLEマウス GPSログの世界
tomokusaba
0
150
脆弱性診断って、何をしているの? 〜弱点を見つけて、会社の改善につなげるまで〜
keeg
0
880
スキマバイトという雇用形態は存在しないので、雇用期間1日のアルバイト契約を事業者とワーカーが結ぶ手続きを支えるのがタイミーなんです
akitoshiga
0
130
LocalStack を使ったサーバーレスアプリケーション開発 / Serverless Development with LocalStack
kakakakakku
1
410
【Data Engineering Summit2026_登壇資料】医療ビッグデータ×AIエージェントを支えるデータ基盤とハーネスエンジニアリング
jmdc_presentation
0
140
DevelopersIO 2026 知識の地図を描く ─ オントロジーとは何か?
ishikawa_satoru
1
1.5k
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.9k
The SEO Collaboration Effect
kristinabergwall1
1
590
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Become a Pro
speakerdeck
PRO
31
6.3k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
570
GitHub's CSS Performance
jonrohan
1033
470k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
440
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
320
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
How to build a perfect <img>
jonoalderson
1
6.1k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
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!