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
PrometheusExporterを作ってみた+α
Search
Transnano
February 12, 2019
Technology
280
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PrometheusExporterを作ってみた+α
2019/02/12 Fukuoka.go#13で登壇した内容です
タグ:Prometheus, golang
Transnano
February 12, 2019
More Decks by Transnano
See All by Transnano
ヤフーのデータ入出稿を支えるSRE
transnano
0
660
2019/07/11 ふくばねてす node-2 コンテナ移行におけるアレコレと使えるアレコレ(仮)
transnano
0
480
Consulって何だろう
transnano
0
140
バックエンドエンジニアから見たReact #react_fukuoka
transnano
2
140
Other Decks in Technology
See All in Technology
AIエージェントの自己改善をどう設計するか / How to Design Self-Improvement for AI Agents
22mi
25
17k
現場で役立つ技術負債の効果的な返済方法
masuda220
PRO
9
5k
ユーザー価値を届け続けるためにウォンテッドリーが大切にしている文化
kotaminato
0
190
AgentCore Runtime上にAgentic Coding基盤を構築・展開する際の設計ポイントと限界点 / Design considerations and limitations when building an agentic coding platform on AgentCore Runtime
har1101
5
630
「どのログを見ればいい?」 から始めた サーバーレス障害解析
y_waka1
1
120
俺の仕事は AIに奪われないし、たぶんその BIも要らない
hikaruri
0
540
なぜ「決定性」が 決定的に重要なのか? Durable Execution 基盤の数理的理解 #serverlessjp / ServerlessDays Tokyo 2026
ytaka23
3
1.1k
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
460
エージェントはローカル、検証はMicroVM — Lambda MicroVMsでつくるServerless CI
fujioka6789
3
650
ADKで始める業務改善 - AIエージェント開発時の考えと設計
harappa80
2
260
JSONataとAWS Step Functionsで目指すRuntimelessな世界
mu7889yoon
0
400
`t*(42&t>>10)`だけで音楽が鳴る、Swiftで実装するBytebeat / iOSDC Japan 2026
yutailang0119
0
130
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Odyssey Design
rkendrick25
PRO
2
810
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Test your architecture with Archunit
thirion
2
2.4k
For a Future-Friendly Web
brad_frost
183
10k
The Invisible Side of Design
smashingmag
301
52k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
820
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
2k
Docker and Python
trallard
47
4.2k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Transcript
PrometheusExporterを作っ てみた+α 2019/02/12 杉永 良太
自己紹介 杉永 良太 @transnano 普段の業務ではSRE的なことをやっ てます Go歴:初級レベルくらい • Dockerが出たとき(2013?)に ソースを読んだ
• 前職で3〜4個小さめのツール 作った • 今回のLT申し込んでからGoを 再勉強し始めた
Prometheusとは プル型の監視システム • 対象の探索 • データの取得・保管 • 集計クエリの実行 • アラート
Exporter • 対象のマシン上の状 態を収集するプログ ラム(サーバ)
Golangコミュニティでよく見る光景 発表の最後らへんに登場してくるやつ os.Exit(0)
Exit関数の説明 終了ステータス/結果コード:呼び出し元に結果を返す Ref: https://golang.org/pkg/os/#Exit
shell_exit_status_exporter シェルやプログラムの終了ステータスを監視するエクスポーター 活用例: • 終了コードに意味があるシステムの結果を知る ◦ bashで言うと、255:範囲外の終了ステータスなど ◦ HTTPステータスコードみたいに状態を示すなど •
任意のコマンド/プログラムの実行し、結果を知る ソース:Transnano / shell_exit_status_exporter - GitLab
PrometheusExporterの作り方 公式のWritingExporters - Prometheus Docsを参照 命名規則や呼び出し方などのお作法に従うこと 1. Exporterの名前には-が使えない(実行時にエラーになる a. ❎abc-exporter、⭕abc_exporter
2. Metricsの名称にも-は使えない(プログラミング言語も変数に-が使えない のと同じ理由)、prefixを付けるとわかりやすい a. ❎abc-cpu-num、⭕abc_cpu_usage、abc_memory_usage 3. 動作portはある程度Default-port-allocationsで決まっているが変更 できるように作り込んでおくと良い a. $ ./shell-exit-status-exporter -web.listen-address=”:9121”
まとめ 1. 外部コマンドの呼び出しも簡単 a. Javaとか多言語よりもシームレスに呼び出せている気がする 2. お作法に従えばExporterもすぐ出来る/従わないと動かない 3. $GOPATH/srcにghq.rootを指定するとghq+pecoで幸せになれる 4.
パッケージ管理がわからない
os.Exit(255)
sre-fukuoka.connpassを企画中 3月上旬開催予定 福岡のSREやDevOpsに興味がある人が集まって意見交換できる場 Comming Soon!!!
os.Exit(0)