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

feat: secret files, web config and better docs #142

Merged
merged 1 commit into from
Oct 26, 2023
Merged
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
8 changes: 8 additions & 0 deletions changelog/1.2.0_2023-10-26/file-secrets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Change: Read secrets form files

We have added proper support to load secrets like the password from files or
from base64-encoded strings. Just provide the flags or environment variables
for token or private key with a DSN formatted string like `file://path/to/file`
or `base64://Zm9vYmFy`.

https://github.com/promhippie/hetzner_exporter/pull/142
8 changes: 8 additions & 0 deletions changelog/1.2.0_2023-10-26/pprof-profiler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Enhancement: Integrate option pprof profiling

We have added an option to enable a pprof endpoint for proper profiling support
with the help of tools like Parca. The endpoint `/debug/pprof` can now
optionally be enabled to get the profiling details for catching potential memory
leaks.

https://github.com/promhippie/hetzner_exporter/pull/142
7 changes: 7 additions & 0 deletions changelog/1.2.0_2023-10-26/web-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Change: Integrate standard web config

We integrated the new web config from the Prometheus toolkit which provides a
configuration for TLS support and also some basic builtin authentication. For
the detailed configuration you can check out the documentation.

https://github.com/promhippie/hetzner_exporter/pull/142
5 changes: 3 additions & 2 deletions docs/content/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ helm install hetzner-exporter promhippie/hetzner-exporter
{{< / highlight >}}

You can also watch that available values and generally the details of the chart
provided by us within our [chart][chart] repository.
provided by us within our [chart][chart] repository or on [Artifacthub][ahub].

After applying this manifest the exporter should be directly visible within your
Prometheus instance depending on your installation if you enabled the
annotations or the service monitor.

[kustomize]: https://github.com/kubernetes-sigs/kustomize
[helm]: https://helm.sh
[chart]: https://github.com/promhippie/charts/tree/master/charts/hetzner-exporter
[chart]: https://github.com/promhippie/charts/tree/master/stable/hetzner-exporter
[ahub]: https://artifacthub.io/packages/helm/promhippie/hetzner-exporter
16 changes: 16 additions & 0 deletions docs/content/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ support for it, for details about the config format look at the
- HETZNER_EXPORTER_LOG_PRETTY=true
{{< / highlight >}}

If you want to provide the required secrets from a file it's also possible. For
this use case you can write the secret to a file on any path and reference it
with the following format:

{{< highlight diff >}}
hetzner_exporter:
image: promhippie/hetzner-exporter:latest
restart: always
environment:
- - HETZNER_EXPORTER_USERNAME=#ws+qOeMD4UP
- - HETZNER_EXPORTER_PASSWORD=CNFPCgivAAqWu613
+ - HETZNER_EXPORTER_USERNAME=file://path/to/secret/file/with/username
+ - HETZNER_EXPORTER_PASSWORD=file://path/to/secret/file/with/password
- HETZNER_EXPORTER_LOG_PRETTY=true
{{< / highlight >}}

Finally the exporter should be configured fine, let's start this stack with
[docker-compose][compose], you just need to execute `docker-compose up` within
the directory where you have stored the `prometheus.yml` and
Expand Down
8 changes: 7 additions & 1 deletion docs/layouts/partials/style.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
line-height: 1.6;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
color: #242424;
max-width: 800px;
max-width: 900px;
margin: 5% auto;
}

Expand Down Expand Up @@ -115,6 +115,7 @@
h3 {
font-size: 18px;
margin-bottom: 0.3em;
margin-top: 1.0em;
}

h1 small a {
Expand Down Expand Up @@ -215,6 +216,11 @@

dl dt {
font-weight: bold;
margin-top: 10px;
}

dl dt:first-child {
margin-top: 0px;
}

dl dd {
Expand Down
9 changes: 9 additions & 0 deletions docs/partials/envvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ HETZNER_EXPORTER_WEB_ADDRESS
HETZNER_EXPORTER_WEB_PATH
: Path to bind the metrics server, defaults to `/metrics`

HETZNER_EXPORTER_WEB_PPROF
: Enable pprof debugging for server, defaults to `false`

HETZNER_EXPORTER_WEB_TIMEOUT
: Server metrics endpoint timeout, defaults to `10s`

HETZNER_EXPORTER_WEB_CONFIG
: Path to web-config file

HETZNER_EXPORTER_REQUEST_TIMEOUT
: Request timeout as duration, defaults to `5s`

Expand Down
36 changes: 18 additions & 18 deletions docs/partials/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,56 @@ hetzner_request_duration_seconds{collector}
hetzner_request_failures_total{collector}
: Total number of failed requests to the api per collector

hetzner_server_cancelled{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_server_cancelled{id, name, datacenter}
: If 1 the server have been cancelled, 0 otherwise

hetzner_server_flatrate{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_server_flatrate{id, name, datacenter}
: If 1 the server got a flatrate enabled, 0 otherwise

hetzner_server_paid_timestamp{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_server_paid_timestamp{id, name, datacenter}
: Timestamp of the date until server is paid

hetzner_server_running{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_server_running{id, name, datacenter}
: If 1 the server is running, 0 otherwise

hetzner_server_traffic_bytes{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_server_traffic_bytes{id, name, datacenter}
: Amount of included traffic for the server

hetzner_ssh_key{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_ssh_key{name, type, size, fingerprint}
: Information about SSH keys in your Hetzner robot

hetzner_storagebox_cancelled{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_cancelled{id, name, location, login}
: If 1 the storagebox have been cancelled, 0 otherwise

hetzner_storagebox_data{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_data{id, name, location, login}
: Used storage by files for the storagebox in MB

hetzner_storagebox_external{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_external{id, name, location, login}
: If 1 the storagebox can be accessed from external, 0 otherwise

hetzner_storagebox_locked{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_locked{id, name, location, login}
: If 1 the storagebox have been locked, 0 otherwise

hetzner_storagebox_paid{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_paid{id, name, location, login}
: Timestamp of the date until storagebox is paid

hetzner_storagebox_quota{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_quota{id, name, location, login}
: Available storage for the storagebox in MB

hetzner_storagebox_samba{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_samba{id, name, location, login}
: If 1 the storagebox can be accessed via samba, 0 otherwise

hetzner_storagebox_snapshots{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_snapshots{id, name, location, login}
: Used storage by snapshots for the storagebox in MB

hetzner_storagebox_ssh{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_ssh{id, name, location, login}
: If 1 the storagebox can be accessed via ssh, 0 otherwise

hetzner_storagebox_usage{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_usage{id, name, location, login}
: Used storage for the storagebox in MB

hetzner_storagebox_webdav{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_webdav{id, name, location, login}
: If 1 the storagebox can be accessed via webdav, 0 otherwise

hetzner_storagebox_zfs{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
hetzner_storagebox_zfs{id, name, location, login}
: If 1 the zfs directory is visible, 0 otherwise
23 changes: 17 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,37 @@ require (
github.com/joho/godotenv v1.5.1
github.com/oklog/run v1.1.0
github.com/prometheus/client_golang v1.17.0
github.com/prometheus/exporter-toolkit v0.10.0
github.com/stretchr/testify v1.8.4
github.com/urfave/cli/v2 v2.25.7
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading