September 15, 200817 yr Since we are going to muck with the Samba shares, seems a good opportunity to change the create and directory masks from the brain-dead values emhttp creates. What do you suggest as less brain-dead values? Joe L.
September 15, 200817 yr Author Since we are going to muck with the Samba shares, seems a good opportunity to change the create and directory masks from the brain-dead values emhttp creates. What do you suggest as less brain-dead values? Joe L. 100% valid, but please discuss the suggestions to umask in a different thread so it could be followed by Tom. If we have a consensus on proper values, then emhttp can be updated with what we believe is appropriate. At the very lease we could have an installable package that makes the changes we deem necessary.
September 15, 200817 yr The brain dead values are 711. I have previously posted about them in a dedicated thread. http://lime-technology.com/forum/index.php?topic=2422.0 The better values are 755 for directories, and 644 for created files. But ideally, the mask would be a configurable option the user can enter or chose from. Also, when doing apcaccess, we need to combine the stderr with stdout in order to capture the "Error contacting apcupsd @ localhost:3551: Connection refused" error. Does anyone use something other than apcaccess to get their UPS status?
September 15, 200817 yr To get back to the unmenu.awk server... The "About" page looks like this: I have lots of plug-ins in place, and many can be removed now with the new sys_info plug-in combining the functionality of some others into one. The main page has evolved... lots more information is available. See the illustration below. I'll release the newest version this week. It is being tested by a few volunteers first and I still need to write more of the disk_management page. Joe L. Main Page:
September 15, 200817 yr The brain dead values are 711. I have previously posted about them in a dedicated thread. http://lime-technology.com/forum/index.php?topic=2422.0 The better values are 755 for directories, and 644 for created files. But ideally, the mask would be a configurable option the user can enter or chose from. We can make it configurable... Also, when doing apcaccess, we need to combine the stderr with stdout in order to capture the "Error contacting apcupsd @ localhost:3551: Connection refused" error. Good catch Does anyone use something other than apcaccess to get their UPS status? Yes, if they use a UPS from some other manufacturer than "APC" it might use an entirely different program to determine the UPS status.
September 15, 200817 yr Please kill my the hwinfo plugin... that has been superceeded by the sysinfo plugin.
September 15, 200817 yr BTW Joe, I have TB drives, and they appear to muck up the math in calculating totals.
September 15, 200817 yr Please kill my the hwinfo plugin... that has been superceeded by the sysinfo plugin. I know... I just still have it in my folder. I'll not distribute it. I know my top menu is cluttered, but I have a 1920x1200 resolution monitor here, so it does not seem to take up as much room I really like the sysinfo plugin.. Joe L.
September 15, 200817 yr BTW Joe, I have TB drives, and they appear to muck up the math in calculating totals. I think I already fixed it. The issue is in comparing strings, vs. comparing numbers. Add the line in red to the following function near the end of unmenu.awk function human_readable_number( num ) { OneThousand = OneThousand + 0 #coerce to number suffix="K" if ( num > OneThousand ) { num = num / OneThousand suffix="M" } if ( num > OneThousand ) { num = num / OneThousand suffix="G" } if ( num > OneThousand ) { num = num / OneThousand suffix="T" } ret_val = sprintf( "%.2f%s", num, suffix) return ret_val } If you are seeing a different error, post a screen shot and whatever you think might help me. My only 1T drive is my parity drive, but my totals work, so the routine to print the human readable values should work once you convince it that OneThousand is a number, not a string. Joe L.
September 18, 200817 yr Here are a couple of easy plugins that I use. This one will give you the status of your hellaNZB download queue #ADD_ON_MENU=hellaNZB #ADD_ON_URL=hellanzb echo "<pre>" /usr/bin/hellanzb.py status The output of this looks like this 04:53PM up 04:35 downloaded 0 nzbs, 0 files, 0 segments (0 MB) ;;;; . . ... :liil ...........:..: ,._ ,._ ................... : l$$$: _.,._ _..,,._ "$$$b. "$$$b. `_..,,._ ::: : $$$$.d$$$$$$L .d$$$$$$$$L $$$$: $$$$: .d$$$$$$$$$; ::: : $$$P` T$$$$: $$$` 7$$F:$$$$ $$$ $$$: `$$$$ __ _ |_ : l$$$F $$$$ 8$$$l"""""` l$$$l l$$$l l$$$l $$$L | ) /_ |_) : $$$$: l$$$$$L `4$$$bcmang;ACID$:$$88:`4$$$bmm$$$$;. ... : ``` ```"" ``` ``` . ```. ..:::.. :..............................................: v 0 . 1 3 `:::` ` hellanzb v0.13 (config = /usr/etc/hellanzb.conf, daemonized) (unlimited.newshosting.com) Opening 8 connections... hellanzb - Now monitoring queue... Downloading: None Processing: None Queued: None This one will give you the status of your VMware server -- #ADD_ON_MENU=VMware Status #ADD_ON_URL=vmware_status echo "<pre>" /etc/rc.d/init.d/vmware status The output looks like this -- Bridged networking on /dev/vmnet0 is running Host network detection is not running Host-only networking on /dev/vmnet1 is running DHCP server on /dev/vmnet1 is running Host-only networking on /dev/vmnet8 is running DHCP server on /dev/vmnet8 is running NAT networking on /dev/vmnet8 is running Module vmmon loaded Module vmnet loaded I also made one for vmware start and vmware stop so I don't need to telnet to manage vmware. I added this line to the 10-unmenu-links.awk file -- theHTML = theHTML "<tr><td><a href=\"http://Tower/main.htm\">Standard unRAID Management Page</a></td></tr>" It gives you a quick way to get back to the standard unRAID management console. This one will output the contents of your GO script. I like a quick and safe way to see what's in there -- #ADD_ON_MENU=GO Script #ADD_ON_URL=go_script echo "<pre>" cat /boot/config/go Thanks for sharing -- being able to customize the management console is a great feature of unRAID.
September 19, 200817 yr Here is an update to the sys_info plugin. Adds commands for: * open files * loaded modules * PCI devices
September 19, 200817 yr Here are a couple of easy plugins that I use. <snip> Thanks for sharing -- being able to customize the management console is a great feature of unRAID. Thanks to you as well. I figured that people would like the plug-in feature if it was easy to use. I've got a great "User scripts" plug-in that is based on a suggestion from bubbaQ. It allows you to group all the quick little admin scripts on buttons on a single page and get rid of some of the clutter in the main menu. The button names are grabbed from the script file. The scripts themselves are in a configurable directory, but by default it is the same directory as the the other unmenu awk and cgi scripts. Give this "User-Scripts" plug-in a try. It might work well for the "commands" you created to start and stop vmware. Now, you can create buttons. User-Scripts plug-in, as suggested by bubbaQ. Note: this is a cgi script, not an awk script! cat 50-unmenu-user_scripts.cgi #ADD_ON_MENU User Scripts #ADD_ON_URL user_scripts #ADD_ON_VERSION .1 - Proof of concept version, based on great suggestion by bubbaQ if [ "$ScriptDirectory" = "" ] then ScriptDirectory="." fi if [ "$ConfigFile" = "" ] then ConfigFile="unmenu.conf" fi # user scripts are normally in the $ScriptDirectory, but this directory can be # overridden by a value in the ConfigFile. UserScriptDir=`grep "^UserScriptDirectory" "$ScriptDirectory/$ConfigFile" | sed "s/=/ /" | cut -d" " -f2-` if [ "$UserScriptDir" = "" ] then UserScriptDir="$ScriptDirectory" fi echo "Importing user-scripts from ${UserScriptDir}/" >&2 c=0 scripts=`ls "$UserScriptDir"/[0-9]*unmenu_user_script* 2>/dev/null` for a in $scripts do [ ! -x "$a" ] && continue; let c=c+1 script[$c]="$a" label[$c]=`grep "^#define USER_SCRIPT_LABEL" "$a" | cut -d" " -f3-` descr[$c]=`grep "^#define USER_SCRIPT_DESCR" "$a" | cut -d" " -f3-` #echo "imported ${label[$c]} from ${script[$c]}" >&2 done # Now for some HTML, draw the buttons echo "<hr><form method=GET><table>" i=1 while test $i -le $c do echo "<tr><td><input type=submit value=\"${label[$i]}\" name=\"command\"></td><td>${descr[$i]}</td></tr>" let i=i+1 done echo "</table></form><hr>" # now, determine if the user pressed a button submitting a form # this simple parse of $3 looks for only one parameter. # It will be the label on the button pushed. cgi_params=${3#*\?} command=${3#*\=} command=`echo "$command" | tr "+" " "` if [ "$command" != "" ] then i=1 while test $i -le $c do if [ "$command" = "${label[$i]}" ] then # here we execute the script and capture its output to be sent to the browser ${script[$i]} 2>&1 break; fi let i=i+1 done fi The scripts themselves are matched and made into buttons if they have a name matching "[0-9]*unmenu_user_script*" and are execuitable. They are executed when the button is pressed, so you now can have "Start VmWare" and "Stop VmWare" buttons. Here are two sample 'User Scripts' root@Tower:/boot# cat 10-unmenu_user_script_hello #define USER_SCRIPT_LABEL Hello World #define USER_SCRIPT_DESCR Print a famous greeting. echo "Hello World" root@Tower:/boot# cat 20-unmenu_user_script_goodbye #define USER_SCRIPT_LABEL Goodbye World #define USER_SCRIPT_DESCR Print a variation of a famous greeting #define USER_SCRIPT_DESCR written by one of the authors of "C" language. echo "Goodbye World" Note: you can have multiple USER_SCRIPT_DESCR lines. The lines are concatenated. They can contain HTML, but do not need to have any. It looks like this when you select the "User Scripts" menu choice... presenting whatever "buttons" you have defined along with their affiliated descriptions. This is the first "cgi" script that has buttons and processes the querrystring parameter passed from the browser as $3. Have fun... and thanks to bubbaQ for the suggestion. Joe L.
September 19, 200817 yr Here is an update to the sys_info plugin. Adds commands for: * open files * loaded modules * PCI devices Nicely done. One tiny improvement I made was to add a test to the "pageoptions" code near the top of the plug-in: if (system("test -f /sbin/apcaccess")==0) { pageoptions = pageoptions "<td ><input type=submit name=\"option\" value=\"UPS Status\"</td>" } The UPS button is not rendered at all unless /sbin/apcaccess exists. Thanks for contributing. Joe L.
September 19, 200817 yr Thanks... I did it the other way as I anticipate handling multiple programs for UPS status (i.e. in addition to apcaccess, such as tripplitesu and nut). Rather than not display the button, I think it would be better to just disable it.
September 19, 200817 yr Thanks... I did it the other way as I anticipate handling multiple programs for UPS status (i.e. in addition to apcaccess, such as tripplitesu and nut). Rather than not display the button, I think it would be better to just disable it. You are way ahead of me... I am not familiar with the other UPS packages... looks like you did a bit of analysis. As I already said, nice work. Joe L.
September 19, 200817 yr Here is a really neat plug-in that provides the ability to view and use the stock unRAID management pages in an unmenu plug-in. cat 999-unmenu-unraid_menu.awk BEGIN { #define ADD_ON_URL unraid_main #define ADD_ON_MENU unRAID Main #define ADD_ON_STATUS NO #define ADD_ON_TYPE awk #define ADD_ON_VERSION 1.0 - Joe L. if ( ScriptDirectory == "" ) { ScriptDirectory = "."; } if ( ConfigFile == "" ) { ConfigFile = "unmenu.conf"; } GetConfigValues(ScriptDirectory "/" ConfigFile); if ( MyHost == "" ) { MyHost = CONFIG["MyHost"] ? CONFIG["MyHost"] : getHost() } theHTML = "<br><iframe width=100% height=\"1200\" src=\"http://" MyHost "/main.htm\">" theHTML = theHTML "Sorry: your browser does not seem to support inline frames" theHTML = theHTML "</iframe>" print theHTML } function GetConfigValues(cfile) { RS="\n" while (( getline line < cfile ) > 0 ) { delete c; match( line , /^([^# \t=]+)([\t ]*)(=)([\t ]*)(.+)/, c) #print c[1,"length"] " " c[2,"length"] " " c[3,"length"] " " c[4, "length"] " " c[5, "length"] " " line if ( c[1,"length"] > 0 && c[2,"length"] > 0 && c[3,"length"] > 0 && c[4, "length"] > 0 && c[5, "length"] > 0 ) { CONFIG[substr(line,c[1,"start"],c[1,"length"])] = substr(line,c[5,"start"],c[5,"length"]) } } close(cfile); } function getHost( theHostName) { "uname -n" | getline theHostName close("uname -n") return theHostName } All the normal functions in the standard unRAID management screens are available (It is just in an inline frame), but with the additional unmenu.awk links at the top. Have fun..., Joe L. It looks like this: Edit; added missing getHost function to plug-in code.
September 20, 200817 yr First off... I love what you guys have done with unMenu. On my last reboot, my unMenu web interface stopped working. Now when I start it all I see is "e 0" in the top left corner. When I look at the source of the page it looks like this: e </BODY></HTML> 0 Does anyone have an idea what might of happend and how I can fix it. The unRAID web interface still works fine.
September 20, 200817 yr First off... I love what you guys have done with unMenu. On my last reboot, my unMenu web interface stopped working. Now when I start it all I see is "e 0" in the top left corner. When I look at the source of the page it looks like this: e </BODY></HTML> 0 Does anyone have an idea what might of happend and how I can fix it. The unRAID web interface still works fine. Whenever that happens to me, it is a syntax error that caused the unmenu.awk process to stop. what you are seeing are two "chunks" of content sent to the web-browser. Each chunk has the length, in hex notation of that chunk, followed by the content of that chunk. The "e" you are seeing equals 14 decimal, the number of characters in the next line. The "0" is the length of the final zero length chunk that indicates no more content follows. Wat is missing were the middle set of chunks that represented the content you expected. As I said, something caused the plug-in script to abort.. in my case it occurs mostly when I have a syntax error. Now you know more than most people about how content is incrementally sent to our browsers, and far more than I knew when I started this project. I'll be uploading new versions in a day or so, once I get some more functionality working on the un-assigned disk management, but you might check any error messages in the telnet session you started it in. it will usually give the line number with the problem. Instead of waiting till I am finished with the next section, to get a quick check on how we're doing with this, attached here is a new zip file with completely new versions of almost everything... a LOT has changed since the last public beta release. Note: the Disk-Management page will report that no un-assigned disks are present, even if the main page shows they are. The "Un-assigned disk" section of the disk-management page is under construction... should be ready in a day or so... if I get some time to work on it. For now, just ignore it. There is now a unmenu.conf configuration file. It is where you may make any local changes. Some of the plug-ins now look there for site-specific settings. There have been contributions by several others... mostly bubbaQ and RobJ. I try to incorporate ideas as people post them. Already, there are people writing their own plug-ins. This is really great. Biggest addition in this release is a file-browser i created. It can handle a lot of data types. We are limited by the memory we use on unRAID, so there is a file-size limit you can access through it. There is NO security except the ability to limit the directories you can browse. Again, a set of sample entries are in the unmenu.conf file, commented out. Edit as you desire in the unmenu.conf file. By default, you have access to /mnt/disk*/* and /mnt/user/* A nice addition is the ability to get to the standard unRAID management page on the unRAID Main link. You can also now supply your own links for the useful-links page... you guessed it, in the unmenu.conf file. There are examples there to edit as you desire. I created a user-Scripts plug-in, based on another suggestion from bubbaQ. It allows you to create simple shell scripts and affiliated descriptions. These are then created as "Buttons" that when pressed, are executed. The output of the executed commands is then displayed in the browser window. I supplied a "Hello World" and "Goodbye World" sample. Just name your script in a similar pattern, and you can web-enable almost anything you would run on the unix command line. I encourage the sharing of useful scripts and plug-ins. If you think writing a plug-in might be too difficult for your level of experience, share your idea for a plug-in. Everybody will benefit. Have fun. If you find any bugs, let me know. If you have ideas for improvements, share them too. To run this: un-zip and put all the files in a folder on your USB flash drive.. (I just have them all at /boot for now) log-in via telnet and change directory to that folder cd /boot Type the following command to start the unmenu.awk web-server awk -W re-interval -f unmenu.awk Using your browser on your PC, enter the following URL http://tower:8080/ Current version here: http://lime-technology.com/forum/index.php?topic=2595.msg20982#new Joe L.
September 20, 200817 yr Thanks Joe. I just did a fresh install with your latest and I'm back up and running. Strange, though, because I didn't modify anything. I'm not too sure how a syntax error could have found its way in there. I think unMENU is a truely amazing and useful addition to unRAID. Thank you so much. I used the shell version before. I don't even remember who created that. I'm assuming you. is there a 'latest' version of the shell version?
September 21, 200817 yr I think unMENU is a truely amazing and useful addition to unRAID. Thank you so much. I used the shell version before. I don't even remember who created that. I'm assuming you. is there a 'latest' version of the shell version? Yes, I created the shell version. No, there is not a "latest" version of it. I'm equally amazed by what I've been able to do with "unmenu.awk" Even with its limitations, nobody would ever guess it is an "awk" script serving up web-pages if they did not peek at the source code. Let me know what you think of the latest version... It does quite a lot now, and with everybody's ideas and contributions, will do even more in the future. I know I cannot forsee everything people will install on their unRAID server. Now, I don't need to worry. Even if their addition has a web-server of its own it can look integrated if a clone of the 999-unmenu-unraid_main.awk is made, changing the number in its name and the link it renders in the iframe. Joe L.
September 21, 200817 yr I just start to exeriment with unMENU. Wonderful addition! Do I need to run the telnet session, while browsing unMENU? So it can't run continously in the background?
September 21, 200817 yr I just start to exeriment with unMENU. Wonderful addition! Do I need to run the telnet session, while browsing unMENU? So it can't run continously in the background? unmenu.awk can run in the background.. It is just that I am constantly killing and re-starting it while developing it. It only scans for plug-ins when it first is started, so if you add a new plug-in, it will need to be killed and re-started. To run in the background, change directory to where you unzipped the files and type: nohup awk -W re-interval -f unmenu.awk >/dev/null 2>&1 & to stop it, type jobs To get the background job number... (first number on the line) Then kill %job to stop it. This is equivalent to typing Control-C if it was not run as a background task. Since it will usually be job number 1, most of the time, you will type: kill %1 So, for most people, it will look like this: root@Tower:/boot# nohup awk -W re-interval -f unmenu.awk >/dev/null 2>&1 & [1] 22393 root@Tower:/boot# jobs [1]+ Running nohup awk -W re-interval -f unmenu.awk >/dev/null 2>&1 & root@Tower:/boot# kill %1 root@Tower:/boot# [1]+ Terminated nohup awk -W re-interval -f unmenu.awk >/dev/null 2>&1 root@Tower:/boot# Have fun... Joe L.
September 22, 200817 yr Joe, thanks a million! Unmenu made adding a new Seagate 1TB drive to my array ( and then returning it to Newegg based on SMART testing) almost too easy.
Archived
This topic is now archived and is closed to further replies.