bubbaQ Posted March 15, 2010 Share Posted March 15, 2010 While working on the temperature-based fan control and the code to display info on the Matrix Display, I needed to collect several pieces of information about the status of the unRAID server. Once I had the information I needed, I realized that it was going to be easy to add additional pieces of information to the list, and it would be useful as a stand-alone application. So I give you .... unraid_info version 0.0.8-Beta Download link is: http://www.tcpatools.com/bubba/unraid_info. I realize most if not all of these pieces of info could be acquired with shell scripts and awk. However, I see several benefits to doing it this way: - it is a single command and a single file so no need to manage a bunch of scripts from different authors. - it’s fast.... written in C. - it is self contained, and does not rely on smartctl, hdparm, df, or any external command for disk info or SMART. (It does use lsof for counting open files however.) - it is easily modified using the classes I developed. I have a table of drive models that can return SMART data like temperature when spun down, so you can get the maximum amount of information without spinning up drives. So far, I have the following parameters: -m --max_temp return the maximum temp of all drives in the array -a --max_temp_all return the maximum temp of all drives in the system, including those not in the array -M --max_temp_disk return the disk number with maximum temp of all drives in the array -D --max_temp_dev return the device with maximum temp of all drives in the array -t --total_space return total space on the array (in KB) -T --table print table of all drives -f --freespace return the total freespace on the array (in KB) -F --freedisk return the largest freespace on one disk (in KB) -P --freedisk_disk return the disk number with the largest freespace -s --status Array status (right now, only returns OK or STOPPED, but I will add more) -z --delimiter Delimiter character to use if you request multiple pieces of information (defaults to an empty space). -c --config path to configuration file (more later) -o --openfiles number of open files on the array -w --wakeup force drives to wake up and report SMART -S --summary print a summary of the array status -X --xtest test drives for ability to return SMART when spun down -p --parity_days days since last parity check Note if you want to use the -w or -V switches, you need to put them first... or at least before any switches that create output like -S In addition to the above, the following directives are available for debugging -d --dump dump all the internal info (for debugging) -h --help display usage -v --version version information so “unraid_info -m” would return 31 where the temperature of the hottest drive is 31. and "unraid_info -m -M -D -f -s" would return 31 3 /dev/sdc 2345678999 OK 31..... temp of hottest disk 3 ...... disk 3 is hottest /dev/sdc ..... /dev/sdc is hottest (i.e. disk 3 is /dev/sdc) 2345678999 ..... there are 2,345,678,900 KB free (2.3 GB) free on the whole array OK ..... array status is OK The default shown in the above example is to be "quiet" that is, to report just raw numbers. If you want human-readable results, use -V --Verbose human-readable output "unraid_info -f" will return 504023312 "unraid_info -V -f" will return Total Free on Array: 504,023,312 KB (480.674 GB) So is there any interest in expanding this to other parameters? Some suggestions have been things like reporting which disk is the oldest, and how old it is, freespace based on user-shares, and unRAID version. Comments? ================Updates======================= 0.0.8-Beta Added more drives to list of drive models that can return SMART info when spun down Added spin status summary line to Array Summary report. Added open file count to Array Summary report. Added -h help to get usage information Added -o option to report count of open files that will block array shutdown. 0.0.7-Beta Added -X switch to run a test on the array drives to determine which ones can return SMART data when spun down. 0.0.6-Beta Added -w switch to wakeup all drives that will not return smart when spun down. Added a list of any disks with problems when array status is anything other than OK. Fixed bug in determining ability of a disk outside the array to return SMART when spun down 0.0.5-Beta Added "read_smart_if_spun_down" flag to disks outside the array. Added -T to print a table of drives Added a note to status output if any array drives did not return SMART data. Changed format of summary for info for disks outside the array. Changes format of summary for info. 0.0.4-Beta Added -S option to print array summary -s option now working with several array status codes implemented 0.0.3-Beta Added commafy output for long numbers. Added drive age calculation, and determination of "oldest" drive based on power-on hours (SMART parameter ID 9). Added -a option to report highest temperature of all drives in the system rather than just the highest temperature of a drive in the array. Corrected bug in calculating number of days since last parity check. 0.0.2-Beta Changed disk sizes and accumulators to unsigned long long (double long ints) which is typedefed as bigint Quote Link to comment
Joe L. Posted March 15, 2010 Share Posted March 15, 2010 An equally interesting value you probably already have, but are not able display with the parameters so far is: the largest free space on a single drive. You may have 10 Gig free in total, but the largest file you can create is 3Gig, since that is the largest free space on a single drive.. Quote Link to comment
xamindar Posted March 15, 2010 Share Posted March 15, 2010 So I give you .... unraid_info Where? I don't see it. I have a table of drive models that can return SMART data like temperature when spun down, so you can get the maximum amount of information without spinning up drives. Really nice, is this table a text file that can be added to? Also, you mentioned in the other thread of having a way to adjust temperatures of drives that report wrong (like the samsung ones that report about 15 degrees less than it really is). Will there be a way to specify an automatic adjustment for specific drive models as well? So far, I have the following parameters: -m -max_temp return the maximum temp of all drives in the array -a -max_temp_all return the maximum temp of all drives in the system, including those not in the array Nice, I could probably use this in my fan script instead of the smartctl/hdparm/loops I currently have in it. So is there any interest in expanding this to other parameters? Some suggestions have been things like reporting which disk is the oldest, and how old it is, freespace based on user-shares, and unRAID version. Comments? Maybe add an option to tell when the last parity check was? Then we could check and run a parity check after a certain amount of time has passed. I haven't looked around so maybe this has been done already. Quote Link to comment
purko Posted March 15, 2010 Share Posted March 15, 2010 Array status (right now, only returns OK or STOPPED, but I will add more) STOPPING would be useful. Quote Link to comment
purko Posted March 15, 2010 Share Posted March 15, 2010 Comments? How about a version as a daemon? With logging to a file when a certain parameter exceeds a preconfigured treshold? Quote Link to comment
bubbaQ Posted March 15, 2010 Author Share Posted March 15, 2010 the largest free space on a single drive. Yes, that is already there... along with which drive has that largest free space. Where? I don't see it. It's not quite ready yet. Will there be a way to specify an automatic adjustment for specific drive models as well? It will use the config file mentioned in the other thread, so there will be some ability... exactly how I haven't decided yet. Maybe add an option to tell when the last parity check was? Good idea. Quote Link to comment
bubbaQ Posted March 15, 2010 Author Share Posted March 15, 2010 Added: -F -freedisk return the largest freespace on one disk (in KB) -P -freedisk_disk return the disk number with the largest freespace -o -openfiles number of open files on the array -p -parity_days days since last parity check Quote Link to comment
bubbaQ Posted March 15, 2010 Author Share Posted March 15, 2010 Any other suggestions for status, other than: OK - all ok and running STOPPED - all OK but stopped DEGRADED - 1 disk down or missing, but running NOPARITY - partiy down or missing FAILED - 2 or more failed or missing disks. Quote Link to comment
Joe L. Posted March 15, 2010 Share Posted March 15, 2010 Any other suggestions for status, other than: OK - all ok and running STOPPED - all OK but stopped DEGRADED - 1 disk down or missing, but running NOPARITY - partiy down or missing FAILED - 2 or more failed or missing disks. The possible states are in the md source code header file. You probably need one for when you are rebuilding a disk. Joe L. Quote Link to comment
queeg Posted March 15, 2010 Share Posted March 15, 2010 How about spunup or spundown status for a single drive or all drives? Quote Link to comment
Stokkes Posted March 16, 2010 Share Posted March 16, 2010 Nice job bubba.. very useful tool. Quote Link to comment
bubbaQ Posted March 16, 2010 Author Share Posted March 16, 2010 How about spunup or spundown status for a single drive or all drives? Already in there -- just need to designate a parameter to print it. ... but that is probably easier done with a simple hdparm command for a single drive. My concept of unraid_info, it to give you information about the "array" and not individual drives except where relevant to the whole array (i.e. hottest, largest, oldest, etc) Quote Link to comment
Joe L. Posted March 16, 2010 Share Posted March 16, 2010 How about spunup or spundown status for a single drive or all drives? Already in there -- just need to designate a parameter to print it. ... but that is probably easier done with a simple hdparm command for a single drive. My concept of unraid_info, it to give you information about the "array" and not individual drives except where relevant to the whole array (i.e. hottest, largest, oldest, etc) You can also get easily "spin status" from the mdcmd output /root/mdcmd status | grep rdevLastIO Drives with a "0" value are not spinning. Drives with a large number (seconds since Jan 1st, 1970) are spinning. You can use the attached script to tell how long your disks that are spinning have been idle. disks_spin_status.zip Quote Link to comment
purko Posted March 16, 2010 Share Posted March 16, 2010 Any other suggestions for status, other than: OK - all ok and running STOPPED - all OK but stopped DEGRADED - 1 disk down or missing, but running NOPARITY - partiy down or missing FAILED - 2 or more failed or missing disks. Earlier I suggested STOPPING... That would be the situation when emhttp has started trying to umount disks, but mdcmd status is still showing STARTED. An easy way to detect that situation would be highly useful. --- Would have been nice is mdcmd itself switched its status info to STOPPING upon the beginning of stop-array procedures. Or at least a simple unambiguous line in the syslog to that effect. In fact, a simple unambiguous line in the syslog would be nicer, because then we won't need to be polling mdcmd or unraid_info. Quote Link to comment
bubbaQ Posted March 16, 2010 Author Share Posted March 16, 2010 Earlier I suggested STOPPING... I don't know of any reliable way to determine the array is in the process of "stopping." Quote Link to comment
Joe L. Posted March 16, 2010 Share Posted March 16, 2010 Any other suggestions for status, other than: OK - all ok and running STOPPED - all OK but stopped DEGRADED - 1 disk down or missing, but running NOPARITY - partiy down or missing FAILED - 2 or more failed or missing disks. Earlier I suggested STOPPING... That would be the situation when emhttp has started trying to umount disks, but mdcmd status is still showing STARTED. An easy way to detect that situation would be highly useful. --- Would have been nice is mdcmd itself switched its status info to STOPPING upon the beginning of stop-array procedures. Or at least a simple unambiguous line in syslog to that effect. unRAID does not provide such a status anywhere... so he cannot provide such a state. Not yet. In 5.0 we are hoping for the pre-array-stop and post-array-start event triggers. Quote Link to comment
Joe L. Posted March 16, 2010 Share Posted March 16, 2010 In fact, a simple unambiguous line in the syslog would be nicer, because then we won't need to be polling mdcmd or unraid_info. Yes, but then you would be polling the syslog. (where the line would potentially be at the end of a file many megabytes in size and constantly growing) The best solution is a trigger FROM the API to emhttp that does not yet exist. That way no polling is needed at all. As of today, anything we write we must poll and attempt to infer when the array is starting and stopping. Quote Link to comment
purko Posted March 16, 2010 Share Posted March 16, 2010 In fact, a simple unambiguous line in the syslog would be nicer, because then we won't need to be polling mdcmd or unraid_info. Yes, but then you would be polling the syslog. (where the line would potentially be at the end of a file many megabytes in size and constantly growing) The best solution is a trigger FROM the API to emhttp that does not yet exist. That way no polling is needed at all. As of today, anything we write we must poll and attempt to infer when the array is starting and stopping. Joe, you're right. Of course. Watching the syslog is indeed polling. I misspoke. What I'm currently doing is watching for the following two conditions: 1) emhttp logs a umount command, 2) mdcmd status is showing STARTED. With 1) and 2) together, it can only mean that the process of stopping has begun, so I suspend all my activities that would prevent the array from stopping. Quote Link to comment
bubbaQ Posted March 16, 2010 Author Share Posted March 16, 2010 ...AND you have to poll the log for a number of SUBSEQUENT events, such as reloading emhttp, restarting the array, etc.,... It get's quite messy quickly. Quote Link to comment
unraided Posted March 17, 2010 Share Posted March 17, 2010 Hi 'bubbaQ'. I think your application is the answer to my question tto a thread that I posted earlier, though I'm question the following: 1). Will this support multiple Dot Matrix displays, ie: 16x2, 20x2, 20x4, etc... & 2). What interfaces are you planning to support, Serial, Parallel, USB, all of the interfaces mentioned? I'd be really interested in the progress of this and would like to trail this out too. Thanks. Quote Link to comment
bubbaQ Posted March 18, 2010 Author Share Posted March 18, 2010 It is not just a question of size of display and port... each different manufacturer's display takes different commands. I may experiment with LCDC to see it that may be a better solution. Note this thread is for the unraid_info application -- a command line interface to easily getting useful information about the server. The application for fan control is being discussed in another thread. Quote Link to comment
bubbaQ Posted March 18, 2010 Author Share Posted March 18, 2010 Made all the long parameters take the -- Added a --Verbose option to make output human-readable. But you should make it the first option on the command line if you use it. Added -t to show total disk space on array. Note the --dump option is always verbose. Quote Link to comment
bubbaQ Posted March 18, 2010 Author Share Posted March 18, 2010 unraid_info version 0.0.2-Beta is posted for download... see the OP. I am also adding an option to report the age and identification of the oldest drive based on power-on hours. Quote Link to comment
bubbaQ Posted March 18, 2010 Author Share Posted March 18, 2010 unraid_info version 0.0.3-Beta is posted for download... see the OP. The -a options now works, returning the max temperature from all drives in the system, not just the max temperature of the array drives. I also posted the source at http://www.tcpatools.com/bubba/unraid_info.cpp Quote Link to comment
bubbaQ Posted March 19, 2010 Author Share Posted March 19, 2010 unraid_info version 0.0.4-Beta is posted for download... see the OP. This version adds the -S option for a summary report, which is also the default output if unraid_info is run with no parameters. Sample output: ================== unRAID Server Summary ================== Array State: STARTED Array Status: OK Total Space on Array: 6,251,307,768 KB (5961.711 GB) Total Free on Array: 317,675,600 KB (302.959 GB) Percent Free: 5.08% Largest Freespace: 262,949,040 KB (250.768 GB) on disk 8 Last parity check: 58 days ago Hottest array temp: 29° (disk 9) WDC WD10EACS-00ZJB0 Longest running disk: disk 0 (19,010 hours / 2.17 years) There are also 2 other disk devices not in the array (/dev/hda /dev/sda ) Highest temperature of a disk device not in the array is: 30 Quote Link to comment
Recommended Posts
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.