plexSentry (20160511 Update)

other-dev

#1

[20160511 Update - Incremental]

-Added a key to the config file to account for secure only connections (a work around till i figure out a bug in auto detection)

-Various little fixes I've built in over the past couple of months as I work on the big overhaul.

   

[20151216 Update - Incremental]

-SQL Server Update - Added the ability to monitor shared channels, and added logic to make sure it doesn't kill optimizing jobs (this fixed a issue with sync jobs as well) Only need to update the executable and the common js file.

[20151216 Update - Incremental]

-SQL Server Update Log - file added and some small tweaks

[20150907 Update - Incremental]

-SQL Server Update (only PlexSentry.exe was changed) - Because of changes to the PMS or the new app, iOS users (maybe other clients, but haven't seen it yet) could get around limitations by changing their bitrate after start. The status api point /status/sessions would then not update with the new transcode key, preventing a kill. Add a new function that queries the /transcode/sessions api point for orphan transcodes by eliminating known keys from the sync and status api points, and then kills any "orphaned" key that is transcoding video. The side effect is if there is a user that has transcoding privileges that makes a switch, they'll have to restart the video with the desired bitrate to avoid orphaned transcode keys. I have two a##hole users to thank for the requirement of this new code.

plexSentry (Formerly PlexMonitor) monitors and logs all user activity (playing, syncing) on your Plex server. What separates it from other programs is the ability to set limits on your users activity. Whether it's preventing users from transcoding on your server, stopping your idiot relations from syncing your entire library, or spotting which users are sharing their logon with the entire ####ing neighborhood.

 Features

-keeps log of sessions (1 per session key, not play state) and syncs.

-If user doesn't have transcode permissions, it kills the transcode session and sends a email to user and admin

-If user stream count is above user stream max sends a email to user and admin

-If user sync count is above user sync max sends a email to user and admin after deleting sync

-When above conditions are met, attempts to kill connected clients through HTTP API (only useful on local clients)

-Creates it's own token from plex.tv

-Connects to SQL Server back end or SQLite db file

-Monitors shared channels

-Updates user list from plex.tv as it runs

-Per user settings for transcode (h264 and others), stream count, sync limits for video\audio counts and minimum quality

-Pulls current data from specified server

-Notifies through dummy gmail account (easily changed)

-A friendly user front end (jquery/javascript with a c# middleman for sql requests)

-Notifications on start and stop

-Does not have to be run on target server

-Continues to operate when plex.tv is down

-Can kill transcodes and syncs directly from the web interface without conditions being met

 

To Do

-add email option to front end

-total sum line in summary, charts

-Add limits for amount of time they can use the server in 24 hours before notice is sent (will work on if requested)

-more notification methods?

 

Required

-Windows x64

-IIS Server (UI Only) - Someone could write a php or other middleman to handle db requests, eliminating this requirement

-SQL Server or SQLite

-VS 2012 x64 redistribution file (required for sqlite db)

http://www.microsoft.com/en-us/download/details.aspx?id=30679 

 

 

Install Steps

Back end

-Fill in the variables in *.config file

-Use the command list in 'SQL Server - Build Commands.txt' to build your database

-Run from any computer with network access

 

Front end

-fill in the external server variable in script.Plex-common.js 

-modify db connection strings

 

Email Examples -:

Subject -: Multiple Streams Detected

2 simultaneous streams (Ally McBeal-One Hundred Tears(2002)\CSI: Crime Scene Investigation-Girls Gone Wilder(2014)) were detected (Your current limit is 1). Termination of this stream has been attempted. If this is an issue with your app and the problem persists, please contact #### for possible solutions. -Media Server (this email address is for outgoing automated messages only) 

 

Subject -: [Ally McBeal-One Hundred Tears(2002)] Transcoding was Terminated

One Hundred Tears was terminated due to transcoding, please raise your bitrate to the maximum or you will be banned. If the bitrate is at maximum, please contact #%@ for secondary codec permissions. -Media Server (this email address is for outgoing automated messages only) 

PlexMonitorFilteredUserpng


#2

For anyone that goes with the SQL Server version and also uses Calibre, I have a website for that you might be interested in.


#3

I assume the filename is wrong and should be 2015 not 2014?


#4

BTW you have user/password information in the .config files


#5

Thanks for the heads up. Oh, and yes the date was mean to be 2015


#6

Ok i have a few questions because i am not able to get this to work.

in the script-plex-sqlite.js, what do you mean by the external server address? when i am outside my home network, i access my plex servers through plex.tv

Now when i loaded the webpage, i see one of my friends has an episode on pause but there isn't much i can do... Clicking on LoginAccount does nothing, and clicking the Settings icon also does nothing. I first tried in Chrome and then in IE...


#7

"LoginAccount" is not useful to you without forms authentication.

In the js files there's a line of code -:

var server_address = "http://media.randomevents.net"//external address of server

The address is how I can access my plex server from the internet (behind a reverse proxy). Most people would use something like "http://externalipaddress:32400"or to test on the same machine "http://localhost:32400", I'm guessing since you were able to see your friend, you had the IIS portion set up correctly, so just click on "Media" in the top left corner to pull up the menu and options


#8
Try to kill some clients through of the HTTP API playback controls

If you ever get this part working I'm in.  

I don't care if they transcode.

All I want it to do is drop clients if the user goes above 1 simultaneous stream.


#9

Working on that right now. Except I'm wondering if it should be manual, as I've seen issues with IOS devices that don't always drop a previous play state


#10

Ok i updated my JAVA and added the port number to the server address and now it seems to work...

Can i delete users from the database or should i just delete the .db file entirely because i have a bunch of your users in my database...


#11

Few more things:

  • The Web Frontend's title still says PlexMonitor
  • Shouldn't the Stream count for everyone by default be 1 for users and 99 for owner? When i first ran it, it kicked all my friends off before i could even configure their rights.
  • It keeps trying to kill a paused Plex Web transcode and it doesn't work. Says it's killing it every 5 seconds. Dunno if it's because it thinks it is a Sync or because by default, nobody is allowed to stream by default
  • i have 50 users ... it would be nice to be able to mass update instead of one by one 

#12

Looks like i am the only one using this so far  ;)

I deleted the db file because i could not remove your users and now when i run the program, it creates a new db but cannot update it and can't retrieve my users:

Program has started, loading configuration
Retrieving authorization token from plex.tv
Retrieving server info from local server
Updating database with local server info
Database update failed
Updating shared users list from plex.tv to database
Plex update failed
Updating shared users list from plex.tv to database
Plex update failed
2015-04-03 14:57:58- Starting timer to check status at a interval of 5 seconds
Error when updating users
Checking for currently playing sessions
Current sessions-: 1
Error when checking user sessions

2015-04-03 14:58:04- Checking current syncs
Error when checking sync sessions
2015-04-03 14:58:04- Starting timer to check status at a interval of 5 seconds
Error when updating users
Checking for currently playing sessions
Current sessions-: 1
Error when checking user sessions

2015-04-03 14:58:25- Checking current syncs
Error when checking sync sessions
2015-04-03 14:58:25- Starting timer to check status at a interval of 5 seconds
Error when updating users
Checking for currently playing sessions
Current sessions-: 1
Error when checking user sessions

2015-04-03 14:58:30- Checking current syncs
Error when checking sync sessions
2015-04-03 14:58:30- Starting timer to check status at a interval of 5 seconds

#13

jpp1972, try again with the new upload, that should solve most of your problems. Can you send me a screenshot of the paused instance? It's probably a problem with plex giving the wrong transcode id, the new version will also try stopping the client in addition to the transcode.

Mass update makes sense, I'll switch the interface over to that.


#14

I am drooling right now!!

This holds great potential, but I need a PHP UI to make it work :P


#15

Having only 1 Mbps Upload this is a must have/killer app for my media server. With a PHP UI this would be perfect. For now I won't be able to use it..


#16

better documentation please.. 

The VS 2012 x64 redistribution file link doesn't work.

IIS Server (UI Only) (what is UI only?)


#17

The VS 2012 x64 redistribution file link doesn't work.

Copy the link to the clipboard, paste it in the address bar and remove the trailing space

IIS Server (UI Only) (what is UI only?)

User Interface. Where you do the configuration of who has what rights and limits


#18

I get this: Processing has failed when i go to the webpage https://192.168.0.141/plexmonitor

I've edited database.plex-sqlite.aspx with following:

sqlConnection.ConnectionString = "Data Source=C:\PlexMonitor\Plex Monitor (SQLite)\PlexMonitor-sqllite.db;Version=3;Timeout=100;journal_mode=WAL;";  

You write to "-modify db connection strings"

is that the database.plex-sqlite.aspx you mean or?

I also get "Error when checking sync sessions" when running the 

C:\PlexMonitor\Plex Monitor (SQLite)\Plex Monitor (SQLite).exe

Please let me know if you need more information.


#19

karloscar, Use the new version, everything will be plexSentry. you skipped a step, and need to modify the plexSentry (sqlite).exe.config to use the back end correctly. You changed the aspx file correctly for the front end.


#20

I was hoping for a mass update version before i tried it again but i had a few users with multiple logins so i decided to try your latest version... Unfortunately, it doesn't work at all. It can't update the database or plex server. 

If i run the previous version, it is able to update the database and plex