{"id":202,"date":"2017-04-15T02:03:15","date_gmt":"2017-04-15T02:03:15","guid":{"rendered":"http:\/\/blog.warbel.net\/?p=202"},"modified":"2017-04-15T02:03:15","modified_gmt":"2017-04-15T02:03:15","slug":"monitoring-plex-with-plexpy-on-ubuntu-16-04","status":"publish","type":"post","link":"https:\/\/blog.warbel.net\/index.php\/2017\/04\/15\/monitoring-plex-with-plexpy-on-ubuntu-16-04\/","title":{"rendered":"Monitoring Plex with Plexpy on Ubuntu 16.04"},"content":{"rendered":"<h1>Background:<\/h1>\n<p>Plex, for a multi-user multi-media system, lacks detailed logging and monitoring.\u00a0A colleague recently pointed out to me that another system, PlexPY exists to fill that gap. This blog post will walk through the steps I took to integrate the system into my reverse proxy and setup init scripts.<br \/>\nPlexpy itself, has quite good documentation <a href=\"https:\/\/github.com\/JonnyWong16\/plexpy\/wiki\/Installation#linux\">here (for initial setup)<\/a> and <a href=\"https:\/\/github.com\/JonnyWong16\/plexpy\/blob\/master\/init-scripts\/init.systemd\">here (for creating system init scripts)<\/a>.<\/p>\n<h1>Creating a new service:<\/h1>\n<p>This is straightforward, and can be done by following the documentation above. No changes were necessary to have it running on Ubuntu 16.04.<\/p>\n<ol>\n<li>Create the user to run the service:\n<pre>sudo adduser --system --no-create-home plexpy<\/pre>\n<\/li>\n<li>Change the ownership of the file structure to allow the new user to modify the files:\n<pre>sudo chown plexpy:nogroup -R \/opt\/plexpy<\/pre>\n<\/li>\n<li>Create the init script:\n<pre>sudo vi \/lib\/systemd\/system\/plexpy.service<\/pre>\n<\/li>\n<li>Put the following in the file:\n<pre>[Unit]\r\nDescription=PlexPy - Stats for Plex Media Server usage\r\n\r\n[Service]\r\nExecStart=\/opt\/plexpy\/PlexPy.py --quiet --daemon --nolaunch --config \/opt\/plexpy\/config.ini --datadir \/opt\/plexpy\r\nGuessMainPID=no\r\nType=forking\r\nUser=plexpy\r\nGroup=nogroup\r\n\r\n[Install]\r\nWantedBy=multi-user.target<\/pre>\n<\/li>\n<li>Reload the services, enable plexpy and start it:\n<pre>sudo systemctl daemon-reload; sudo systemctl enable plexpy.service; sudo service plexpy start<\/pre>\n<h1><\/h1>\n<\/li>\n<\/ol>\n<h1>Configuring Apache reverse proxy to allow access:<\/h1>\n<ol>\n<li>Shutdown Apache and PlexPY:\n<pre>sudo service plexpy stop\r\nsudo service apache2 stop<\/pre>\n<\/li>\n<li>Change the settings in PlexPY to make it work behind a reverse proxy. Edit the config file and change the lines to:\n<pre>http_root = \/plexpy\r\nhttp_proxy = 1<\/pre>\n<\/li>\n<li>Edit your Apache reverse config file for the domain hosting plexpy:\n<pre>ProxyPass \/plexpy http:\/\/Local_IP_of_plexpy:8181\/plexpy\/\r\nProxyPassReverse \/plexpy http:\/\/Local_IP_of_plexpy:8181\/plexpy\/<\/pre>\n<\/li>\n<li>Start the services again:\n<pre>sudo service plexpy start\r\nsudo service apache2 start<\/pre>\n<\/li>\n<li>Test:<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-203\" src=\"http:\/\/blog.warbel.net\/wp-content\/uploads\/2017\/04\/plexpy.jpg\" alt=\"\" width=\"485\" height=\"271\" srcset=\"https:\/\/blog.warbel.net\/wp-content\/uploads\/2017\/04\/plexpy.jpg 485w, https:\/\/blog.warbel.net\/wp-content\/uploads\/2017\/04\/plexpy-300x168.jpg 300w\" sizes=\"auto, (max-width: 485px) 100vw, 485px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Background: Plex, for a multi-user multi-media system, lacks detailed logging and monitoring.\u00a0A colleague recently pointed out to me that another system, PlexPY exists to fill that gap. This blog post will walk through the steps I took to integrate the &hellip; <a href=\"https:\/\/blog.warbel.net\/index.php\/2017\/04\/15\/monitoring-plex-with-plexpy-on-ubuntu-16-04\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-202","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/202","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/comments?post=202"}],"version-history":[{"count":1,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/202\/revisions"}],"predecessor-version":[{"id":204,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/posts\/202\/revisions\/204"}],"wp:attachment":[{"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/media?parent=202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/categories?post=202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.warbel.net\/index.php\/wp-json\/wp\/v2\/tags?post=202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}