Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

オブジェクトストレージ対応 #86

Closed
yamamoto-febc opened this issue Jul 12, 2022 · 1 comment
Closed

オブジェクトストレージ対応 #86

yamamoto-febc opened this issue Jul 12, 2022 · 1 comment

Comments

@yamamoto-febc
Copy link
Member

from #78

@yamamoto-febc
Copy link
Member Author

一部ソースコードの修正が必要なものの、https://github.com/ribbybibby/s3_exporter を用いることで以下のようなメトリクスが取得できる。

# HELP s3_biggest_object_size_bytes The size of the biggest object
# TYPE s3_biggest_object_size_bytes gauge
s3_biggest_object_size_bytes{bucket="example",prefix=""} 33
# HELP s3_last_modified_object_date The last modified date of the object that was modified most recently
# TYPE s3_last_modified_object_date gauge
s3_last_modified_object_date{bucket="example",prefix=""} 1.661233254e+09
# HELP s3_last_modified_object_size_bytes The size of the object that was modified most recently
# TYPE s3_last_modified_object_size_bytes gauge
s3_last_modified_object_size_bytes{bucket="example",prefix=""} 33
# HELP s3_list_duration_seconds The total duration of the list operation
# TYPE s3_list_duration_seconds gauge
s3_list_duration_seconds{bucket="example",delimiter="",prefix=""} 0.055118542
# HELP s3_list_success If the ListObjects operation was a success
# TYPE s3_list_success gauge
s3_list_success{bucket="example",delimiter="",prefix=""} 1
# HELP s3_objects The total number of objects for the bucket/prefix combination
# TYPE s3_objects gauge
s3_objects{bucket="example",prefix=""} 1
# HELP s3_objects_size_sum_bytes The total size of all objects summed
# TYPE s3_objects_size_sum_bytes gauge
s3_objects_size_sum_bytes{bucket="example",prefix=""} 33
* Connection #0 to host localhost left intact

実行方法

$ AWS_ACCESS_KEY_ID="token AWS_SECRET_ACCESS_KEY="secret" AWS_REGION=jp-north-1  ./s3_exporter --s3.force-path-style --s3.endpoint-url="https://s3.isk01.sakurastorage.jp"
# バケット foobar の場合
curl 'http://localhost:9340/probe?bucket=foobar'

修正箇所

https://github.com/ribbybibby/s3_exporter/blob/d5fe50c9ebae5c5130ddd345536d486b5088469e/s3_exporter.go#L129
resp.NextContinuationTokenがnilではなく空文字で返ってくるため判定を追加

if resp.NextContinuationToken == nil || *resp.NextContinuationToken == "" {

このためsakuracloud_exporterで対応しなくても良さそう。
今後具体的な要望/ユースケースが出てきたら再度検討する。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant