Skip to content

Fix Prometheus node exporter path#986

Merged
agarciamontoro merged 4 commits intomasterfrom
bin/prometheus-node-exporter
Mar 27, 2026
Merged

Fix Prometheus node exporter path#986
agarciamontoro merged 4 commits intomasterfrom
bin/prometheus-node-exporter

Conversation

@agarciamontoro
Copy link
Copy Markdown
Member

Summary

The path for the Prometheus node exporter binary has changed without us noticing (probably due to the dependency from sudo apt-get install -y prometheus-node-exporter being updated), so we were missing node metrics like CPU and memory.

Ticket Link

--

@agarciamontoro agarciamontoro requested a review from carlisgg March 25, 2026 14:47
@agarciamontoro agarciamontoro added the 2: Dev Review Requires review by a core committer label Mar 25, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 5d414daa-0b28-40f4-9e7a-6326a308256f

📥 Commits

Reviewing files that changed from the base of the PR and between 73505bd and 786b190.

📒 Files selected for processing (1)
  • deployment/terraform/strings.go
✅ Files skipped from review due to trivial changes (1)
  • deployment/terraform/strings.go

📝 Walkthrough

Walkthrough

Removed the /etc/default/prometheus-node-exporter config usage and constant; updated the Prometheus node exporter systemd unit ExecStart to /usr/bin/prometheus-node-exporter --collector.ethtool. Uploads of the removed config were deleted from agent and server provisioning flows.

Changes

Cohort / File(s) Summary
Service unit string
deployment/terraform/strings.go
Deleted the standalone prometheusNodeExporterConfig constant and changed the embedded systemd unit ExecStart to /usr/bin/prometheus-node-exporter --collector.ethtool (removed EnvironmentFile=-/etc/default/prometheus-node-exporter).
Provisioning uploads
deployment/terraform/agent.go, deployment/terraform/create.go
Removed upload of /etc/default/prometheus-node-exporter from agent and server setup paths; remaining config uploads and service restart commands left intact.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • carlisgg

Poem

🐰 I nudged the unit and hopped away,

Flags moved inline to greet the day.
No default file to chase or find,
Exports run tidy, neat, and kind.
A little hop — deployment aligned.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing the Prometheus node exporter path from /usr/local/bin/node_exporter to /usr/bin/prometheus-node-exporter.
Description check ✅ Passed The description explains the rationale for the change—a dependency update changed the binary path, causing missing node metrics—which directly relates to the code changes in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bin/prometheus-node-exporter

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.3)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
deployment/terraform/strings.go (1)

580-580: Consider passing arguments from the environment file.

The EnvironmentFile at line 579 loads /etc/default/prometheus-node-exporter, which defines ARGS="--collector.ethtool" (lines 555-557). However, the ExecStart command doesn't reference $ARGS, so these arguments won't be passed to the exporter.

If the --collector.ethtool flag is intended to be active, the ExecStart should be:

🔧 Proposed fix to enable environment arguments
-ExecStart=/usr/bin/prometheus-node-exporter
+ExecStart=/usr/bin/prometheus-node-exporter $ARGS

If the ethtool collector is not needed, consider removing the ARGS definition from prometheusNodeExporterConfig (lines 555-557) to avoid confusion.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deployment/terraform/strings.go` at line 580, The systemd unit loads
/etc/default/prometheus-node-exporter via EnvironmentFile but ExecStart
(/usr/bin/prometheus-node-exporter) ignores the ARGS variable defined there, so
either update the unit's ExecStart to include the ARGS environment variable
(e.g., append $ARGS to the command) so flags like --collector.ethtool are
passed, or remove the ARGS definition from prometheusNodeExporterConfig if that
collector is not desired; locate the unit configuration that sets
EnvironmentFile and ExecStart and adjust ExecStart to reference $ARGS (or delete
the ARGS lines in prometheusNodeExporterConfig) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@deployment/terraform/strings.go`:
- Line 580: The systemd unit loads /etc/default/prometheus-node-exporter via
EnvironmentFile but ExecStart (/usr/bin/prometheus-node-exporter) ignores the
ARGS variable defined there, so either update the unit's ExecStart to include
the ARGS environment variable (e.g., append $ARGS to the command) so flags like
--collector.ethtool are passed, or remove the ARGS definition from
prometheusNodeExporterConfig if that collector is not desired; locate the unit
configuration that sets EnvironmentFile and ExecStart and adjust ExecStart to
reference $ARGS (or delete the ARGS lines in prometheusNodeExporterConfig)
accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 14035322-05d0-4f6d-a261-ca9121b907d3

📥 Commits

Reviewing files that changed from the base of the PR and between 2b2c322 and 8d01109.

📒 Files selected for processing (1)
  • deployment/terraform/strings.go

The flag was defined in an ARGS envvar in an environment file that was
included in the systemd file, but the envvar itself was never used.
Use the flag directly in the invocation of the binary.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
deployment/terraform/strings.go (1)

570-579: Good fix: path and flag change correctly restores node metrics.

The updated path /usr/bin/prometheus-node-exporter matches the Debian/Ubuntu package location, and embedding --collector.ethtool directly in ExecStart ensures the flag is actually applied (previously the ARGS env var was never consumed).

Consider removing the orphaned EnvironmentFile line.

Since the code that uploaded /etc/default/prometheus-node-exporter was removed from agent.go and create.go, line 575 now references a file that will never exist. The - prefix prevents failures, but keeping this line is misleading and may confuse future maintainers.

♻️ Suggested cleanup
 const prometheusNodeExporterServiceFile = `[Unit]
 Description=Node Exporter

 [Service]
-# Fallback when environment file does not exist
-EnvironmentFile=-/etc/default/prometheus-node-exporter
 ExecStart=/usr/bin/prometheus-node-exporter --collector.ethtool

 [Install]
 WantedBy=multi-user.target`
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deployment/terraform/strings.go` around lines 570 - 579, The systemd unit
string constant prometheusNodeExporterServiceFile still contains an orphaned
EnvironmentFile line that no longer corresponds to any uploaded file; edit the
prometheusNodeExporterServiceFile constant to remove the
`EnvironmentFile=-/etc/default/prometheus-node-exporter` line so the unit only
contains the Description, Service (with
ExecStart=/usr/bin/prometheus-node-exporter --collector.ethtool) and Install
sections, ensuring the unit file reflects current behavior and avoids misleading
references.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@deployment/terraform/strings.go`:
- Around line 570-579: The systemd unit string constant
prometheusNodeExporterServiceFile still contains an orphaned EnvironmentFile
line that no longer corresponds to any uploaded file; edit the
prometheusNodeExporterServiceFile constant to remove the
`EnvironmentFile=-/etc/default/prometheus-node-exporter` line so the unit only
contains the Description, Service (with
ExecStart=/usr/bin/prometheus-node-exporter --collector.ethtool) and Install
sections, ensuring the unit file reflects current behavior and avoids misleading
references.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 877d52bf-f8ee-4ee3-961f-d26ed087caf6

📥 Commits

Reviewing files that changed from the base of the PR and between 8d01109 and 73505bd.

📒 Files selected for processing (3)
  • deployment/terraform/agent.go
  • deployment/terraform/create.go
  • deployment/terraform/strings.go
💤 Files with no reviewable changes (2)
  • deployment/terraform/create.go
  • deployment/terraform/agent.go

@@ -576,8 +572,7 @@ Description=Node Exporter

[Service]
# Fallback when environment file does not exist
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can modify or remove the comment

@agarciamontoro agarciamontoro merged commit 16370e9 into master Mar 27, 2026
@agarciamontoro agarciamontoro deleted the bin/prometheus-node-exporter branch March 27, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2: Dev Review Requires review by a core committer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants