diff --git a/Dockerfile b/Dockerfile index 9c850a2..2ecb26e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 91b38c1..893f548 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/addresses.txt b/addresses.txt index ecf1180..8085681 100644 --- a/addresses.txt +++ b/addresses.txt @@ -1,4 +1,4 @@ -etherdelta:0x8d12A197cB00D4747a1fe03395095ce2A5CC6819 -bittrex:0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98 -poloniex:0x32Be343B94f860124dC4fEe278FDCBD38C102D88 -kraken:0x267be1c1d684f78cb4f6a176c4911b741e4ffdc0 \ No newline at end of file +etherdelta_1:0x8d12A197cB00D4747a1fe03395095ce2A5CC6819:etherdelta +bittrex_2:0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98:bittrex +poloniex_2:0x32Be343B94f860124dC4fEe278FDCBD38C102D88:poloniex +kraken_3:0x267be1c1d684f78cb4f6a176c4911b741e4ffdc0:kraken diff --git a/main.go b/main.go index bb0f926..1974d25 100644 --- a/main.go +++ b/main.go @@ -27,6 +27,7 @@ type Watching struct { Name string Address string Balance string + Exchange string } // @@ -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)) @@ -103,6 +104,7 @@ func OpenAddresses(filename string) error { w := &Watching{ Name: object[0], Address: object[1], + Exchange: object[2], } allWatching = append(allWatching, w) }