From 98eb34598d2bc093d677ef66e029b7f446863a54 Mon Sep 17 00:00:00 2001 From: Joshua Sing Date: Mon, 23 Dec 2024 19:48:22 +1100 Subject: [PATCH 1/2] .goreleaser.yaml: fix docker image signing (#24) --- .goreleaser.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index ed3abb6..25fc585 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -167,7 +167,8 @@ docker_manifests: # Sign Docker images and manifests. docker_signs: - - cmd: "cosign" + - artifacts: "all" + cmd: "cosign" args: - "sign" - "${artifact}" From d18789ac5b4b4303197118542b92e96a7b14405e Mon Sep 17 00:00:00 2001 From: Joshua Sing Date: Mon, 23 Dec 2024 23:23:59 +1100 Subject: [PATCH 2/2] exporter: add desired boresight metrics (#25) --- README.md | 52 +++++++++++++++++++------------------ internal/exporter/desc.go | 18 +++++++++++-- internal/exporter/scrape.go | 32 ++++++++++++++++++++++- 3 files changed, 74 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 81d7e43..fb0d72f 100644 --- a/README.md +++ b/README.md @@ -11,30 +11,32 @@ A simple Starlink exporter for Prometheus. *Not affiliated with Starlink or Spac The following metrics are exposed by this exporter: -| Metric name | Description | -|--------------------------------------------------------|-------------------------------------------------------------------------------| -| `starlink_exporter_scrapes_total` | Total number of Starlink dish scrapes | -| `starlink_exporter_scrape_duration_seconds` | Time taken to scrape metrics from the Starlink dish | -| `starlink_dish_up` | Whether scraping metrics from the Starlink dish was successful | -| `starlink_dish_info` | Starlink dish software information | -| `starlink_dish_uptime_seconds` | Starlink dish uptime in seconds | -| `starlink_dish_snr_above_noise_floor` | Whether Starlink dish signal-to-noise ratio is above noise floor | -| `starlink_dish_snr_persistently_low` | Whether Starlink dish signal-to-noise ratio is persistently low | -| `starlink_dish_uplink_throughput_bps` | Starlink dish uplink throughput in bits/sec | -| `starlink_dish_downlink_throughput_bps` | Starlink dish downlink throughput in bit/sec | -| `starlink_dish_downlink_throughput_bps_histogram` | Histogram of Starlink dish downlink throughput over last 15 minutes | -| `starlink_dish_uplink_throughput_bps_histogram` | Histogram of Starlink dish uplink throughput in bits/sec over last 15 minutes | -| `starlink_dish_pop_ping_drop_ratio` | Starlink PoP ping drop ratio | -| `starlink_dish_pop_ping_latency_seconds` | Starlink PoP ping latency in seconds | -| `starlink_dish_pop_ping_latency_seconds_histogram` | Histogram of Starlink dish PoP ping latency in seconds over last 15 minutes | -| `starlink_dish_software_update_reboot_ready` | Whether the Starlink dish is ready to reboot to apply a software update | -| `starlink_dish_boresight_azimuth_deg` | Starlink dish boresight azimuth in degrees | -| `starlink_dish_boresight_elevation_deg` | Starlink dish boresight elevation in degrees | -| `starlink_dish_currently_obstructed` | Whether the Starlink dish is currently obstructed | -| `starlink_dish_fraction_obstruction_ratio` | Fraction of Starlink dish that is obstructed | -| `starlink_dish_last_24h_obstructed_seconds` | Number of seconds the Starlink dish was obstructed in the past 24 hours | -| `starlink_dish_power_input_watts_histogram` | Histogram of Starlink dish power input in watts over last 15 minutes | -| `starlink_dish_power_input_watts` | Current power input for the Starlink dish | +| Metric name | Description | +|----------------------------------------------------|-------------------------------------------------------------------------------| +| `starlink_exporter_scrapes_total` | Total number of Starlink dish scrapes | +| `starlink_exporter_scrape_duration_seconds` | Time taken to scrape metrics from the Starlink dish | +| `starlink_dish_up` | Whether scraping metrics from the Starlink dish was successful | +| `starlink_dish_info` | Starlink dish software information | +| `starlink_dish_uptime_seconds` | Starlink dish uptime in seconds | +| `starlink_dish_snr_above_noise_floor` | Whether Starlink dish signal-to-noise ratio is above noise floor | +| `starlink_dish_snr_persistently_low` | Whether Starlink dish signal-to-noise ratio is persistently low | +| `starlink_dish_uplink_throughput_bps` | Starlink dish uplink throughput in bits/sec | +| `starlink_dish_downlink_throughput_bps` | Starlink dish downlink throughput in bit/sec | +| `starlink_dish_downlink_throughput_bps_histogram` | Histogram of Starlink dish downlink throughput over last 15 minutes | +| `starlink_dish_uplink_throughput_bps_histogram` | Histogram of Starlink dish uplink throughput in bits/sec over last 15 minutes | +| `starlink_dish_pop_ping_drop_ratio` | Starlink PoP ping drop ratio | +| `starlink_dish_pop_ping_latency_seconds` | Starlink PoP ping latency in seconds | +| `starlink_dish_pop_ping_latency_seconds_histogram` | Histogram of Starlink dish PoP ping latency in seconds over last 15 minutes | +| `starlink_dish_software_update_reboot_ready` | Whether the Starlink dish is ready to reboot to apply a software update | +| `starlink_dish_boresight_azimuth_deg` | Starlink dish boresight azimuth degrees | +| `starlink_dish_boresight_elevation_deg` | Starlink dish boresight elevation degrees | +| `starlink_dish_desired_boresight_azimuth_deg` | Starlink dish desired boresight azimuth degrees | +| `starlink_dish_desired_boresight_elevation_deg` | Starlink dish desired boresight elevation degrees | +| `starlink_dish_currently_obstructed` | Whether the Starlink dish is currently obstructed | +| `starlink_dish_fraction_obstruction_ratio` | Fraction of Starlink dish that is obstructed | +| `starlink_dish_last_24h_obstructed_seconds` | Number of seconds the Starlink dish was obstructed in the past 24 hours | +| `starlink_dish_power_input_watts_histogram` | Histogram of Starlink dish power input in watts over last 15 minutes | +| `starlink_dish_power_input_watts` | Current power input for the Starlink dish | ## Installation @@ -105,7 +107,7 @@ Steps to build starlink_exporter. **Prerequisites** -- Go v1.22 or newer (https://go.dev/dl/) +- Go v1.23 or newer (https://go.dev/dl/) **Build** diff --git a/internal/exporter/desc.go b/internal/exporter/desc.go index 2faf140..5af0ea4 100644 --- a/internal/exporter/desc.go +++ b/internal/exporter/desc.go @@ -167,13 +167,25 @@ var ( Namespace: namespace, Subsystem: dishSubsystem, Name: "boresight_azimuth_deg", - Help: "Starlink dish boresight azimuth in degrees", + Help: "Starlink dish boresight azimuth degrees", } dishBoresightElevationDeg = Desc{ Namespace: namespace, Subsystem: dishSubsystem, Name: "boresight_elevation_deg", - Help: "Starlink dish boresight elevation in degrees", + Help: "Starlink dish boresight elevation degrees", + } + dishDesiredBoresightAzimuthDeg = Desc{ + Namespace: namespace, + Subsystem: dishSubsystem, + Name: "desired_boresight_azimuth_deg", + Help: "Starlink dish desired boresight azimuth degrees", + } + dishDesiredBoresightElevationDeg = Desc{ + Namespace: namespace, + Subsystem: dishSubsystem, + Name: "desired_boresight_elevation_deg", + Help: "Starlink dish desired boresight elevation degrees", } // Obstruction @@ -215,6 +227,8 @@ var Descs = []Desc{ dishSoftwareUpdateRebootReady, dishBoresightAzimuthDeg, dishBoresightElevationDeg, + dishDesiredBoresightAzimuthDeg, + dishDesiredBoresightElevationDeg, dishCurrentlyObstructed, dishFractionObstructionRatio, dishLast24HoursObstructedSeconds, diff --git a/internal/exporter/scrape.go b/internal/exporter/scrape.go index 6da615b..d0c499f 100644 --- a/internal/exporter/scrape.go +++ b/internal/exporter/scrape.go @@ -62,7 +62,11 @@ func (e *Exporter) scrape(ch chan<- prometheus.Metric) bool { e.scrapeDurationSeconds.Set(time.Since(start).Seconds()) }() - return runScrapers(ch, e.scrapeDishStatus, e.scrapeDishHistory) + return runScrapers(ch, + e.scrapeDishStatus, + e.scrapeDishHistory, + e.scrapeDishDiagnostics, + ) } type scraper func(ctx context.Context, ch chan<- prometheus.Metric) bool @@ -270,3 +274,29 @@ func (e *Exporter) scrapeDishHistory(ctx context.Context, ch chan<- prometheus.M return true } + +func (e *Exporter) scrapeDishDiagnostics(ctx context.Context, ch chan<- prometheus.Metric) bool { + res, err := e.client.Handle(ctx, &device.Request{ + Request: new(device.Request_GetDiagnostics), + }) + if err != nil { + slog.Error("Failed to scrape dish diagnostics", slog.Any("err", err)) + return false + } + + diag := res.GetDishGetDiagnostics() + + // starlink_dish_desired_boresight_azimuth_deg + ch <- prometheus.MustNewConstMetric( + dishDesiredBoresightAzimuthDeg.Desc(), prometheus.GaugeValue, + float64(diag.GetAlignmentStats().GetDesiredBoresightAzimuthDeg()), + ) + + // starlink_dish_desired_boresight_elevation_deg + ch <- prometheus.MustNewConstMetric( + dishDesiredBoresightElevationDeg.Desc(), prometheus.GaugeValue, + float64(diag.GetAlignmentStats().GetDesiredBoresightElevationDeg()), + ) + + return true +}