Hi, For a long time I've had a script that will extract various data from the tape drive. This script is probably FreeBSD-specific; each OS has its own special way to talk to the device. Last night I started dumping some of these stats to a file:
2007/10/09.18:50 DLT7000-002 281 2007/10/09.18:53 DLT7000-002 284 2007/10/09.18:55 DLT7000-002 284 2007/10/10.01:10 DLT7000-002 281 2007/10/10.01:10 DLT7000-002 281 2007/10/10.01:10 DLT7000-002 281 2007/10/10.01:13 DLT7000-002 281 2007/10/10.01:13 DLT7000-002 281 2007/10/10.01:29 DLT7000-002 281 2007/10/10.02:00 DLT7000-002 276 2007/10/10.03:19 DLT7000-002 276 2007/10/10.03:20 DLT7000-002 275 The fields are: timestamp, label, corrected errors per GB. Using gnuplot, I created this graph of the above data: http://www.langille.org/tmp/tape-stats.png Here are some of the stats I can grab: $ sudo ~/bin/dlt-read sa0 The tape is 'sa0' Corrected errors with substantial delay: 0 Corrected errors with possible delay : 0 Total errors : 0 Total errors corrected : 0 Total times correction algorithm used : 0 Total bytes processed : 494880 Total corrected errors / GB : 0 Total uncorrected errors : 0 Read compression ratio : 600% On tape Mbytes read : 0 On tape kbytes read residual : 22197 $ sudo ~/bin/dlt-write sa0 The tape is 'sa0' Corrected errors with substantial delay: 0 Corrected errors with possible delay : 0 Total errors : 9881 Total errors corrected : 9881 Total times correction algorithm used : 0 Total bytes processed : 38506160560 Total corrected errors / GB : 275 Total uncorrected errors : 0 Write compression ratio : 265% Host requested Mbytes written : 76981 Host requested kbytes written residual : 468992 On tape Mbytes written : 29103 On tape kbytes written residual : 0 Anything can be plotted easily enough. I should really grab all these stats and put them into the file. The gnuplot script used to create that graph is: set terminal png set output 'tape-stats.png' set xdata time set timefmt "%Y/%m/%d.%H:%M" set xrange ["2007/10/09.18:00":"2007/10/10.04:00"] set yrange [270:290] set format x "%H:%M" set timestamp "Graph created: %Y/%m/%d %H:%M" plot "/home/dan/bacula/dlt-statistics" using 1:3 with linespoints \ title 'Corrected Errors/GB' The contents of /home/dan/bacula/dlt-statistics is accumulated through this RunAfter script (be aware of line-wrapping in this email): $ cat /home/dan/bin/dlt-stats #!/bin/sh . dlt-functions CONSOLE=/usr/local/sbin/bconsole # Grab the stats for the current DLT tape ERRORS_PER_GB=`sudo /home/dan/bin/dlt-write sa0 | grep 'Total corrected errors / GB' | awk '{print $7}'` #echo "Errors per GB is '${ERRORS_PER_GB}'" # What tape is now in the tape drive? # Get the status of the storage device STATUS=`echo 'status storage=DLT' | bconsole | egrep 'Device "DLT" \(/dev/nsa0\) is mounted with Volume=".*" Pool=".*"'` # Get the line with the VOLUME on it #echo 'STATUS is ' . ${STATUS} VOLUMEPHRASE=`echo ${STATUS} | awk '{print $7}'` VOLUME=`echo ${VOLUMEPHRASE} | sed -e 's:Volume="::g' -e 's:"::g'` TIMESTAMP=`date "+%Y/%m/%d%.%H:%M"` #echo ${VOLUME} echo -e "${TIMESTAMP}\t${VOLUME}\t${ERRORS_PER_GB}" >> /home/dan/bacula/dlt-statistics The dlt-functions file is about 150 lines and uses camcontrol to send just the right commands to the device. For example: camcontrol cmd $tape -v -t 3 -c "4d 0 72 0 0 0 0 0 4c 0" -i 76 ... etc -- Dan Langille - http://www.langille.org/ Available for hire: http://www.freebsddiary.org/dan_langille.php ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users