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
670
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
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
150
Claude の新機能を、 出た日に触って社内に届けるまで
rfdnxbro
1
170
1つのリクエストを追って理解する - llm-dのP/D分離
akhino
1
160
DWH の限界突破! AI エージェント向け爆速リアルタイムデータ基盤 ClickHouse
jozono
1
470
遠藤な_めぐろLT #38 「社内のAI活用推進」@麻布台_20261009
endonanana
0
130
その Valkey 使いこなしていますか?
onk
PRO
5
1.5k
大型犬好きによるPugの紹介
yamanoku
1
160
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
430
パスキーの自動テストはどこまでいけるのか
teamlab
PRO
0
200
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
7
6k
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
1
150
エンタメ企業のM&Aを支えるデータ基盤 ― 統合から店舗のリアルタイム分析まで / Data Engineering Summit 2026
genda
0
170
Featured
See All Featured
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
The SEO identity crisis: Don't let AI make you average
varn
0
590
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
450
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Optimising Largest Contentful Paint
csswizardry
37
4k
Being A Developer After 40
akosma
92
590k
WCS-LA-2024
lcolladotor
0
890
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
For a Future-Friendly Web
brad_frost
184
10k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
930
Amusing Abliteration
ianozsvald
1
350
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
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)