Skip to content

Commit

Permalink
Preparation for release
Browse files Browse the repository at this point in the history
  • Loading branch information
corny committed Mar 13, 2021
1 parent 1e3e80b commit d090dda
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 13 deletions.
7 changes: 3 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ nfpms:

# Sometimes it is important to be able to set the mtime, mode, owner, or group for a file
# that differs from what is on the local build system at build time.
- src: exporter/config.example.toml
- src: config.example.toml
dst: /etc/triax-eoc-exporter/config.toml
type: config
file_info:
mode: 0600
mtime: 2008-01-02T15:04:05Z
owner: notRoot
group: notRoot
owner: triax-eoc-exporter
group: triax-eoc-exporter

# Scripts to execute during the installation of the package.
# Keys are the possible targets during the installation process
Expand Down
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,42 @@ Triax EoC Exporter

This is a [Prometheus](https://prometheus.io/) exporter for
[Triax EoC controllers](https://www.triax.com/products/ethernet-over-coax).

## Installation

Use one of the ready-to-use [releases](https://github.com/digineo/triax-eoc-exporter/releases), or compile and install it using the Go toolchain:

go install github.com/digineo/triax-eoc-exporter@latest

## Configuration

### Exporter

List all your controllers in the config.toml file.

If you use the Debian package, just edit `/etc/triax-eoc-exporter/config.toml` and restart the exporter by running `systemctl restart triax-eoc-exporter`.
Modify the start parameters in `/etc/defaults/triax-eoc-exporter` if you want the controller to bind on other addresses than localhost.


After starting the controller, just visit http://localhost:9809/
You will see a list of all configured controllers and links to the corresponding metrics endpoints.

### Prometheus

Add a scrape config to your Prometheus configuration and reload Prometheus.

```yaml
scrape_configs:
- job_name: triax-eoc
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9809 # The exporter's real hostname:port
static_configs:
- targets: # list the configured aliases below
- my-controller
- another-controller
```
6 changes: 6 additions & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[[eoc-controller]]

alias = "my-controller"
host = "192.168.10.1"
# port = 8443
password = "admin"
5 changes: 5 additions & 0 deletions debian/postinstall.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/sh

groupadd --system triax-eoc-exporter || true
useradd --system -d /nonexistent -s /usr/sbin/nologin -g triax-eoc-exporter triax-eoc-exporter || true

chown triax-eoc-exporter /etc/triax-eoc-exporter/*.toml

systemctl daemon-reload
systemctl enable triax-eoc-exporter
systemctl restart triax-eoc-exporter
2 changes: 2 additions & 0 deletions debian/postremove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
case "$1" in
remove)
systemctl daemon-reload
userdel triax-eoc-exporter || true
groupdel triax-eoc-exporter 2>/dev/null || true
;;
esac
2 changes: 1 addition & 1 deletion debian/preremove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
case "$1" in
remove)
systemctl disable triax-eoc-exporter || true
systemctl stop triax-eoc-exporter || true
systemctl stop triax-eoc-exporter || true
;;
esac
6 changes: 3 additions & 3 deletions debian/triax-eoc-exporter.service
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[Unit]
Description=Triax EoC Exporter
Documentation=https://github.com/digineo
Description=Triax EoC Exporter for Prometheus
Documentation=https://github.com/digineo/triax-eoc-exporter

[Service]
EnvironmentFile=/etc/default/triax-eoc-exporter
ExecStart=/usr/bin/triax-eoc-exporter --web.config=/etc/triax-eoc-exporter/config.toml $ARGS
User=prometheus
User=triax-eoc-exporter
ProtectSystem=strict
ProtectHome=yes
ReadOnlyPaths=/etc/triax-eoc-exporter
Expand Down
5 changes: 0 additions & 5 deletions exporter/config.example.toml

This file was deleted.

0 comments on commit d090dda

Please sign in to comment.