Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM golang

ADD . /go/src/github.com/hunterlong/ethexporter
RUN cd /go/src/github.com/hunterlong/ethexporter && go get
RUN go install github.com/hunterlong/ethexporter
ADD . /go/src/github.com/apolikamixitos/ethexporter
RUN cd /go/src/github.com/apolikamixitos/ethexporter && go get
RUN go install github.com/apolikamixitos/ethexporter

ENV GETH https://mainnet.infura.io
ENV PORT 9015
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ A lightweight Prometheus exporter and [Grafana Dashboard](https://grafana.com/da
## Watch Addresses
The `addresses.txt` file holds all the addresses to fetch balances for. Use the format `name:address` on each new line.
```
etherdelta:0x8d12A197cB00D4747a1fe03395095ce2A5CC6819
bittrex:0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98
etherdelta_1:0x8d12A197cB00D4747a1fe03395095ce2A5CC6819:group_1
etherdelta_2:0x8d12A197cB00D4747a1fe03395095ce2A5CC6819:group_1
bittrex:0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98:group_2
```

## Running the Exporter
Expand Down Expand Up @@ -46,10 +47,10 @@ The Docker image should be running with the default addresses.

## Prometheus Response
```
eth_balance{name="etherdelta",address="0x8d12A197cB00D4747a1fe03395095ce2A5CC6819"} 24919.37437
eth_balance{name="bittrex",address="0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98"} 687509.5097
eth_balance{name="poloniex",address="0x32Be343B94f860124dC4fEe278FDCBD38C102D88"} 72284.47401
eth_balance{name="kraken",address="0x267be1c1d684f78cb4f6a176c4911b741e4ffdc0"} 159592.0022
eth_balance{name="etherdelta",address="0x8d12A197cB00D4747a1fe03395095ce2A5CC6819", exchange="group_1"} 24919.37437
eth_balance{name="bittrex",address="0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98", exchange="group_2"} 687509.5097
eth_balance{name="poloniex",address="0x32Be343B94f860124dC4fEe278FDCBD38C102D88", exchange="group_3"} 72284.47401
eth_balance{name="kraken",address="0x267be1c1d684f78cb4f6a176c4911b741e4ffdc0", exchange="group_4"} 159592.0022
eth_balance_total 944305.360280000022612512
eth_load_seconds 1.15
eth_loaded_addresses 4
Expand Down
8 changes: 4 additions & 4 deletions addresses.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
etherdelta:0x8d12A197cB00D4747a1fe03395095ce2A5CC6819
bittrex:0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98
poloniex:0x32Be343B94f860124dC4fEe278FDCBD38C102D88
kraken:0x267be1c1d684f78cb4f6a176c4911b741e4ffdc0
etherdelta_1:0x8d12A197cB00D4747a1fe03395095ce2A5CC6819:etherdelta
bittrex_2:0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98:bittrex
poloniex_2:0x32Be343B94f860124dC4fEe278FDCBD38C102D88:poloniex
kraken_3:0x267be1c1d684f78cb4f6a176c4911b741e4ffdc0:kraken
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Watching struct {
Name string
Address string
Balance string
Exchange string
}

//
Expand Down Expand Up @@ -79,7 +80,7 @@ func MetricsHttp(w http.ResponseWriter, r *http.Request) {
bal := big.NewFloat(0)
bal.SetString(v.Balance)
total.Add(total, bal)
allOut = append(allOut, fmt.Sprintf("%veth_balance{name=\"%v\",address=\"%v\"} %v", prefix, v.Name, v.Address, v.Balance))
allOut = append(allOut, fmt.Sprintf("%veth_balance{name=\"%v\",address=\"%v\", exchange=\"%v\"} %v", prefix, v.Name, v.Address, v.Exchange, v.Balance))
}
allOut = append(allOut, fmt.Sprintf("%veth_balance_total %0.18f", prefix, total))
allOut = append(allOut, fmt.Sprintf("%veth_load_seconds %0.2f", prefix, loadSeconds))
Expand All @@ -103,6 +104,7 @@ func OpenAddresses(filename string) error {
w := &Watching{
Name: object[0],
Address: object[1],
Exchange: object[2],
}
allWatching = append(allWatching, w)
}
Expand Down