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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/
__pycache__/
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
PYTHON_SRCS= \
miner_exporter.py \
miner_jsonrpc.py

PYTHON?= python3

DESTROOT?= /home/helium/validator_exporter

BUILT_SERVICE= build/validator_exporter.service
STARTUP= build/run

all: $(BUILT_SERVICE) $(STARTUP)

install: $(DESTROOT)/pyenv $(STARTUP)
for pysrc in $(PYTHON_SRCS); do \
install -D $$pysrc $(DESTROOT); \
done
install $(STARTUP) $(DESTROOT)

install-service: $(BUILT_SERVICE)
install $(BUILT_SERVICE) /etc/systemd/system

$(DESTROOT)/pyenv:
$(PYTHON) -m venv $@ && . $(DESTROOT)/pyenv/bin/activate && pip install -r requirements.txt

$(BUILT_SERVICE): validator_exporter.service.in
mkdir -p build
sed -e s,@@DESTROOT@@,$(DESTROOT),g < $< > $@

$(STARTUP): run.sh.in
mkdir -p build
sed -e s,@@DESTROOT@@,$(DESTROOT),g < $< > $@

clean:
rm -f $(BUILT_SERVICE)

25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,32 @@ services:
## Running locally
On the miner machine:

install python3
install python3, python3-venv

```
pip install prometheus_client psutil docker
pip install prometheus_client
```
Details on the libraries:
* [client\_python](https://github.com/prometheus/client_python)
* [psutil](https://github.com/giampaolo/psutil)
* [docker](https://pypi.org/project/docker/)

Then install the service in a home directory:

```
sudo make install
```

Then install the systemd unit file:

```
sudo make install-service
```

Then enable and start the service:

```
sudo systemctl enable validator_exporter
sudo systemctl start validator_exporter
```

## Configuration

Expand Down
Loading