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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
460
クラウドを使う側から、作る側へ / 大吉祥寺.pm 2026前夜祭
fujiwara3
8
2.1k
作るべきものと向き合う - ecspresso 8年間の開発史から学ぶ技術選定 / 技術選定con findy 2026
fujiwara3
9
6k
さくらのクラウドでのシークレット管理を考える/tamachi.sre#2
fujiwara3
2
400
Amazon ECS デプロイツール ecspresso の開発を支える「正しい抽象化」の探求 / YAPC::Fukuoka 2025
fujiwara3
13
14k
パフォーマンスチューニングのために普段からできること/Performance Tuning: Daily Practices
fujiwara3
9
6.9k
alecthomas/kong はいいぞ
fujiwara3
7
2.6k
ecspressoの設計思想に至る道 / sekkeinight2025
fujiwara3
12
3.8k
さくらのIaaS基盤のモニタリングとOpenTelemetry/OSC Hokkaido 2025
fujiwara3
4
5.4k
Other Decks in Technology
See All in Technology
Adaptive Warehouse を今すぐ導入すべき理由と迷ったときの判断基準
__allllllllez__
0
170
[2026-09-11]SREは誰のもの?運用エンジニアが始める 「SRE領域への越境」とチームの進化の軌跡 〜Road to NEXT CRE
tosite
0
120
The Agent Builder Loop from Daily Work to OSS
minorun365
PRO
3
130
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
3
450
AIで実装は速くなった。なのにプロダクトは速くならない。職能の壁を越えて価値のフローを設計する
nwiizo
8
7.8k
アプリログインとWeb認証基盤をつなぐ ASWebAuthenticationSession 作法
shimastripe
1
190
アリアドネの糸と、20年ごとの建て替え ── 長尾真『電子図書館』を、伊勢で読み直す / Rereading Makoto Nagao’s "Electronic Library" in Ise
ykiyota
0
150
Snowflakeで実現する全社横断の顧客の声(VOC)分析・活用基盤@Snowflake World Tour Tokyo 2026
yuto16
0
160
AIとペアプロを始める。人とのペアプロをやめる。ペアプロの良さを改めて知る。もっと好きになった。 / Rediscovering Pair Programming
honyanya
1
340
作品が生態系になった ─ Mini Tokyo 3D から世界へ
nagix
0
150
AI活用の現在地、 ちゃんと見えてますか?/XPfest-2026
visional_engineering_and_design
0
180
HRC_Frontend_Conference_Fukuoka_2026.pdf
ts020
0
410
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
310
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
202
76k
The SEO identity crisis: Don't let AI make you average
varn
0
550
GitHub's CSS Performance
jonrohan
1033
470k
A Tale of Four Properties
chriscoyier
163
24k
Between Models and Reality
mayunak
4
450
GraphQLとの向き合い方2022年版
quramy
50
15k
4 Signs Your Business is Dying
shpigford
187
23k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.6k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
690
[SF Ruby Conf 2025] Rails X
palkan
2
1.4k
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!