Skip to content

Feat/prometheus grafana integration - #37

Draft
R27-pixel wants to merge 7 commits into
p2poolv2:mainfrom
R27-pixel:feat/prometheus-grafana-integration
Draft

R27-pixel wants to merge 7 commits into
p2poolv2:mainfrom
R27-pixel:feat/prometheus-grafana-integration

Conversation

@R27-pixel

Copy link
Copy Markdown
Member

Add Prometheus and Grafana monitoring with systemd control

Summary

This PR integrates Prometheus and Grafana monitoring into PDM and adds native systemd user services to manage both components.

The goal is to make monitoring P2Pool v2 easier to set up and manage directly from PDM, without requiring Docker or Docker Compose.

Changes

Prometheus integration

  • Generate Prometheus configuration to scrape metrics exposed by P2Pool v2.
  • Configure the P2Pool v2 metrics endpoint (127.0.0.1:46884).
  • Manage the Prometheus systemd user service through PDM.
  • Preserve Prometheus data across restarts.

Grafana integration

  • Provision Grafana with Prometheus as its data source.
  • Include dashboard provisioning and P2Pool v2 dashboard assets.
  • Persist Grafana state and configuration.
  • Keep Grafana bound to localhost and configure admin credentials securely.

PDM integration

  • Add a monitoring view and controls for managing the monitoring services.
  • Generate and install the required configuration and systemd user service units.
  • Integrate service lifecycle actions into PDM.

Design decisions

  • Use native systemd user services
  • Keep monitoring services independent of PDM's own process lifecycle.
  • Store monitoring configuration and persistent data in the appropriate user directories.
  • Avoid requiring root privileges to manage PDM's monitoring services.

Testing

  • Unit tests for monitoring configuration and service management.
  • Validation of generated systemd service units.
  • Manual verification of Prometheus scraping P2Pool v2 metrics.

Status

Draft PR: Implementation and testing are still under review.

@R27-pixel
R27-pixel marked this pull request as draft October 20, 2026 14:42
@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.79604% with 369 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/p2poolv2_service.rs 88.64% 135 Missing ⚠️
src/main.rs 51.56% 93 Missing ⚠️
src/app.rs 73.80% 66 Missing ⚠️
src/monitoring.rs 89.27% 34 Missing ⚠️
src/components/p2pool_status_view.rs 78.72% 30 Missing ⚠️
src/components/monitoring_view.rs 96.23% 11 Missing ⚠️

📢 Thoughts on this report? Let us know!

@R27-pixel

Copy link
Copy Markdown
Member Author

@pool2win Keeping this PR as a draft for now. It is not ready for review yet. I'm keeping the current implementation and progress here while I split the work into smaller, easier-to-review PRs.

For cleaner reviews and easier merging, I'll split this into three PRs:

  1. Prometheus integration — configuration generation and scraping of P2Poolv2 metrics.
  2. Grafana integration — datasource configuration, dashboard provisioning, and dashboard assets.
  3. Monitoring service management and UI — systemd user services for both Prometheus and Grafana, lifecycle controls, and integration into PDM's monitoring view.

I'll open the separate PRs in order and handle dependencies where needed. This draft will remain as a reference for the overall implementation and progress.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant