Skip to content

Commit

Permalink
more make options
Browse files Browse the repository at this point in the history
  • Loading branch information
ericlagergren committed Nov 11, 2019
1 parent e2a9fb3 commit 04706c5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ LDFLAGS=-L/opt/vc/lib -lbcm_host -lvcos -lvchiq_arm
TARGET=pi-stats
DEST=/usr/local/bin

.PHONY: all install clean
.PHONY: all install install-service install-logrot clean

all: $(TARGET)
default: $(TARGET) clean
all: install install-service install-logrot clean

OBJECT=$(TARGET).o

Expand All @@ -18,7 +19,13 @@ $(TARGET): $(OBJECT)

install: $(TARGET)
mkdir -p $(DEST)
cp $< $(DEST)/$(TARGET)
mv $< $(DEST)/$(TARGET)

install-service: $(TARGET)
cp $(TARGET).service /etc/systemd/system

install-logrot: $(TARGET)
cp $(TARGET).conf /etc/logrotate.d/pi-stats

clean:
$(RM) *~ *.o $(TARGET)
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,29 @@
`pi-stats` reads stats from a Raspberry Pi's VideoCore processor and writes them
to stdout using InfluxDB's line protocol[0].

## Usage
## Installing

To have everything installed for you, run `make all`. You'll likely need root
privileges.

To install `pi-stats` manually:

1. Build the `pi-stats` binary with `make` (or `make install` and skip step #2)
2. Install inside `/usr/local/bin`
3. Copy `pi-stats.service` to `/etc/systemd/service`
4. Copy `pi-stats.conf` to `/etc/logrotate.d`
5. Enable and start the `pi-stats` service: `systemctl enable pi-stats` and
`systemctl start pi-stats`, respectively
2. Copy `pi-stats` to `/usr/local/bin`
3. Copy `pi-stats.service` to `/etc/systemd/service/` (or `make install-service`)
4. Copy `pi-stats.conf` to `/etc/logrotate.d/pi-stats` (or `make install-logrot`)

Once you've installed `pi-stats`, make sure to enable and run the service with
`systemctl enable pi-stats` and `systemctl start pi-stats`, respectively. Again,
you'll likely need root privileges.

# Configuring

By default, `pi-stats` reads from VideoCore once per second. This can be
configured with the `-s` flag, which is the number of seconds between reads.

# Usage

The stats are written to `/var/log/pi-stats.log`, which can then be parsed by
Telegraf[1].

Expand Down

0 comments on commit 04706c5

Please sign in to comment.