Open Files Plugin - Can help with troubleshooting why server won't shut down


dlandon

Recommended Posts

This plugin will only work with unRAID V6.1 and later versions.

 

This is a plugin I put together that shows open files and which processes have the files open.  The files that are open that would potentially prevent server shutdown are shown.  You can kill the processes that have files open.

 

This plugin does not replace the Dynamix Active Streams.  Different information is shown on Open Files about all processes that have files open.

 

This plugin installs into Tools->System Information.

 

The preferred method to install this plugin is with CA.

 

Cut and then paste this link into the "Install Plugin" line to install the plugin:

https://github.com/dlandon/open.files/raw/master/open.files.plg
 
Credits: This was put together with permission from BubbaQ and is based on his Open Files Alert package.
Edited by dlandon
  • Upvote 2
Link to comment

This is awesome!  Thank you dlandon (and BubbaQ)!

 

The list is currently sorted by PID, would you consider sorting it by program instead, so all of the Plex processes are together, the smdb processes are together, etc.

 

Also, could this be integrated with the Main -> Array Operation tab?  Perhaps by adding a link in the Stop area that shows the number of open files and links over to this tool?

 

Link to comment

The organization has to be by pid so the process can be killed by pid.  Grouping the files together by program would be an issue when stopping a particular pid.  Which one gets stopped?

 

BubbaQ had an alert tab on the Main tab with a link to the open files page in his Files Alert package.  I'm a bit nervous about interfering with the unRAID tab organization.  I don't want to cause any problems or create confusion when some users don't see that tab.

 

I really only intended this to be a troubleshooting tool, and not necessarily a daily operational tool.

Link to comment

The organization has to be by pid so the process can be killed by pid.  Grouping the files together by program would be an issue when stopping a particular pid.  Which one gets stopped?

 

Sorry I wasn't clear.  I agree that grouping by PID is important, I was suggesting to change the sort order of the groups. 

 

Currently it sorts the groups by PID:

  PID 17665 - Plex (a group of 30 individual rows)

  PID 18880 - smbd (a group of 4 individual rows)

  PIC 19851 - Plex (a group of 10 individual rows)

  PIC 20281 - smdb (a group of 2 individual rows)

 

If we were to re-sort by Program it would look more like this:

  Plex - PID 17665 (a group of 30 individual rows)

  Plex - PIC 19851 (a group of 10 individual rows)

  smbd - PID 18880 (a group of 4 individual rows)

  smbd - PIC 20281 (a group of 2 individual rows)

 

I think that would make it easier to see what apps really have open, but if you disagree that is fine.  This is still really helpful :)

 

 

BubbaQ had an alert tab on the Main tab with a link to the open files page in his Files Alert package.  I'm a bit nervous about interfering with the unRAID tab organization.  I don't want to cause any problems or create confusion when some users don't see that tab.

 

I really only intended this to be a troubleshooting tool, and not necessarily a daily operational tool.

 

I was hoping to modify the existing Array Operations tab, rather than create a new one.  But maybe that isn't possible without incorporating this into unraid itself.  We certainly wouldn't want to break that particular tab :)

Link to comment

The organization has to be by pid so the process can be killed by pid.  Grouping the files together by program would be an issue when stopping a particular pid.  Which one gets stopped?

 

BubbaQ had an alert tab on the Main tab with a link to the open files page in his Files Alert package.  I'm a bit nervous about interfering with the unRAID tab organization.  I don't want to cause any problems or create confusion when some users don't see that tab.

 

I really only intended this to be a troubleshooting tool, and not necessarily a daily operational tool.

You could add the "tablesorter" class to the table and then it could be sorted dynamically however anyone wants. Similar to the Installed Plugins page. I have it in my wol and ipmi plugin.

Link to comment

The organization has to be by pid so the process can be killed by pid.  Grouping the files together by program would be an issue when stopping a particular pid.  Which one gets stopped?

 

BubbaQ had an alert tab on the Main tab with a link to the open files page in his Files Alert package.  I'm a bit nervous about interfering with the unRAID tab organization.  I don't want to cause any problems or create confusion when some users don't see that tab.

 

I really only intended this to be a troubleshooting tool, and not necessarily a daily operational tool.

You could add the "tablesorter" class to the table and then it could be sorted dynamically however anyone wants. Similar to the Installed Plugins page. I have it in my wol and ipmi plugin.

 

I'll take a look at it when I get some time.

Link to comment

I was hoping to modify the existing Array Operations tab, rather than create a new one.

 

You have to do a search and replace to insert custom html/javascript into the stock unRAID html.  I've done it but it is fraught with peril of 1) it not working on a different version and 2) hosing up the page so a user couldn't get to the buttons to shut down unRAID.

 

But as I said in the original thread, that is a perfect place to put it..... plus adding an extra click-through when stopping the array when there are open files that may block it, so you don't get stuck in a loop.

  • Upvote 1
Link to comment

I was hoping to modify the existing Array Operations tab, rather than create a new one.

 

You have to do a search and replace to insert custom html/javascript into the stock unRAID html.  I've done it but it is fraught with peril of 1) it not working on a different version and 2) hosing up the page so a user couldn't get to the buttons to shut down unRAID.

 

But as I said in the original thread, that is a perfect place to put it..... plus adding an extra click-through when stopping the array when there are open files that may block it, so you don't get stuck in a loop.

You can add another tab to the main tabs by just setting the Menu option in the .page file to be something like "Main:x" where x is the tab number to use (use something like 9 so that you won't be overwriting any other existing tab)  Its no different than setting it to be in the tools section (and is exactly how CA winds up on the docker page)
Link to comment

The organization has to be by pid so the process can be killed by pid.  Grouping the files together by program would be an issue when stopping a particular pid.  Which one gets stopped?

 

BubbaQ had an alert tab on the Main tab with a link to the open files page in his Files Alert package.  I'm a bit nervous about interfering with the unRAID tab organization.  I don't want to cause any problems or create confusion when some users don't see that tab.

 

I really only intended this to be a troubleshooting tool, and not necessarily a daily operational tool.

You could add the "tablesorter" class to the table and then it could be sorted dynamically however anyone wants. Similar to the Installed Plugins page. I have it in my wol and ipmi plugin.

 

I'll take a look at it when I get some time.

You would just need to change the table headers from td to th. Then add tablesorter class and an id.

<table class='tablesorter share_status small' id='tblOpenFiles'>
<thead><tr><th width='8%'>Program <strong>*<strong></th><th width='8%'>Process ID</th><th width='6%'>Open Files</th><th width='20%'>Files that may prevent unRAID shutdown</th><th width='auto'>File Name and Path</th></tr></thead>
<tbody id="streams"><?echo(ofiles());?></tbody>
</table>

Then add this bit of javascript at the end of the page and column 0, 1 and 4 will be sortable

<script type="text/javascript">
$(function(){
$('#tblOpenFiles').tablesorter({headers:{2:{sorter:false},3:{sorter:false}}});
});
</script>

Link to comment

You can add another tab to the main tabs by just setting the Menu option in the .page file to be something like "Main:x" where x is the tab number to use (use something like 9 so that you won't be overwriting any other existing tab)  Its no different than setting it to be in the tools section (and is exactly how CA winds up on the docker page)

 

That's what my original did:

 

http://lime-technology.com/forum/index.php?topic=42773.msg407486

Link to comment

You can add another tab to the main tabs by just setting the Menu option in the .page file to be something like "Main:x" where x is the tab number to use (use something like 9 so that you won't be overwriting any other existing tab)  Its no different than setting it to be in the tools section (and is exactly how CA winds up on the docker page)

 

That's what my original did:

 

http://lime-technology.com/forum/index.php?topic=42773.msg407486

 

That can easily be done.

Link to comment

The organization has to be by pid so the process can be killed by pid.  Grouping the files together by program would be an issue when stopping a particular pid.  Which one gets stopped?

 

BubbaQ had an alert tab on the Main tab with a link to the open files page in his Files Alert package.  I'm a bit nervous about interfering with the unRAID tab organization.  I don't want to cause any problems or create confusion when some users don't see that tab.

 

I really only intended this to be a troubleshooting tool, and not necessarily a daily operational tool.

You could add the "tablesorter" class to the table and then it could be sorted dynamically however anyone wants. Similar to the Installed Plugins page. I have it in my wol and ipmi plugin.

 

I'll take a look at it when I get some time.

You would just need to change the table headers from td to th. Then add tablesorter class and an id.

<table class='tablesorter share_status small' id='tblOpenFiles'>
<thead><tr><th width='8%'>Program <strong>*<strong></th><th width='8%'>Process ID</th><th width='6%'>Open Files</th><th width='20%'>Files that may prevent unRAID shutdown</th><th width='auto'>File Name and Path</th></tr></thead>
<tbody id="streams"><?echo(ofiles());?></tbody>
</table>

Then add this bit of javascript at the end of the page and column 0, 1 and 4 will be sortable

<script type="text/javascript">
$(function(){
$('#tblOpenFiles').tablesorter({headers:{2:{sorter:false},3:{sorter:false}}});
});
</script>

 

Done.  Thanks for the help you got me there faster than if I did it on my own.

Link to comment

I was hoping to modify the existing Array Operations tab, rather than create a new one.

 

You have to do a search and replace to insert custom html/javascript into the stock unRAID html.  I've done it but it is fraught with peril of 1) it not working on a different version and 2) hosing up the page so a user couldn't get to the buttons to shut down unRAID.

 

But as I said in the original thread, that is a perfect place to put it..... plus adding an extra click-through when stopping the array when there are open files that may block it, so you don't get stuck in a loop.

 

This approach is too messy for a plugin and is prone to many problems.  That should be done by LT.

 

I can look into adding the tab back that bubbaQ originally had in his Open Files Alert package.

Link to comment

I was hoping to modify the existing Array Operations tab, rather than create a new one.

 

You have to do a search and replace to insert custom html/javascript into the stock unRAID html.  I've done it but it is fraught with peril of 1) it not working on a different version and 2) hosing up the page so a user couldn't get to the buttons to shut down unRAID.

 

But as I said in the original thread, that is a perfect place to put it..... plus adding an extra click-through when stopping the array when there are open files that may block it, so you don't get stuck in a loop.

You can add another tab to the main tabs by just setting the Menu option in the .page file to be something like "Main:x" where x is the tab number to use (use something like 9 so that you won't be overwriting any other existing tab)  Its no different than setting it to be in the tools section (and is exactly how CA winds up on the docker page)

 

Yes.  That's the way bubbaQ originally had it in his package.  I was holding off on that for some feedback.  I obviously got the feedback.

Link to comment

The organization has to be by pid so the process can be killed by pid.  Grouping the files together by program would be an issue when stopping a particular pid.  Which one gets stopped?

 

BubbaQ had an alert tab on the Main tab with a link to the open files page in his Files Alert package.  I'm a bit nervous about interfering with the unRAID tab organization.  I don't want to cause any problems or create confusion when some users don't see that tab.

 

I really only intended this to be a troubleshooting tool, and not necessarily a daily operational tool.

You could add the "tablesorter" class to the table and then it could be sorted dynamically however anyone wants. Similar to the Installed Plugins page. I have it in my wol and ipmi plugin.

 

I'll take a look at it when I get some time.

You would just need to change the table headers from td to th. Then add tablesorter class and an id.

<table class='tablesorter share_status small' id='tblOpenFiles'>
<thead><tr><th width='8%'>Program <strong>*<strong></th><th width='8%'>Process ID</th><th width='6%'>Open Files</th><th width='20%'>Files that may prevent unRAID shutdown</th><th width='auto'>File Name and Path</th></tr></thead>
<tbody id="streams"><?echo(ofiles());?></tbody>
</table>

Then add this bit of javascript at the end of the page and column 0, 1 and 4 will be sortable

<script type="text/javascript">
$(function(){
$('#tblOpenFiles').tablesorter({headers:{2:{sorter:false},3:{sorter:false}}});
});
</script>

 

Done.  Thanks for the help you got me there faster than if I did it on my own.

No problem. Thank you for putting this together.

Link to comment

... I also added a 'Files Open' tab in Main.

 

Personally I am not so much in favor of adding an additional tab under Main, for two reasons:

 

1. In tabbed mode a tracking system is used to remember the parent tab when descending into some child view. Unfortunately Main is the only page where this 'special' tracking needs to be done. This is based on the existing devices tabs defined under Main, adding a new tab breaks this mechanism.

 

2. The current tabs under Main all refer to devices, but Open Files are not devices and therefore looks misplaced.

 

I see Open Files more as a tool /aid to help in troubleshooting and its placement under Tools - in my view - is the better approach.

 

Link to comment

... I also added a 'Files Open' tab in Main.

 

Personally I am not so much in favor of adding an additional tab under Main, for two reasons:

 

1. In tabbed mode a tracking system is used to remember the parent tab when descending into some child view. Unfortunately Main is the only page where this 'special' tracking needs to be done. This is based on the existing devices tabs defined under Main, adding a new tab breaks this mechanism.

 

2. The current tabs under Main all refer to devices, but Open Files are not devices and therefore looks misplaced.

 

I see Open Files more as a tool /aid to help in troubleshooting and its placement under Tools - in my view - is the better approach.

 

The Main->Files Open tab is only a status of the files open on the system that can prevent an array shutdown and provides a link to the 'Tools->Files' Open web page.

 

I've renamed 'Main->Files Open' to 'Main->Open Files'.

 

I'll try to find a better answer to the 'Main->Open Files' tab.

Link to comment

The Main->Files Open tab is only a status of the files open on the system that can prevent an array shutdown and provides a link to the 'Tools->Files' Open web page.

 

I've renamed 'Main->Files Open' to 'Main->Open Files'.

Not sure that is any better ;D    Maybe something like "Active Files" would be better (or "Active Array Files" if you want to be more exact).
Link to comment

Thank you for this....! can I make a cosmetic request please...  the triangular "Warning" icon freaks me out every time I go to the Main page. I am conditioned that when I see this icon, something is wrong. Can you please change the icon to something less "alarming"... Below are some ideas. Please let me know if you need help re-sizing any image or tweaking anything.

 

Many thanks,

 

http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons-256/green-jelly-icons-business/082258-green-jelly-icon-business-document8.png

https://lh4.ggpht.com/lUcLbewm2mffnhc1_BbZYi5zjEXAzfeYf73cg2SXjFDX3_xNnHGUMkSRdh86TN8HqcSq7Qr3vA=w512

http://findicons.com/files/icons/1580/devine_icons_part_2/128/defult_text.png

 

I can also colorize or tweak the b&w images a little as welll... just let me know your thoughts.

 

 

 

 

 

Link to comment

Thank you for this....! can I make a cosmetic request please...  the triangular "Warning" icon freaks me out every time I go to the Main page. I am conditioned that when I see this icon, something is wrong. Can you please change the icon to something less "alarming"... Below are some ideas. Please let me know if you need help re-sizing any image or tweaking anything.

 

Many thanks,

 

http://cdn.mysitemyway.com/etc-mysitemyway/icons/legacy-previews/icons-256/green-jelly-icons-business/082258-green-jelly-icon-business-document8.png

https://lh4.ggpht.com/lUcLbewm2mffnhc1_BbZYi5zjEXAzfeYf73cg2SXjFDX3_xNnHGUMkSRdh86TN8HqcSq7Qr3vA=w512

http://findicons.com/files/icons/1580/devine_icons_part_2/128/defult_text.png

 

I can also colorize or tweak the b&w images a little as welll... just let me know your thoughts.

 

I agree.  That is a bit alarming.

 

You pick one, re-size it to 16x16 and be sure it has a transparent background.  They all look good.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.