Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Consul KV Dashboard
Search
FUJIWARA Shunichiro
January 30, 2015
Programming
1
4.9k
Consul KV Dashboard
monitoring casual #7
FUJIWARA Shunichiro
January 30, 2015
Tweet
Share
More Decks by FUJIWARA Shunichiro
See All by FUJIWARA Shunichiro
Amazon ECS デプロイツール ecspresso の開発を支える「正しい抽象化」の探求 / YAPC::Fukuoka 2025
fujiwara3
13
5.9k
パフォーマンスチューニングのために普段からできること/Performance Tuning: Daily Practices
fujiwara3
2
260
alecthomas/kong はいいぞ
fujiwara3
6
2k
ecspressoの設計思想に至る道 / sekkeinight2025
fujiwara3
12
3.1k
さくらのIaaS基盤のモニタリングとOpenTelemetry/OSC Hokkaido 2025
fujiwara3
3
1.4k
監視のこれまでとこれから/sakura monitoring seminar 2025
fujiwara3
11
5.5k
k6による負荷試験 入門から日常的な実践まで/Re:TechTalk #01
fujiwara3
2
220
困難を「一般解」で解く
fujiwara3
10
3.9k
「隙間家具OSS」に至る道/Fujiwara Tech Conference 2025
fujiwara3
7
14k
Other Decks in Programming
See All in Programming
TypeScript 5.9 で使えるようになった import defer でパフォーマンス最適化を実現する
bicstone
1
910
関数実行の裏側では何が起きているのか?
minop1205
1
410
Level up your Gemini CLI - D&D Style!
palladius
1
160
【CA.ai #3】Google ADKを活用したAI Agent開発と運用知見
harappa80
0
220
認証・認可の基本を学ぼう前編
kouyuume
0
140
エディターってAIで操作できるんだぜ
kis9a
0
610
Rediscover the Console - SymfonyCon Amsterdam 2025
chalasr
2
120
DSPy Meetup Tokyo #1 - はじめてのDSPy
masahiro_nishimi
1
140
モダンJSフレームワークのビルドプロセス 〜なぜReactは503行、Svelteは12行なのか〜
fuuki12
0
180
スタートアップを支える技術戦略と組織づくり
pospome
8
14k
S3 VectorsとStrands Agentsを利用したAgentic RAGシステムの構築
tosuri13
4
250
Building AI Agents with TypeScript #TSKaigiHokuriku
izumin5210
5
1.2k
Featured
See All Featured
Context Engineering - Making Every Token Count
addyosmani
9
450
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
370
We Have a Design System, Now What?
morganepeng
54
7.9k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.2k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.3k
It's Worth the Effort
3n
187
29k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Building Applications with DynamoDB
mza
96
6.8k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
54k
Unsuck your backbone
ammeep
671
58k
Mobile First: as difficult as doing things right
swwweet
225
10k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
Transcript
Consul KV Dashboard Monitoring Casual #7 @fujiwara
Chef, Serverspec, Deploy, etc... ֤ϗετͰ࣮ߦͨ݁͠ՌΛ֬ೝ͍ͨ͠ͷ͍Ζ͍Ζ • chef (--why-run) • serverspec
• rsync -av ͷ log
IRCʹ௨͠Α͏ parallel, cap, ... ͷग़ྗ݁ՌΛ… ࣾ༻ nopaste-cli command $ cat
foo.log | nopaste-cli -channel "hoge" -summary "foo done!" nopasteʹPOSTͱಉ࣌ʹIRCʹURL͕௨͞ΕΔ શ·ͱΊΔͱࣦࠞͬͯ͡ഊͨ͠ͷ͕͔ΓͮΒ͍ ཧϗετ͔ΒpushͰͳ͍ܗଶ(consul event)ͰऔಘͰ͖ͳ͍
֤ϗετ͔ΒͦΕͧΕIRC௨ ϗετ͕ൺֱతগ(ʙ10ఔ)ͳΒͳ͍ ࠓ࣌1ϗετͷੑೳ͕ߴ͍ͷͰɺͦ͜·Ͱ૿͑ͳ͍ ௨͕͏Δ͚͞Εɺࣦഊͨ͠ͷ͚ͩૹΕok
αʔϏεͷن֦େ ʙ50ͱ͔ ࣦഊ࣌ͷΈૹΔͱͯ͠IRCʹઇ่͕ى͖Δ Ͳ͔͜ͰҰཡͯ͠ݟ͍ͨʂ (ઌि·Ͱίί)
Consul KV Dashboard ͭͬͨ͘ github.com/fujiwara/consul-kv-dashboard
Consul KV Dashboard Consul KVS ΛσʔλετΞʹͨ͠ϦΞϧλΠϜμογϡϘʔυ Πϕϯτ༰Λ Consul REST API
Ͱอଘ ͦΕΛ͍͍ײ͡ʹݟͤͯ͘ΕΔ wep application Go (API Server) + React.js (View) [Demo]
σʔλొ Consul REST APIͰૹΔ $ curl -X PUT -d "message"
\ localhost:8500/v1/kv/dashboard/example/myhostname?flags=1422607461000
keyߏ /v1/kv/dashboard/{category}/{nodename}? flags={timestamp * 1000 + status} • category: chef,
serverspec, deploy... • nodename: ConsulͰࣝผ͍ͯ͠Δϊʔυ໊ • flags: ࣌ࠁͷunix time * 1000 + status • status: 0=success 1=warning 2=danger 3=info
ϦΞϧλΠϜߋ৽ͷ࣮ݱํ๏ ConsulͷϒϩοΩϯάΫΤϦΛ͏ www.consul.io/docs/agent/http.html $ curl -i localhost:8500/v1/kv/dashboard/chef/myhost?recurese HTTP/1.1 200 OK
Content-Type: application/json X-Consul-Index: 261975 [{"CreateIndex":261891,"ModifyIndex":261975,"LockIndex":0, "Key":"dashboard/chef/myhost","Flags":1422602855000,"Value":".....
ϒϩοΩϯάΫΤϦ Ϩεϙϯεϔομͷ X-Consul-Index Λ index ʹࢦఆ͢Δ $ curl -i localhost:8500/v1/kv/dashboard/chef/myhost?index=261975
indexΑΓ৽͍͠σʔλ͕ൃੜ͢Δ·ͰϨεϙϯε͕Ԇ ৽͍͠σʔλ͕ൃੜ͢ΔͱϨεϙϯε͕ฦΔ ͍ΘΏΔ Long pooling
consul-kv-dashboard ͕Δ͜ͱ HTML, CSS, JavaScriptΛ • go-bindataͰ·ͱΊͨϑΝΠϧΛhttp.FileServerͰ৴͢Δ qiita.com/sfujiwara/items/b84cc2a7b326b04e0edb • όΠφϦҰݸͰ੩తϑΝΠϧ৴Ͱ͖Δ
consul-kv-dashboard ͕Δ͜ͱ Consul REST API ͷ proxy • /api/... →
localhost:8500/v1/kv/dashboard/... • ϨεϙϯεͷJSONΛΫϥΠΞϯτ͕ѻ͍͍͢Α͏ʹܗ • {"Flags":1422608524001} → {"timestamp":"2015-01-30 18:02:04 +0900","status":"warning"} View React.js
ࠓޙ શମͷstatus͕มԽͨ͠ΒτϦΨʔ(֎෦ίϚϯυ࣮ߦͱ͔