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

Image change and compose addition #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM fedora:36-armhfp
FROM fedora:36

RUN dnf -y update
RUN dnf -y install libgpiod-utils python3-libgpiod swig python2 python-setuptools python-devel python3-devel python-setuptools python3-setuptools unzip curl wget make gcc which git
Expand All @@ -15,7 +15,5 @@ RUN if [[ -d "/usr/lib" ]]; then cp /usr/local/lib/lib*gpio.so.1 /usr/lib/;

RUN mkdir /src

COPY fan.py /src

RUN mkdir -p /var/lib/node_exporter; \
touch /var/lib/node_exporter/fan-metrics.prom
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ view node-exporter metrics:
# sudo tail -f /var/lib/node_exporter/fan-metrics.prom
```

## build image and run container with docker compose

An example to simply run the fan.py script can be found in `docker-compose.yaml`. To run it, type:
```
# docker compose up -d
```

Check the script output with:
```
# docker compose logs -f --tail 10`
```

## Fan metrics using node-exporter, prometheus and grafana

When the --node-exporter parameter is used, the fan.py script writes the following metrics every interval in /var/lib/node_exporter/fan-metrics.prom:
Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.8'

services:
gpioexperiment:
image: gpio
build: .
container_name: gpio_experiment
restart: unless-stopped
volumes:
- type: bind
source: ./fan.py
target: /src/fan.py
command: /usr/bin/python3 -u /src/fan.py --verbose
devices:
- /dev/gpiochip0