Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hatotaka committed Dec 12, 2018
0 parents commit 95974fc
Show file tree
Hide file tree
Showing 184 changed files with 41,941 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/nasne_exporter
114 changes: 114 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true


[[constraint]]
branch = "master"
name = "github.com/golang/glog"

[[constraint]]
name = "github.com/prometheus/client_golang"
version = "0.8.0"

[[constraint]]
name = "github.com/spf13/cobra"
version = "0.0.1"

[prune]
go-tests = true
unused-packages = true
8 changes: 8 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)

Copyright © 2018 Takahiro Hatori

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
PACKAGE_NAME=github.com/hatotaka/nasne_exporter
CONTAINER_NAME=quay.io/hatotaka/nasne_exporter
BIN_NAME=nasne_exporter


.PHONY: build-local build-container clean
build-local:
go build -o ${BIN_NAME} $(PACKAGE_NAME)/cmd/nasne_exporter

build-container:
docker build \
-t $(CONTAINER_NAME):local \
-f build/package/Dockerfile.amd64 \
.
clean:
rm -rf ${BIN_NAME}
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Nasne exporter
[![Docker Repository on Quay](https://quay.io/repository/hatotaka/nasne_exporter/status "Docker Repository on Quay")](https://quay.io/repository/hatotaka/nasne_exporter)

[nasne](https://www.jp.playstation.com/nasne/) 用 Prometheus exporterです。

## メトリクス

| メトリクス名 | メトリクスタイプ | ラベル | 説明 |
| --- | --- | --- | --- |
| `nasne_info` | Gauge | `hardware_version` `name` `product_name` `software_version` | nasne 情報 |
| `nasne_hdd_size_bytes` | Gauge | `format` `id` `name` `product_id` `vendor_id` | ハードディスクの容量 |
| `nasne_hdd_usage_bytes` | Gauge | `format` `id` `name` `product_id` `vendor_id` | ハードディスクの使用容量 |
| `nasne_dtcpip_clients` | Gauge | `name` | 接続されているDTCP-IPのクライアント数 |
| `nasne_recordings` | Gauge | `name` | 録画中の件数 |
| `nasne_recorded_titles` | Gauge | `name` | 録画されている件数 |
| `nasne_reserved_titles` | Gauge | `name` | 予約されている件数 |
| `nasne_reserved_conflict_titles` | Gauge | `name` | コンフリクトした録画件数 |
| `nasne_reserved_notfound_titles` | Gauge | `name` | 見つからない録画件数 |
| `nasne_last_collect_time` | Gauge | | 最後にメトリクスを収集した時間 |
| `nasne_collect_duration_seconds` | Histogram | `name` | メトリクス収集にかかった時間 |

## ビルドと実行

以下のソフトウェアに依存しています。

- [Go compiler](https://golang.org/dl/)

以下の手順でビルドできます。

```
go get github.com/hatotaka/nasne_exporter
cd ${GOPATH-$HOME/go}/src/github.com/hatotaka/nasne_exporter
make
./nasne_exporter <flags>
```

フラグは以下の方法で確認できます。

```
./nasne_exporter -h
```
21 changes: 21 additions & 0 deletions build/package/Dockerfile.amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Build
FROM golang:1.11 AS build

ENV workdir /go/src/github.com/hatotaka/nasne_exporter
ENV CGO_ENABLED 0
ENV GOARCH amd64

ADD . ${workdir}
WORKDIR ${workdir}

RUN go build \
-o /tmp/nasne_exporter \
github.com/hatotaka/nasne_exporter/cmd/nasne_exporter

## Run
FROM scratch

EXPOSE 8080
COPY --from=build /tmp/nasne_exporter /opt/bin/

ENTRYPOINT ["/opt/bin/nasne_exporter"]
21 changes: 21 additions & 0 deletions build/package/Dockerfile.arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Build
FROM golang:1.11 AS build

ENV workdir /go/src/github.com/hatotaka/nasne_exporter
ENV CGO_ENABLED 0
ENV GOARCH arm

ADD . ${workdir}
WORKDIR ${workdir}

RUN go build \
-o /tmp/nasne_exporter \
github.com/hatotaka/nasne_exporter/cmd/nasne_exporter

## Run
FROM scratch

EXPOSE 8080
COPY --from=build /tmp/nasne_exporter /opt/bin/

ENTRYPOINT ["/opt/bin/nasne_exporter"]
Loading

0 comments on commit 95974fc

Please sign in to comment.