A Plex plugin for collectd. It can collect such metrics as library size (movies, shows, episodes) and active sessions.
- Plex.tv authentication token (see included
get_auth_token.py
script) - Plex Media Server
- CollectD
python
plugin
Required:
Host
- Plex server hostnamePort
- Plex server portAuthToken
- Plex.tv authentication token
Optional:
HTTPS
- use HTTPS instead of HTTP (defaults toTrue
)Sessions
- collect active session count (defaults toTrue
)Movies
- collect movie counts (defaults toTrue
)Shows
- collect show counts (defaults toTrue
)Episodes
- collect episode counts (defaults toTrue
)MyPlex
- collect remote access status (defaults toFalse
)Include
- sections to collect media counts for (assumes all, if excluded)Exclude
- sections to ignore media counts for (assumes all, if excluded)
This plugin will, by default, collect all metrics it can from the Plex server by looking for all libraries/sections. You can tune/limit this behavior with the Optional parameters defined above, if you only want to collect a certain kind of metric or are only interested in a subset of sections/libraries.
This configuration will query the Plex server for all libraries and collect all metrics.
<LoadPlugin python>
Globals true
</LoadPlugin>
<Plugin python>
ModulePath "/path/to/plugin"
Import "plex"
<Module plex>
Host "localhost"
Port 32400
AuthToken <token>
</Module>
</Plugin>
Assuming section 1
is a show
library, this configuration will limit the
collection to just that library, which will result in show and episode count
being collected.
<LoadPlugin python>
Globals true
</LoadPlugin>
<Plugin python>
ModulePath "/path/to/plugin"
Import "plex"
<Module plex>
Host "localhost"
Port 32400
AuthToken <token>
IncludeSections 1
</Module>
</Plugin>
This configuration will monitor all metrics, plus Remote Access (MyPlex/Plex.tv) status.
<LoadPlugin python>
Globals true
</LoadPlugin>
<Plugin python>
ModulePath "/path/to/plugin"
Import "plex"
<Module plex>
Host "localhost"
Port 32400
AuthToken <token>
MyPlex true
</Module>
</Plugin>
Reported values will be:
Value | Meaning |
---|---|
-1 | Error (not logged in to Plex account on the server?) |
0 | Unreachable |
1 | Waiting (server is trying to connect to Remote Access) |
2 | Reachable |