rickatnight11 / collectd-plex Goto Github PK
View Code? Open in Web Editor NEWThis project forked from mpolden/collectd-plex
Plex plugin for collectd
This project forked from mpolden/collectd-plex
Plex plugin for collectd
Honestly given a hostname, port, and auth token, this script should just discover all libraries and gather all the metrics it can. Leave a few options to disable certain metrics or check/ignore a set of libraries/sections.
Centos 7.4
Python 2.7.5
Collectd 5.7.1-2
Plex 1.9.3
Thanks for any help you can offer.
Is there any plan to upgrade to the latest version of python as I am unable to get this running on CentOS 7
First of all, thanks for the effort that is being put into this plugin. I'm setting this up for the first time... when starting collectd it errors out indicating there issues with importing modules (see log entries below).
Nov 30 17:27:15 dionysus collectd[27568]: plugin_load: plugin "python" successfully loaded.
Nov 30 17:27:15 dionysus collectd[27568]: python plugin: Error importing module "plex".
Nov 30 17:27:15 dionysus collectd[27568]: Unhandled python exception in importing module: ImportError: No module named requests
Nov 30 17:27:15 dionysus collectd[27568]: python plugin: Found a configuration for the "plex" plugin, but the plugin isn't loaded or didn't register a configuration callback.
Nov 30 17:27:15 dionysus collectd[27568]: Error: Reading the config file failed!
I'm not seeing where the requests module is located? Not sure if I've missed something.
System info:
OS: CentOS 7
Plex Version: plexmediaserver-1.2.7.2987-1bef33a.x86_64
Python Version: 2.7.5
Let me know if there is any additional info needed. Any assistance is appreciated!
When collectd starts I am getting the following problem:
plex plugin: configured with Namespace(authtoken='neJiTQP65rqsqx#####', episodes=True, exclude=[], host='localhost', https=True, include=[], movies=True, port=32400, sessions=True, shows=True)
Dec 27 15:44:37 plex collectd[1969]: plex plugin: configured with Namespace(authtoken='neJiTQP65rqsqx#####', episodes=True, exclude=[], host='localhost', https=True, include=[], movies=True, port=32400, sessions=True, shows=True)
Dec 27 15:44:37 plex collectd[1969]: Initialization complete, entering read-loop.
Dec 27 15:44:37 plex collectd[1969]: rrdtool plugin: Adjusting "RandomTimeout" to 0.000 seconds.
Dec 27 15:44:37 plex collectd[1969]: Unhandled python exception in read callback: ValueError: zero length field name in format
Dec 27 15:44:37 plex collectd[1969]: read-function of plugin `python.plex' failed. Will suspend it for 20.000 seconds.
I am getting the following issue when starting collectd:
Unhandled python exception in read callback: AttributeError: _ElementInterface instance has no attribute 'iter'
This may 100% be an issue with my collectd install, but I've found the Interval flag (in the LoadPlugin) section of collectd.conf
does not change the query frequency of collectd-plex. A simple solution would be to add a parser argument, and pass it as the second parameter in the following line:
collectd.register_read(get_metrics)
As it stands, I see collectd-plex query the server every 15 seconds, and no matter how many changes I made to collectd.conf
, nothing changed this behavior. By changing the above line to:
collectd.register_read(get_metrics, 60)
I see the update interval drop to the expected 60 seconds.
I would have expected that the Interval flag set in the LoadPlugin python
section would work, but it did not. Below is the relevant sections of my config:
<LoadPlugin python>
Globals true
Interval 60
</LoadPlugin>
...
<Plugin python>
ModulePath "/usr/local/src/collectd-plex"
Import "plex"
Interval 60
<Module plex>
Host "******"
Port 32400
AuthToken ******
Interval 60
</Module>
</Plugin>
As expected, the two Interval
flags in the <Plugin python>
section and subsection do nothing: they simply raise warnings for unexpected flags.
does not work since 1.2.6
Unhandled python exception in read callback: KeyError: 'friendlyName'
read-function of plugin `python.plex' failed.
Exiting normally.
exec plugin: Sent SIGTERM to 0
My graphana graphs stopped updating on 11/4, which is the day that 1.2.6 came out. I update every release, so I was able to tie it to this.
Plex Media Server now supports HTTPS/SSL and authentication tokens. Need to write a script to easily obtain an authentication token and then modify plex.py
to use it and optionally support https.
There are other metrics one might want, such as active sessions. Change the code to support any number of metric types.
The sessions stats part of this appears to be broken in the latest versions of PMS (1.2.2.2857) as invalid JSON is being returned when a session is open, it works fine if PMS has no content playing but as soon as I play various items, sometimes it says invalid JSON returned and sometimes it moans about delimiters depending on the item I play.
Someone else has done some digging and has slightly more accurate information on the issue here:
https://forums.plex.tv/discussion/238197/malformed-json-response-from-status-sessions-query
the reply appears to be "use XML" as they don't officially support JSON and it was more luck than judgement that made it work in the first place.
Since the latest update, the script does no longer work.
I am getting the following error when I execute ./plex.py --movies --shows --episodes 127.0.0.1 32400 SECRET_TOKEN
File "./plex.py", line 329, in <module>
get_metrics(collectd=False)
File "./plex.py", line 34, in get_metrics
sections = get_sections()
File "./plex.py", line 134, in get_sections
for section in sectionobject['MediaContainer']['Metadata']:
KeyError: 'Metadata'```
If you need any additional information, feel free to tell me.
OS: Ubuntu 16.04
Python version ~2.7
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.