Skip to content

Commit

Permalink
Merge pull request #53 from promhippie/new-features
Browse files Browse the repository at this point in the history
feat: secret files, web config and better docs
  • Loading branch information
tboerger authored Oct 26, 2023
2 parents 5a45fc6 + 1ad55d5 commit 3520bfc
Show file tree
Hide file tree
Showing 16 changed files with 298 additions and 68 deletions.
8 changes: 8 additions & 0 deletions changelog/1.1.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/scw_exporter/pull/53
8 changes: 8 additions & 0 deletions changelog/1.1.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/scw_exporter/pull/53
7 changes: 7 additions & 0 deletions changelog/1.1.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/scw_exporter/pull/53
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 scw-exporter promhippie/scw-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/scw-exporter
[chart]: https://github.com/promhippie/charts/tree/master/stable/scw-exporter
[ahub]: https://artifacthub.io/packages/helm/promhippie/scw-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
- SCW_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 >}}
scw_exporter:
image: promhippie/scw-exporter:latest
restart: always
environment:
- - SCW_EXPORTER_ACESS_KEY=your-access-key
- - SCW_EXPORTER_SECRET_KEY=your-secret-key
+ - SCW_EXPORTER_ACESS_KEY=file://path/to/secret/file/with/access-key
+ - SCW_EXPORTER_SECRET_KEY=file://path/to/secret/file/with/secret-key
- SCW_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 @@ SCW_EXPORTER_WEB_ADDRESS
SCW_EXPORTER_WEB_PATH
: Path to bind the metrics server, defaults to `/metrics`

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

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

SCW_EXPORTER_WEB_CONFIG
: Path to web-config file

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

Expand Down
82 changes: 41 additions & 41 deletions docs/partials/metrics.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
scw_dashboard_images_count{<prometheus.ConstrainedLabel Value>}
scw_dashboard_images_count{zone}
: Count of used images

scw_dashboard_ips_count{<prometheus.ConstrainedLabel Value>}
scw_dashboard_ips_count{zone}
: Count of used IPs

scw_dashboard_placement_groups_count{<prometheus.ConstrainedLabel Value>}
scw_dashboard_placement_groups_count{zone}
: Count of placement groups

scw_dashboard_private_nics_count{<prometheus.ConstrainedLabel Value>}
scw_dashboard_private_nics_count{zone}
: Count of private nics

scw_dashboard_running_servers{<prometheus.ConstrainedLabel Value>}
scw_dashboard_running_servers{zone}
: Count of running servers

scw_dashboard_security_groups_count{<prometheus.ConstrainedLabel Value>}
scw_dashboard_security_groups_count{zone}
: Count of security groups

scw_dashboard_server_types_count{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_dashboard_server_types_count{zone, type}
: Count of servers by type

scw_dashboard_servers_count{<prometheus.ConstrainedLabel Value>}
scw_dashboard_servers_count{zone}
: Count of owned servers

scw_dashboard_snapshots_count{<prometheus.ConstrainedLabel Value>}
scw_dashboard_snapshots_count{zone}
: Count of used snapshots

scw_dashboard_unused_ips_count{<prometheus.ConstrainedLabel Value>}
scw_dashboard_unused_ips_count{zone}
: Count of unused IPs

scw_dashboard_volumes_bssd_count{<prometheus.ConstrainedLabel Value>}
scw_dashboard_volumes_bssd_count{zone}
: Count of unused IPs

scw_dashboard_volumes_bssd_total_size{<prometheus.ConstrainedLabel Value>}
scw_dashboard_volumes_bssd_total_size{zone}
: Count of unused IPs

scw_dashboard_volumes_count{<prometheus.ConstrainedLabel Value>}
scw_dashboard_volumes_count{zone}
: Count of used volumes

scw_dashboard_volumes_lssd_count{<prometheus.ConstrainedLabel Value>}
scw_dashboard_volumes_lssd_count{zone}
: Count of unused IPs

scw_dashboard_volumes_lssd_total_size{<prometheus.ConstrainedLabel Value>}
scw_dashboard_volumes_lssd_total_size{zone}
: Count of unused IPs

scw_request_duration_seconds{collector}
Expand All @@ -49,80 +49,80 @@ scw_request_duration_seconds{collector}
scw_request_failures_total{collector}
: Total number of failed requests to the api per collector

scw_security_group_created_timestamp{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_security_group_created_timestamp{id, name, zone, org, project}
: Timestamp when the security group have been created

scw_security_group_defined{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_security_group_defined{id, name, zone, org, project}
: Constant value of 1 that this security group is defined

scw_security_group_enable_default{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_security_group_enable_default{id, name, zone, org, project}
: 1 if the security group is enabled by default, 0 otherwise

scw_security_group_inbound_default_policy{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_security_group_inbound_default_policy{id, name, zone, org, project}
: 1 if the security group inbound default policy is accept, 0 otherwise

scw_security_group_modified_timestamp{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_security_group_modified_timestamp{id, name, zone, org, project}
: Timestamp when the security group have been modified

scw_security_group_outbound_default_policy{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_security_group_outbound_default_policy{id, name, zone, org, project}
: 1 if the security group outbound default policy is accept, 0 otherwise

scw_security_group_project_default{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_security_group_project_default{id, name, zone, org, project}
: 1 if the security group is an project default, 0 otherwise

scw_security_group_servers_count{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_security_group_servers_count{id, name, zone, org, project}
: Number of servers attached to the security group

scw_security_group_stateful{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_security_group_stateful{id, name, zone, org, project}
: 1 if the security group is stateful by default, 0 otherwise

scw_server_created_timestamp{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_server_created_timestamp{id, name, zone, org, project, type, private_ip, public_ip, arch}
: Timestamp when the server have been created

scw_server_modified_timestamp{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_server_modified_timestamp{id, name, zone, org, project, type, private_ip, public_ip, arch}
: Timestamp when the server have been modified

scw_server_private_nic_count{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_server_private_nic_count{id, name, zone, org, project, type, private_ip, public_ip, arch}
: Number of private nics attached

scw_server_state{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_server_state{id, name, zone, org, project, type, private_ip, public_ip, arch}
: If 1 the server is running, depending on the state otherwise

scw_server_volume_count{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_server_volume_count{id, name, zone, org, project, type, private_ip, public_ip, arch}
: Number of volumes attached

scw_snapshot_available{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_snapshot_available{id, name, zone, org, project}
: Constant value of 1 that this snapshot is available

scw_snapshot_created_timestamp{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_snapshot_created_timestamp{id, name, zone, org, project}
: Timestamp when the snapshot have been created

scw_snapshot_modified_timestamp{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_snapshot_modified_timestamp{id, name, zone, org, project}
: Timestamp when the snapshot have been modified

scw_snapshot_size_bytes{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_snapshot_size_bytes{id, name, zone, org, project}
: Size of the snapshot in bytes

scw_snapshot_state{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_snapshot_state{id, name, zone, org, project}
: State of the snapshot

scw_snapshot_type{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_snapshot_type{id, name, zone, org, project}
: Type of the snapshot

scw_volume_available{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_volume_available{id, name, zone, org, project}
: Constant value of 1 that this volume is available

scw_volume_created_timestamp{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_volume_created_timestamp{id, name, zone, org, project}
: Timestamp when the volume have been created

scw_volume_modified_timestamp{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_volume_modified_timestamp{id, name, zone, org, project}
: Timestamp when the volume have been modified

scw_volume_size_bytes{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_volume_size_bytes{id, name, zone, org, project}
: Size of the volume in bytes

scw_volume_state{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_volume_state{id, name, zone, org, project}
: State of the snapshot

scw_volume_type{<prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>, <prometheus.ConstrainedLabel Value>}
scw_volume_type{id, name, zone, org, project}
: Type of the snapshot
22 changes: 16 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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/scaleway/scaleway-sdk-go v1.0.0-beta.21
github.com/stretchr/testify v1.8.4
github.com/urfave/cli/v2 v2.25.7
Expand All @@ -16,19 +17,28 @@ require (
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
Expand Down
Loading

0 comments on commit 3520bfc

Please sign in to comment.