jsclayton / prometheus-plex-exporter

Export metrics from your Plex Media Server
GNU Affero General Public License v3.0
117 stars 13 forks source link
grafana grafana-agent plex plex-media-server prometheus prometheus-exporter

Prometheus Exporter for Plex

Expose library playback, storage, and host metrics in a Prometheus format.

Configuration

The exporter is configured via required environment variables:

Running

The exporter runs via Docker:

docker run \
  -name prom-plex-exporter \
  -p 9000:9000 \
  -e PLEX_SERVER="<Your Plex server URL>" \
  -e PLEX_TOKEN="<Your Plex server admin token>" \
  ghcr.io/jsclayton/prometheus-plex-exporter

Or via Docker Compose:

prom-plex-exporter:
  image: ghcr.io/jsclayton/prometheus-plex-exporter
  ports:
    - 9000:9000/tcp
  environment:
    PLEX_SERVER: <Your Plex server URL>
    PLEX_TOKEN: <Your Plex server admin token>

A sample dashboard can be found in the examples

Exporting Metrics

The simplest way to start visualizaing your metrics is with the Free Forever Grafana Cloud and Grafana Agent.

Here's an example config file that will read metrics from the exporter and ship them to Prometheus via remote_write:

metrics:
  configs:
  - name: prom-plex
    scrape_configs:
      - job_name: prom-plex
        static_configs:
          - targets:
            - <IP/address and port of the exporter endpoint>
    remote_write:
      - url: <Your Metrics instance remote_write endpoint>
        basic_auth:
          username: <Your Metrics instance ID>
          password: <Your Grafana.com API Key>