CBers 6772 Posted January 27, 2020 Share Posted January 27, 2020 Consider it done. Excellent, thanks Chef. Link to comment Share on other sites More sharing options...
chef 3748 Posted January 27, 2020 Author Share Posted January 27, 2020 @@CBers I'm not sure I can change the labels on the datasets for the graph. It's calculated in total bytes because that's the information return from the OS. That's why I recalculate more friendly units at the bottom. I'll see what I can do. Maybe just remove the graph labels? What I was able to do was create a scheduled task which monitors drive space and sends admin notifications when a threshold is met. It needs a little more work before I put the changes in the catalogue. Right now it's sending notifications each time the task runs. Once will be enough? Or should it send more? 1 Link to comment Share on other sites More sharing options...
CBers 6772 Posted January 27, 2020 Share Posted January 27, 2020 @@CBers I'm not sure I can change the labels on the datasets for the graph. It's calculated in total bytes because that's the information return from the OS. That's why I recalculate more friendly units at the bottom. I'll see what I can do. Maybe just remove the graph labels? See what others say ? What I was able to do was create a scheduled task which monitors drive space and sends admin notifications when a threshold is met. It needs a little more work before I put the changes in the catalogue. Right now it's sending notifications each time the task runs. Once will be enough? Or should it send more? Once per run, perhaps default to an hourly run ? If the Admin hasn't fixed it by then, they can always disabled the ST. 1 Link to comment Share on other sites More sharing options...
chef 3748 Posted January 27, 2020 Author Share Posted January 27, 2020 (edited) @@CBers backend notifications are setup, but after an entire afternoon thinking I was missing something, the notifications are all third party plugins for the server. Question: is the activity log loaded and saved inside a database? or is it read from a file? Or is it read from a db file? If it is in a db I could use sqlite commands to write to the activity log... I've never done that before, but it could be done. There is no other way to access the Alert list on the dashboard that I can see. Looks like the ActivityLog function in the JavaScript is being really choosey about what it posts to the Alert list. It uses events.on(serverNotification, "ActivityLogEntry", onUpdate) But only specific alerts get posted there, failed tasks, plugin installs etc. Do you know anything more to help with this conundrum? Edited January 27, 2020 by chef 1 Link to comment Share on other sites More sharing options...
maegibbons 1267 Posted January 28, 2020 Share Posted January 28, 2020 For me I use pushover for my emby alerts which will be great with your low disk space notifications. Not having it on the dashboard is not a deal breaker in my eyes. Krs Mark Sent from my SM-N976B using Tapatalk 1 Link to comment Share on other sites More sharing options...
chef 3748 Posted January 28, 2020 Author Share Posted January 28, 2020 (edited) 1.0.0.2 1. Scheduled Task Added to monitor Disk Space (will run every hour) - this task is hidden by default 2. Notifications Added when a drive has surpassed 90% of it's space Note: Windows decides 90% is the threshold to alert the user of an almost full hard drive. So I guess we can do it too 3. Removed chartJS drive donuts tool-tips. TODO: Add custom tool-tips - https://www.chartjs.org/docs/latest/configuration/tooltip.html#external-custom-tooltips I'd be great to get some feedback on the notifications. @@CBers @@maegibbons Oh yeah, is this math right?? var threshold = driveInfo.TotalSize - (driveInfo.TotalSize / 10); //Remove 10% of the total from the total if (driveInfo.AvailableFreeSpace < threshold) return; //if it's less move on Edited January 28, 2020 by chef 2 Link to comment Share on other sites More sharing options...
pir8radio 1292 Posted January 28, 2020 Share Posted January 28, 2020 Nifty...... 1 Link to comment Share on other sites More sharing options...
CBers 6772 Posted January 28, 2020 Share Posted January 28, 2020 (edited) 1.0.0.2 1. Scheduled Task Added to monitor Disk Space (will run every hour) - this task is hidden by default 2. Notifications Added when a drive has surpassed 90% of it's space Note: Windows decides 90% is the threshold to alert the user of an almost full hard drive. So I guess we can do it too I'd be great to get some feedback on the notifications. Many thanks Chef. I had quite a few notifications overnight, telling me that certain drives were full, such as: T:\ (Transcoding-Temp) disk space almost full - 1.8 TB S:\ (Bay 5 MSA) disk space almost full - 1.8 TB M:\ (MDRIVE) disk space almost full - 1.8 TB You can see from the image, that those drives are not full at all: Is the maths the wrong way round ? Why is the ST hidden ? Would be nice to have the ability to change the schedule, if nothing else. Great work though Chef and a much needed addition to Emby. Looking forward to future releases . Edited January 28, 2020 by CBers 1 Link to comment Share on other sites More sharing options...
chef 3748 Posted January 28, 2020 Author Share Posted January 28, 2020 1.0.0.3 fixed 90% threshold calculation Scheduled Task is now visible for configurations 1 Link to comment Share on other sites More sharing options...
Dibbes 431 Posted January 28, 2020 Share Posted January 28, 2020 (edited) var threshold = driveInfo.TotalSize - (driveInfo.TotalSize / 10); //Remove 10% of the total from the total if (driveInfo.AvailableFreeSpace < threshold) return; //if it's less move on not sure, but shouldn't that be: var threshold = driveInfo.TotalSize - (driveInfo.TotalSize * 0.9); //Remove 10% of the total from the total if (driveInfo.AvailableFreeSpace < threshold) return; //if it's less move on or if you cannot use decimals: var threshold = driveInfo.TotalSize - ((driveInfo.TotalSize / 100) * 90); //Remove 10% of the total from the total if (driveInfo.AvailableFreeSpace < threshold) return; //if it's less move on Edit: Looks like you beat me to it... Edited January 28, 2020 by Dibbes 1 Link to comment Share on other sites More sharing options...
chef 3748 Posted January 28, 2020 Author Share Posted January 28, 2020 (edited) I ended up using 0.9*driveInfo.totalSpace This might end up with precision floating point number, and I'm not exactly sure how that will affect things. There are a lot bytes in Terabytes and then to calculate a float out of that might be really huge. Might have to round the number. Edited January 28, 2020 by chef Link to comment Share on other sites More sharing options...
CBers 6772 Posted January 28, 2020 Share Posted January 28, 2020 90% of anything is very confusing. 90% of a 1Tb drive is 921Gb, but 90% of a 8Tb drive is 7372Gb. Not sure how easy it would be, but perhaps the threshold should be Gb, rather than a percentage ? I remember from my unix days that I always checked for %, but also included the free space remaining for a filesystem, so you could see if you needed to worry or not, or adjust the threshold. Can't download the latest version of the plugin as it fails. Download validation failed for Disk Space. Probably corrupted during transfer. at Emby.Server.Implementations.Updates.InstallationManager.PerformPackageInstallation(IProgress`1 progress, String target, PackageVersionInfo package, CancellationToken cancellationToken) at Emby.Server.Implementations.Updates.InstallationManager.InstallPackageInternal(PackageVersionInfo package, Boolean isPlugin, IProgress`1 progress, CancellationToken cancellationToken) at Emby.Server.Implementations.Updates.InstallationManager.InstallPackage(PackageVersionInfo package, Boolean isPlugin, IProgress`1 progress, CancellationToken cancellationToken) at Emby.Server.Implementations.ScheduledTasks.PluginUpdateTask.Execute(CancellationToken cancellationToken, IProgress`1 progress) at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options) How can I manually run the plugin update ST as @@Luke has hidden them? Link to comment Share on other sites More sharing options...
Dibbes 431 Posted January 28, 2020 Share Posted January 28, 2020 (edited) I ended up using 0.9*driveInfo.totalSpace This might end up with precision floating point number, and I'm not exactly sure how that will affect things. There are a lot bytes in Terabytes and then to calculate a float out of that might be really huge. Might have to round the number. Why would you want to do that? Just don't give a percentage, but do it in GB or TB... EDIT: and this time it was @@CBers who beat me to it... Edited January 28, 2020 by Dibbes 1 Link to comment Share on other sites More sharing options...
Dibbes 431 Posted January 28, 2020 Share Posted January 28, 2020 90% of anything is very confusing. 90% of a 1Tb drive is 921Gb, but 90% of a 8Tb drive is 7372Gb. Not sure how easy it would be, but perhaps the threshold should be Gb, rather than a percentage ? I remember from my unix days that I always checked for %, but also included the free space remaining for a filesystem, so you could see if you needed to worry or not, or adjust the threshold. Can't download the latest version of the plugin as it fails. Download validation failed for Disk Space. Probably corrupted during transfer. at Emby.Server.Implementations.Updates.InstallationManager.PerformPackageInstallation(IProgress`1 progress, String target, PackageVersionInfo package, CancellationToken cancellationToken) at Emby.Server.Implementations.Updates.InstallationManager.InstallPackageInternal(PackageVersionInfo package, Boolean isPlugin, IProgress`1 progress, CancellationToken cancellationToken) at Emby.Server.Implementations.Updates.InstallationManager.InstallPackage(PackageVersionInfo package, Boolean isPlugin, IProgress`1 progress, CancellationToken cancellationToken) at Emby.Server.Implementations.ScheduledTasks.PluginUpdateTask.Execute(CancellationToken cancellationToken, IProgress`1 progress) at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options) How can I manually run the plugin update ST as @@Luke has hidden them? Go to the plugin catalog and reinstall directly from there... When you click on the catalog item, it should display 1.0.0.3, at least it did for me and then click the install button... 1 Link to comment Share on other sites More sharing options...
chef 3748 Posted January 28, 2020 Author Share Posted January 28, 2020 Okay one second Link to comment Share on other sites More sharing options...
chef 3748 Posted January 28, 2020 Author Share Posted January 28, 2020 (edited) 1.0.0.4 Okay so you are right. Currently I have hard coded the threshold to 5GB's left on the drive. That number should be configurable, however if it is configurable then it should be for each drive because some TV recordings could fill that up pretty quickly. That's going to take some coding. Plus, someone should check my math: (8589934592 bytes * 5) = 5GB On average, how big are TV recording (considering commercials haven't been removed). We should have a default that is the size of three or four TV recordings... right? Not sure what happened to the version 1.0.0.3, but 4 should work install properly. Edited January 28, 2020 by chef 2 Link to comment Share on other sites More sharing options...
Dibbes 431 Posted January 28, 2020 Share Posted January 28, 2020 Plus, someone should check my math: (8589934592 bytes * 5) = 5GB not sure how you got to that number, but 5GB is 5,368,709,120 bytes or 5e+9 bytes, depending how you want to write it out... 1 Link to comment Share on other sites More sharing options...
CBers 6772 Posted January 28, 2020 Share Posted January 28, 2020 Thanks Chef, v1.0.0.4 now installed. Link to comment Share on other sites More sharing options...
CBers 6772 Posted January 28, 2020 Share Posted January 28, 2020 On average, how big are TV recording (considering commercials haven't been removed). We should have a default that is the size of three or four TV recordings... right? @@Spaceboy, @@PenkethBoy and @@maegibbons should have a good idea on recording sizes. Link to comment Share on other sites More sharing options...
chacawaca 106 Posted January 28, 2020 Share Posted January 28, 2020 for me 1h of recording is around 8-9 gig before i compress them 1 Link to comment Share on other sites More sharing options...
CBers 6772 Posted January 28, 2020 Share Posted January 28, 2020 @@chef I'm still getting the original messages, even though v1.0.0.4 is in use. T:\ (Transcoding-Temp) disk space almost full - 1.8 TB S:\ (Bay 5 MSA) disk space almost full - 1.8 TBM:\ (MDRIVE) disk space almost full - 1.8 TB GetDriveData is returning this. {"DriveName":"C:\\","VolumeLabel":"CDRIVE","TotalSize":499066789888,"UsedSpace":160648175616,"FreeSpace":338418614272,"Format":"NTFS","FriendlyName":"C","FriendlyUsed":"149.6 GB","FriendlyTotal":"464.8GB","FriendlyAvailable":"315.2 GB"}, {"DriveName":"E:\\","VolumeLabel":"Paul's Old CDRIVE","TotalSize":319964573696,"UsedSpace":163385593856,"FreeSpace":156578979840,"Format":"NTFS","FriendlyName":"E","FriendlyUsed":"152.2 GB","FriendlyTotal":"298.0GB","FriendlyAvailable":"145.8 GB"}, {"DriveName":"F:\\","VolumeLabel":"FDRIVE","TotalSize":1000202039296,"UsedSpace":159947808768,"FreeSpace":840254230528,"Format":"NTFS","FriendlyName":"F","FriendlyUsed":"149.0 GB","FriendlyTotal":"931.5GB","FriendlyAvailable":"782.5 GB"}, {"DriveName":"M:\\","VolumeLabel":"MDRIVE","TotalSize":2000396742656,"UsedSpace":712544256,"FreeSpace":1999684198400,"Format":"NTFS","FriendlyName":"M","FriendlyUsed":"679.5 MB","FriendlyTotal":"1.8 TB","FriendlyAvailable":"1.8TB"}, {"DriveName":"R:\\","VolumeLabel":"Bay 9 MSA","TotalSize":3000574668800,"UsedSpace":857840021504,"FreeSpace":2142734647296,"Format":"NTFS","FriendlyName":"R","FriendlyUsed":"798.9 GB","FriendlyTotal":"2.7TB","FriendlyAvailable":"1.9 TB"}, {"DriveName":"S:\\","VolumeLabel":"Bay 5 MSA","TotalSize":2000396742656,"UsedSpace":196579328,"FreeSpace":2000200163328,"Format":"NTFS","FriendlyName":"S","FriendlyUsed":"187.5 MB","FriendlyTotal":"1.8 TB","FriendlyAvailable":"1.8TB"}, {"DriveName":"T:\\","VolumeLabel":"Transcoding-Temp","TotalSize":2000396742656,"UsedSpace":169906176,"FreeSpace":2000226836480,"Format":"NTFS","FriendlyName":"T","FriendlyUsed":"162.0 MB","FriendlyTotal":"1.8TB","FriendlyAvailable":"1.8 TB"}, {"DriveName":"U:\\","VolumeLabel":"Bay 8 MSA","TotalSize":2000396742656,"UsedSpace":47957217280,"FreeSpace":1952439525376,"Format":"NTFS","FriendlyName":"U","FriendlyUsed":"44.7 GB","FriendlyTotal":"1.8TB","FriendlyAvailable":"1.8 TB"}, {"DriveName":"X:\\","VolumeLabel":"XDRIVE","TotalSize":30255503876096,"UsedSpace":14325955985408,"FreeSpace":15929547890688,"Format":"NTFS","FriendlyName":"X","FriendlyUsed":"13.0 TB","FriendlyTotal":"27.5TB","FriendlyAvailable":"14.5 TB"} 1 Link to comment Share on other sites More sharing options...
chef 3748 Posted January 28, 2020 Author Share Posted January 28, 2020 (edited) @@CBers, after working with the tool-tip in chart JS (it gets pretty complicated fast), I was able to add the percentage in a more friendly way. I can't seem to charge the over all scale of the tool-tip label, it will still read the disk space in bytes, but at least you can see the calculated percentage under it. Best I can currently do with chartJS at the moment. 1.0.0.5 Also changes to 10 GB left threshold, and also check TotalFreeSpace on the drive which is apparently different the Available Free space. Edited January 28, 2020 by chef 1 Link to comment Share on other sites More sharing options...
CBers 6772 Posted January 28, 2020 Share Posted January 28, 2020 Thanks Chef. Maths: If you are checking on free space, then if you multiply the drives FREESPACE by 100 then divide by the TOTALSIZE< you will get a percentage. If you then ask if that's less than the threshold (this needs enabling in the settings), then you can alert. So, taking my M:\ drive figures from GetDriveData above for example, gives: (1999684198400 * 100) / 2000396742656 = 99.96437985321582%. Round it up to 99.96% free, or 0.04% used. 1 Link to comment Share on other sites More sharing options...
chef 3748 Posted January 28, 2020 Author Share Posted January 28, 2020 (edited) not sure how you got to that number, but 5GB is 5,368,709,120 bytes or 5e+9 bytes, depending how you want to write it out... @@Dibbes, this is correct? 10e+9 = 10GB Edited January 28, 2020 by chef Link to comment Share on other sites More sharing options...
chef 3748 Posted January 28, 2020 Author Share Posted January 28, 2020 (edited) I found another reason why it was failing. It looks like the threshold need to be casted to a long like this: var threshold = (long)(driveInfo.TotalSize - (10e+9)); so that should return a long value which is 10GB less then the total space on the hard drive. That is if @@Dibbes 's math-brain says it is Edited January 28, 2020 by chef Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now