plex_exporter
plex_exporter copied to clipboard
Docker-Compose / Docker Run Example or Instructions
Hey dude, first of all, thank you for creating this awesome project!
Second, I've been trying to get this project to work for a few days now & I can't for the life of me figure it out. I'm not a total noob when it comes to Docker but I definitely wouldn't call myself an expert.
I know it would be very helpful for me & probably others if you could please provide an example/instructions or maybe a link to another project for reference. I just really want to get this exporter to work with Grafana / Prometheus & I've been driving myself nuts. I'd be very grateful & happy to do anything I can to help support! Thank you!
I figured out my initial problem with regards to the docker-compose layout, but I have a new issue which I'd say is related.
When I run the container, I'm getting the following errors. I feel like I've tried every variation but still no luck. I was getting an SSL error in the logs when using docker-compose. I set up a config.yml file.
docker-compose.yml - I left the comments that I used in testing.
version: '3.7'
services:
plex-exporter:
image: granra/plex_exporter
container_name: 'plex-exporter'
restart: unless-stopped
command:
# - "--help"
- "--config-path=./config.yml"
# - "--plex-server=https://MY-IP:32400"
# - "--listen-address=9594"
# - "--token=TOKEN"
# - "--auto-discover"
ports:
- "9594:9594"
If I uncomment the configs above & not use the config.yml file, I get the following erro:
plex-exporter | time="2022-03-03T02:40:07Z" level=error msg="Could not add server https://MY-IP:32400: Get \"https://MY-IP:32400/media/providers\": x509: cannot validate certificate for MY-IP because it doesn't contain any IP SANs" context=client
plex-exporter | time="2022-03-03T02:40:07Z" level=info msg="Found 1 working servers" context=client
plex-exporter | time="2022-03-03T02:40:07Z" level=info msg="Beginning to serve on port 9594"
plex-exporter | time="2022-03-03T02:40:07Z" level=fatal msg="listen tcp: address 9594: missing port in address"
Config.yml:
address: ":9594"\
logLevel: "info" \
logFormat: "text"
autoDiscover: true
token: "TOKEN"
servers:
- baseUrl: https://MY-IP:32400
insecure: false
token: "TOKEN"
I get the following in the logs:
plex-exporter | time="2022-03-03T02:32:39Z" level=info msg="Found 0 working servers" context=client
plex-exporter | time="2022-03-03T02:32:39Z" level=info msg="Beginning to serve on port :9594"
I've figured out that localhost & 127.0.0.1 doesn't work. Any insight would greatly be appreciated.
UPDATE: it looks like my problem was using https. Changed the URL to http & I'm getting the following:
time="2022-03-03T03:05:20Z" level=info msg="Found 1 working servers" context=client
time="2022-03-03T03:05:20Z" level=info msg="Beginning to serve on port :9594"
time="2022-03-03T03:05:54Z" level=info msg="Found 1 working servers" context=client
time="2022-03-03T03:05:54Z" level=info msg="Beginning to serve on port :9594"
I'm not 100% sure if its working yet, but I suppose I'll get there. I hope this thread helps someone!
Sorry for the spam. Now I get
curl http://MY-IP:9594
404 page not found
Not sure how to proceed at this point.
My code so far is:
version: '3.7'
services:
plex-exporter:
image: granra/plex_exporter
container_name: 'plex-exporter'
restart: unless-stopped
command:
- "--plex-server=http://MY-IP:32400"
- "--token=TOKEN"
ports:
- "9594:9594"
I'm not sure if it's intended behavior BUT, I'm getting metrics in Grafana & they seem to be accurate. Again, hope this thread helps someone out there!
Walking through your struggles helped me a lot! Can you share a bit about how your Plex instance is networked in compose?
I have a sorta complex networking configuration and my exporter instance can't find the Plex server. I would love to see your config as reference.
I was able to get mine working with this configuration:
My Plex config:
version: "3"
services:
plex:
image: linuxserver/plex
container_name: plex_plex
restart: "no"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
networks:
- web
ports:
- 32400:32400/tcp
- 32400:32400/udp
- 3005:3005/tcp
- 8324:8324/tcp
- 32469:32469/tcp
- 1900:1900/udp
- 32410:32410/udp
- 32412:32412/udp
- 32413:32413/udp
- 32414:32414/udp
environment:
- PUID=1000
- PGID=1000
- VERSION=latest
- ADVERTISE_IP="https://plex.mydomain.tld:443"
- PLEX_CLAIM=claim-MYTOKEN
- NVIDIA_VISIBLE_DEVICES=all
env_file:
- .env
volumes:
- "${MEDIA_DIR}/Video/Movies:/movies"
- "${MEDIA_DIR}/Video/Shows:/shows"
- "${MEDIA_DIR}/Audio/Music:/music"
- "${DOCKER_DATA}/plex:/config"
labels:
- traefik.http.routers.plex.rule=Host(`plex.mydomain.tld`)
- traefik.http.routers.plex.tls.certresolver=lets-encrypt
- traefik.http.services.plex.loadbalancer.server.port=32400
networks:
web:
external: true
My Prometheus/Plex-exporter config:
version: '3'
services:
prometheus:
image: prom/prometheus:latest
container_name: monitoring_prometheus
networks:
- monitoring
- web
ports:
- 9090:9090
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
restart: unless-stopped
command:
- "--config.file=/etc/prometheus/prometheus.yml"
labels:
- traefik.http.routers.prometheus.rule=Host(`prometheus.mydomain.tld`)
- traefik.http.routers.prometheus.tls.certresolver=lets-encrypt
plex-exporter:
image: granra/plex_exporter
container_name: monitoring_plex-exporter
restart: unless-stopped
ports:
- 9594:9594
networks:
- monitoring
command:
- "--plex-server=https://plex.mydomain.tld"
- "--token=TOKEN"
- "--auto-discover"
networks:
monitoring:
external: true
web:
external: true