Add Plex Media Server observability #13

Merged
eblume merged 3 commits from feature/plex-observability into main 2026-01-15 15:27:59 -08:00
Owner

Summary

  • Add plex_metrics ansible role with textfile collector for Prometheus metrics
  • Add Plex log collection to Alloy (forwards to Loki)
  • Add Grafana dashboard for Plex monitoring (status, library counts, sessions, transcoding, logs)

Metrics Collected

  • plex_up - server health
  • plex_version_info - server version
  • plex_sessions_total/playing/paused - active sessions
  • plex_transcode_sessions_total/video/audio - transcoding status
  • plex_library_items{library,type} - library item counts

Prerequisites

Plex token must be stored at ~/.plex-token on indri (already done).

Test plan

  • Dry-run passed (mise run provision-indri -- --check --diff)
  • Apply changes (mise run provision-indri)
  • Verify metrics: ssh indri 'cat /opt/homebrew/var/node_exporter/textfile/plex.prom'
  • Verify logs in Grafana Explore: {service="plex"}
  • Check Plex dashboard in Grafana

🤖 Generated with Claude Code

## Summary - Add `plex_metrics` ansible role with textfile collector for Prometheus metrics - Add Plex log collection to Alloy (forwards to Loki) - Add Grafana dashboard for Plex monitoring (status, library counts, sessions, transcoding, logs) ## Metrics Collected - `plex_up` - server health - `plex_version_info` - server version - `plex_sessions_total/playing/paused` - active sessions - `plex_transcode_sessions_total/video/audio` - transcoding status - `plex_library_items{library,type}` - library item counts ## Prerequisites Plex token must be stored at `~/.plex-token` on indri (already done). ## Test plan - [x] Dry-run passed (`mise run provision-indri -- --check --diff`) - [x] Apply changes (`mise run provision-indri`) - [x] Verify metrics: `ssh indri 'cat /opt/homebrew/var/node_exporter/textfile/plex.prom'` - [x] Verify logs in Grafana Explore: `{service="plex"}` - [x] Check Plex dashboard in Grafana 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- Create plex_metrics ansible role with textfile collector script
- Add Plex log collection to Alloy configuration
- Add Grafana dashboard for Plex server monitoring
- Update indri.yml playbook to include plex_metrics role

Metrics collected:
- plex_up (server health)
- plex_version_info (server version)
- plex_sessions_total/playing/paused (active sessions)
- plex_transcode_sessions_total/video/audio (transcoding)
- plex_library_items{library,type} (library counts)

Requires Plex token stored at ~/.plex-token on indri.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The EOF marker was on the same line as the library_metrics variable,
causing the heredoc to not close properly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The grep-based JSON parsing was fragile and broke on nested arrays
(like Location inside Directory). Using jq properly handles the
JSON structure.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
eblume merged commit ae1513e7e9 into main 2026-01-15 15:27:59 -08:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
eblume/blumeops!13
No description provided.