Prometheus exporter for various media applications. Currently supports Transmission, OpenVPN Client, Sonarr, Radarr and Plex.
Installation
Binaries are available on the release page. Docker images are available on ghcr.io.
Alternatively, you can clone the repository and build from source:
git clone https://github.com/clambin/mediamon.git
cd mediamon
go build
You will need to have Go 1.17 installed on your system.
Command-line options
The following command-line arguments can be passed:
$ ./mediamon
usage: mediamon --file=FILE [<flags>]
media monitor
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
-v, --version Show application version.
--debug Log debug messages
--port=8080 API listener port
--file=FILE Service configuration file
Configuration
The mandatory service configuration file configures the services that mediamon should monitor:
transmission:
# Transmission RPC URL, e.g. "http://192.168.0.1:9101/transmission/rpc"
# If not set, Transmission won't be monitored
url: <url>
# How frequently to scrape transmission
interval: <duration>
sonarr:
# Sonarr URL. If not set, Sonarr won't be monitored
url: <url>
# How frequently to scrape Sonarr
interval: <duration>
# Sonarr API Key. See Sonarr / Settings / Security
apikey: <key>
radarr:
# All these are equivalent to sonarr
url: <url>
interval: <duration>
apikey: <key>
plex:
# Plex URL, e.g. http://192.168.0.11:32400
url: <url>
interval: <duration>
# Your plex.tv user name and password
username: <username>
password: <password>
openvpn:
# OpenVPN monitoring. Includes connectivity monitoring (up/down) and bandwidth consumption
connectivity:
# mediamon will connect to https://ipinfo.io through a proxy running inside the OpenVPN container
# URL of the Proxy. If not set, connectivity won't be monitored
proxy: <url>
# Token supplied by ipinfo.io. You will need to register to obtain this
token: <token>
interval: <duration>
bandwidth:
# mediamon uses the OpenVPN status will to measure up/download bandwidth
# filename contains the full path name of the client.status file. If not set, bandwidth won't be monitored
filename: <file path>
interval: <duration>>
Prometheus
Add mediamon as a target to let Prometheus scrape the metrics into its database.
This highly depends on your particular Prometheus configuration. In its simplest form, add a new scrape target to prometheus.yml
:
scrape_configs:
- job_name: mediamon
static_configs:
- targets: [ '<mediamon_host>:8080' ]
Metrics
mediamon exposes the following metrics:
mediamon_plex_session_location_count: Active plex sessions by location
mediamon_plex_transcoder_active_count: Number of active transcode sessions
mediamon_plex_transcoder_speed_total: Total speed of active transcoders
mediamon_plex_transcoder_total_count: Number of transcode sessions
mediamon_plex_version: version info
mediamon_transmission_active_torrent_count: Number of active torrents
mediamon_transmission_download_speed: Transmission download speed in bytes / sec
mediamon_transmission_paused_torrent_count: Number of paused torrents
mediamon_transmission_upload_speed: Transmission upload speed in bytes / sec
mediamon_transmission_version: version info
mediamon_xxxarr_calendar_count: Number of upcoming episodes / movies
mediamon_xxxarr_monitored_count: Number of monitored series / movies
mediamon_xxxarr_queued_count: Number of episodes / movies being downloaded
mediamon_xxxarr_unmonitored_count: Number of unmonitored series / movies
mediamon_xxxarr_version: version info
openvpn_client_status: OpenVPN client status
openvpn_client_tcp_udp_read_bytes_total: OpenVPN client bytes read
openvpn_client_tcp_udp_write_bytes_total: OpenVPN client bytes written
Additionally, the following metrics measure API metrics:
mediamon_request_duration_seconds Duration of API requests (summary metric)
mediamon_request_errors_total API requests errors
Grafana
Github contains a sample Grafana dashboard to visualize the scraped metrics.
Feel free to customize as you see fit.
Authors
License
This project is licensed under the MIT License - see the LICENSE.md file for details.