If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

plexSentry (20160511 Update)

random.serverrandom.server Posts: 929Members, Plex Pass Plex Pass

[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.

    <add key="b_secureOnly" value="false" /><!-- ssl only connections -->

[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

«13456717

Comments

  • random.serverrandom.server Posts: 929Members, Plex Pass Plex Pass

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

  • jpp1972jpp1972 Posts: 36Members, Plex Pass Plex Pass

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

  • jpp1972jpp1972 Posts: 36Members, Plex Pass Plex Pass

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

  • random.serverrandom.server Posts: 929Members, Plex Pass Plex Pass

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

  • jpp1972jpp1972 Posts: 36Members, Plex Pass Plex Pass

    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...

  • random.serverrandom.server Posts: 929Members, Plex Pass Plex Pass

    "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

  • hthighwayhthighway Posts: 6,558Members, Plex Pass, Plex Ninja Plex Ninja
    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.

    • Paul
  • random.serverrandom.server Posts: 929Members, Plex Pass Plex Pass

    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

  • jpp1972jpp1972 Posts: 36Members, Plex Pass Plex Pass

    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...

  • jpp1972jpp1972 Posts: 36Members, Plex Pass Plex Pass

    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 
  • jpp1972jpp1972 Posts: 36Members, Plex Pass Plex Pass

    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
    
  • random.serverrandom.server Posts: 929Members, Plex Pass Plex Pass

    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.

  • MAJ-5MAJ-5 Posts: 80Members, Plex Pass Plex Pass
    edited April 2015

    I am drooling right now!!

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

  • Jonathan VogelbuschJonathan Vogelbusch Posts: 74Members, Plex Pass Plex Pass

    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..

  • karloscarkarloscar Posts: 21Members, Plex Pass Plex Pass
    edited April 2015

    better documentation please.. 

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

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

  • jpp1972jpp1972 Posts: 36Members, Plex Pass Plex Pass
    karloscar wrote on April 4 2015, 5:36 PM: »

    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

    karloscar wrote on April 4 2015, 5:36 PM: »

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

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

  • karloscarkarloscar Posts: 21Members, Plex Pass Plex Pass

    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.

  • random.serverrandom.server Posts: 929Members, Plex Pass Plex Pass

    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.

  • jpp1972jpp1972 Posts: 36Members, Plex Pass Plex Pass

    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

  • GOPLEX2.TVGOPLEX2.TV Posts: 93Members, Plex Pass Plex Pass

    Could not load file or assembly 'System.Data.SQLite.DLL' or one of its dependencies. The specified module could not be found.
     

    Looks like i have some problem with IIS x86 or x64bit sqllite. Running this on Win2012r2. What is the version of sqlite provided from you?

    If i set appool to "enable 32bit" i get the following extra msg:

    WRN: Assembly binding logging is turned OFF.
    To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
    Note: There is some performance penalty associated with assembly bind failure logging.
    To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
«13456717
Sign In or Register to comment.