Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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
alecthomas/kong はいいぞ
fujiwara3
6
1.8k
ecspressoの設計思想に至る道 / sekkeinight2025
fujiwara3
12
2.9k
さくらのIaaS基盤のモニタリングとOpenTelemetry/OSC Hokkaido 2025
fujiwara3
3
1.2k
監視のこれまでとこれから/sakura monitoring seminar 2025
fujiwara3
11
5.3k
k6による負荷試験 入門から日常的な実践まで/Re:TechTalk #01
fujiwara3
2
160
困難を「一般解」で解く
fujiwara3
10
3.8k
「隙間家具OSS」に至る道/Fujiwara Tech Conference 2025
fujiwara3
7
13k
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
1.2k
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
11
1.4k
Other Decks in Programming
See All in Programming
GraphQL×Railsアプリのデータベース負荷分散 - 月間3,000万人利用サービスを無停止で
koxya
1
1.2k
Six and a half ridiculous things to do with Quarkus
hollycummins
0
140
エンジニアとして高みを目指す、 利益を生み出す設計の考え方 / design-for-profit
minodriven
24
12k
Catch Up: Go Style Guide Update
andpad
0
210
どの様にAIエージェントと 協業すべきだったのか?
takefumiyoshii
2
630
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
200
「ちょっと古いから」って避けてた技術書、今だからこそ読もう
mottyzzz
9
6.2k
なぜあの開発者はDevRelに伴走し続けるのか / Why Does That Developer Keep Running Alongside DevRel?
nrslib
3
390
AI Coding Meetup #3 - 導入セッション / ai-coding-meetup-3
izumin5210
0
650
uniqueパッケージの内部実装を支えるweak pointerの話
magavel
0
940
『毎日の移動』を支えるGoバックエンド内製開発
yutautsugi
2
220
GitHub Actions × AWS OIDC連携の仕組みと経緯を理解する
ota1022
0
250
Featured
See All Featured
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
9
580
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
32
2.3k
The Straight Up "How To Draw Better" Workshop
denniskardys
237
140k
How to Ace a Technical Interview
jacobian
280
24k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
The Cult of Friendly URLs
andyhume
79
6.6k
Speed Design
sergeychernyshev
32
1.1k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
114
20k
Done Done
chrislema
185
16k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.6k
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͕มԽͨ͠ΒτϦΨʔ(֎෦ίϚϯυ࣮ߦͱ͔