Skip to content

Instantly share code, notes, and snippets.

Last active February 23, 2024 09:15
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dfsnow/aad4ec99afb413968c49efb03bdb1ab9 to your computer and use it in GitHub Desktop.
Export Jellyfin playback statistics to Prometheus and Grafana. See for more info
# The Token value here needs to be an API key generated from the
# Jellyfin admin panel. It's hard-coded here but I'm sure there's
# a better way
Authorization: MediaBrowser Token=ADD_TOKEN_HERE
Content-Type: application/json
accept: application/json
# This will return all active sessions regardless of
# whether something is playing. You can use a combination
# of label and value filters in Grafana to only get actively
# playing sessions
- name: jellyfin
type: object
help: User playback metrics from Jellyfin
path: '{ [*] }'
user_name: '{ .UserName }'
# User PromQL label_join and label_replace to concatenate
# these values into a nice item description
item_type: '{ .NowPlayingItem.Type }'
item_name: '{ .NowPlayingItem.Name }'
item_path: '{ .NowPlayingItem.Path }'
series_name: '{ .NowPlayingItem.SeriesName }'
episode_index: 'e{ .NowPlayingItem.IndexNumber }'
season_index: 's{ .NowPlayingItem.ParentIndexNumber }'
client_name: '{ .Client }'
device_name: '{ .DeviceName }'
is_paused: '{ .PlayState.IsPaused }'
- job_name: json
metrics_path: /probe
# The name of the module defined by json-exporter-config.yaml
module: [jellyfin]
- targets:
# Use the Sessions endpoint to see actively playing items
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: HOSTNAME:9115 # The exporter's hostname:port
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment