Skip to content

Custom Scripts

A script that will convert the certficate generated by Traefik for use within Plex (PKCS#12 format) if you have a need for it.

All variables listed below are in inventory/group_vars/all/plex.yml

To enable the Traefik-to-Plex Certificate script:

  1. Change hms_docker_plex_ssl_enabled to true

  2. Set hms_docker_plex_ssl_public_hostname to the publicly-accessible FQDN/hostname used to access Plex, such as plex.example.com or media.public.example.com

    a. NOTE: It must match a hostname, wildcard, or SAN covered by the Traefik certificate. If it is not and you want to add a SAN, see the Traefik SSL docs

    b. This FQDN should resolve to the public IP of the Plex server

The following settings are optional:

  • hms_docker_plex_ssl_update_config : If the script should auto-update the Plex config file with the certificate path and passphrase (if applicable)
  • hms_docker_plex_ssl_restart_plex : If the script should restart the Plex container after the config has been updated
  • hms_docker_plex_ssl_cert_pass : The passphrase for the certificate if you want to further secure it, but it is not necessary

A script that will monitor for media availability within Plex.

Sometimes, a network connection goes down or NFS may not mount correctly after a reboot, so media will be marked as “Unavailable” within Plex even though the container is running.

This script will query the Plex API for the latest movie and check if Plex can actually access the file (based on the API response). If it cannot, it will notify Uptime-Kuma via a Push monitor. This is useful to quickly be notified of disk access issues.

The script runs on a cron job every minute

Enabling the Media Availability Monitoring Script

Section titled “Enabling the Media Availability Monitoring Script”

All variables listed below are in inventory/group_vars/all/scripts.yml

To enable the script:

  1. inventory/group_vars/all/scripts.yml
    monitoring_scripts_enabled: true
    media_avail_script_enabled: true
    media_avail_kuma_push_url: <URL from step 2 below> # remove `?status=up&msg=OK&ping=` from the end
  2. Create a “Push Monitor” within Uptime-Kuma, I recommend the following settings:

    a. Heartbeat Interval: 90

    b. Retries: 5

    c. Heartbeat Retry Interval: 90

    Uptime Kuma New Monitor