## 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`)
- [ ] 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](https://claude.com/claude-code)
Reviewed-on: https://forge.tail8d86e.ts.net/eblume/blumeops/pulls/13
31 lines
957 B
YAML
31 lines
957 B
YAML
---
|
|
- name: Ensure bin directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ plex_metrics_script | dirname }}"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Deploy plex metrics collection script
|
|
ansible.builtin.template:
|
|
src: plex-metrics.sh.j2
|
|
dest: "{{ plex_metrics_script }}"
|
|
mode: '0755'
|
|
notify: reload plex-metrics
|
|
|
|
- name: Deploy plex-metrics LaunchAgent plist
|
|
ansible.builtin.template:
|
|
src: plex-metrics.plist.j2
|
|
dest: ~/Library/LaunchAgents/mcquack.eblume.plex-metrics.plist
|
|
mode: '0644'
|
|
notify: reload plex-metrics
|
|
|
|
- name: Check if plex-metrics LaunchAgent is loaded
|
|
ansible.builtin.command: launchctl list mcquack.eblume.plex-metrics
|
|
register: launchctl_check
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: Load plex-metrics LaunchAgent if not loaded
|
|
ansible.builtin.command: launchctl load ~/Library/LaunchAgents/mcquack.eblume.plex-metrics.plist
|
|
when: launchctl_check.rc != 0
|
|
failed_when: false
|