<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.qnap.com/mediawiki/index.php?title=Category:HDD_Monitoring_with_rrdtool&amp;feed=atom&amp;action=history</id>
	<title>Category:HDD Monitoring with rrdtool - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.qnap.com/mediawiki/index.php?title=Category:HDD_Monitoring_with_rrdtool&amp;feed=atom&amp;action=history"/>
	<link rel="alternate" type="text/html" href="https://wiki.qnap.com/mediawiki/index.php?title=Category:HDD_Monitoring_with_rrdtool&amp;action=history"/>
	<updated>2022-08-31T22:24:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>https://wiki.qnap.com/mediawiki/index.php?title=Category:HDD_Monitoring_with_rrdtool&amp;diff=916&amp;oldid=prev</id>
		<title>Glenn: catchg</title>
		<link rel="alternate" type="text/html" href="https://wiki.qnap.com/mediawiki/index.php?title=Category:HDD_Monitoring_with_rrdtool&amp;diff=916&amp;oldid=prev"/>
		<updated>2015-10-26T09:19:15Z</updated>

		<summary type="html">&lt;p&gt;catchg&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:19, 26 October 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l267&quot; &gt;Line 267:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 267:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Enjoy&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Enjoy&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Categories&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Adding new services&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Glenn</name></author>
	</entry>
	<entry>
		<id>https://wiki.qnap.com/mediawiki/index.php?title=Category:HDD_Monitoring_with_rrdtool&amp;diff=900&amp;oldid=prev</id>
		<title>Glenn: +cat</title>
		<link rel="alternate" type="text/html" href="https://wiki.qnap.com/mediawiki/index.php?title=Category:HDD_Monitoring_with_rrdtool&amp;diff=900&amp;oldid=prev"/>
		<updated>2015-10-26T08:50:40Z</updated>

		<summary type="html">&lt;p&gt;+cat&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 08:50, 26 October 2015&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l266&quot; &gt;Line 266:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 266:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;https://&amp;amp;lt;QNAP&amp;amp;gt;:8081/smartrrd&amp;lt;/pre&amp;gt;  &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;https://&amp;amp;lt;QNAP&amp;amp;gt;:8081/smartrrd&amp;lt;/pre&amp;gt;  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Enjoy&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Enjoy&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Categories]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Glenn</name></author>
	</entry>
	<entry>
		<id>https://wiki.qnap.com/mediawiki/index.php?title=Category:HDD_Monitoring_with_rrdtool&amp;diff=76&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;== Introduction  ==  This HowTo explains how you can set up continuous monitoring of all your harddisks. It   *uses smartmonctl  *writes every 30 min the current status to a r...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.qnap.com/mediawiki/index.php?title=Category:HDD_Monitoring_with_rrdtool&amp;diff=76&amp;oldid=prev"/>
		<updated>2015-06-16T09:35:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Introduction  ==  This HowTo explains how you can set up continuous monitoring of all your harddisks. It   *uses smartmonctl  *writes every 30 min the current status to a r...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Introduction  ==&lt;br /&gt;
&lt;br /&gt;
This HowTo explains how you can set up continuous monitoring of all your harddisks. It &lt;br /&gt;
&lt;br /&gt;
*uses smartmonctl &lt;br /&gt;
*writes every 30 min the current status to a round robin database using rrdtool &lt;br /&gt;
*generates for each S.M.A.R.T parameter 3 charts showing the status of the last week / last month / last year&lt;br /&gt;
&lt;br /&gt;
[[Image:Smartrrd.jpg|400px|Smartrrd.jpg]] &lt;br /&gt;
&lt;br /&gt;
== Install Packages  ==&lt;br /&gt;
&lt;br /&gt;
*if not yet done, install Optware IPGK via the QNAP Web Administration site (under &amp;quot;App Center&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
'''Alternative 1:''' &lt;br /&gt;
&lt;br /&gt;
*launch Optware via the App Center (will open &amp;quot;The ipkg web frontend&amp;quot;) &lt;br /&gt;
*to update the catalogue, select &amp;quot;Sync packages&amp;quot; -&amp;amp;gt; yes, then press Submit &lt;br /&gt;
*filter to &amp;quot;smartmontools&amp;quot; and press Submit then click &amp;quot;install&amp;quot; &lt;br /&gt;
*filter to &amp;quot;rrdtool&amp;quot; and press Submit then click &amp;quot;install&amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''Alternative 2:''' &lt;br /&gt;
&lt;br /&gt;
Log into your QNAP with SSH. &lt;br /&gt;
&amp;lt;pre&amp;gt;# ipkg install smartmontools&lt;br /&gt;
# ipkg install rrdtool&amp;lt;/pre&amp;gt; &lt;br /&gt;
== Prepare Directories  ==&lt;br /&gt;
&amp;lt;pre&amp;gt;# mkdir /mnt/HDA_ROOT/smartrrd&lt;br /&gt;
# mkdir /share/Web/smartrrd&amp;lt;/pre&amp;gt; &lt;br /&gt;
== Install and Adopt the Script  ==&lt;br /&gt;
&lt;br /&gt;
Copy the following script to '''/mnt/HDA_ROOT/smartrrd/smartctl_all_drives.sh''' &lt;br /&gt;
&amp;lt;pre&amp;gt;#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
script_dir=$(dirname &amp;quot;${BASH_SOURCE[0]}&amp;quot;)&lt;br /&gt;
script_runtime=$(date '+%s')&lt;br /&gt;
&lt;br /&gt;
http_path=&amp;quot;/share/Web/smartrrd&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# 1   5                       29       38    44    50     57        67       76          88&lt;br /&gt;
#  +4  +24                      +9       +6    +6    +7     +10       +9       +12&lt;br /&gt;
# ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE&lt;br /&gt;
#   1 Raw_Read_Error_Rate     0x000f   114   099   006    Pre-fail  Always       -       72984072&lt;br /&gt;
smart_regex=&amp;quot;^(.{4})(.{24})(.{9})(.{6})(.{6})(.{7})(.{10})(.{9})(.{12})(.+)$&amp;quot;&lt;br /&gt;
&lt;br /&gt;
. $script_dir/smartctl_all_drives.conf&lt;br /&gt;
&lt;br /&gt;
declare -a ATTRIBUTES&lt;br /&gt;
&lt;br /&gt;
IFS='&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
# Get data for all drives from smartmontools and store it in an array ATTRIBUTES&lt;br /&gt;
# Later on this will allow to write values from all drives at once to the *.rrd file&lt;br /&gt;
&lt;br /&gt;
for disk in /dev/sd[a-d]&lt;br /&gt;
do&lt;br /&gt;
  for oneline in $(smartctl -d ata -A $disk | grep 'Always\|Offline')&lt;br /&gt;
  do&lt;br /&gt;
    [[ $oneline =~ $smart_regex ]]&lt;br /&gt;
&lt;br /&gt;
    smart_DISK=${disk:(-3)}&lt;br /&gt;
    smart_ID=${BASH_REMATCH[1]// /}&lt;br /&gt;
    smart_ID3=$(printf &amp;quot;%03d&amp;quot; $smart_ID)&lt;br /&gt;
&lt;br /&gt;
    smart_ATTRIBUTE_NAME=${BASH_REMATCH[2]// /}&lt;br /&gt;
    smart_FLAG=${BASH_REMATCH[3]// /}&lt;br /&gt;
    smart_VALUE=${BASH_REMATCH[4]// /}&lt;br /&gt;
    smart_WORST=${BASH_REMATCH[5]// /}&lt;br /&gt;
    smart_THRESH=${BASH_REMATCH[6]// /}&lt;br /&gt;
    smart_TYPE=${BASH_REMATCH[7]// /}&lt;br /&gt;
    smart_UPDATED=${BASH_REMATCH[8]// /}&lt;br /&gt;
    smart_WHEN_FAILED=${BASH_REMATCH[9]// /}&lt;br /&gt;
    smart_RAW_VALUE=${BASH_REMATCH[10]%(*} # remove trailing &amp;quot;(...&amp;quot; string manipulation&lt;br /&gt;
    smart_RAW_VALUE=${smart_RAW_VALUE// /}&lt;br /&gt;
&lt;br /&gt;
    # populate attributes array&lt;br /&gt;
    ATTRIBUTES[$smart_ID]+=&amp;quot;$smart_DISK#$smart_RAW_VALUE &amp;quot;&lt;br /&gt;
&lt;br /&gt;
  done&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
IFS=' '&lt;br /&gt;
&lt;br /&gt;
# Scan array ATTRIBUTES&amp;amp;nbsp;for values and if existing, write all values to *.rrd&lt;br /&gt;
# If necessary (e.g. when run for the first time), create the database&lt;br /&gt;
&lt;br /&gt;
for i in {1..256}&lt;br /&gt;
do&lt;br /&gt;
  if [[ ${ATTRIBUTES[$i]} ]]; then&lt;br /&gt;
    smart_ID3=$(printf &amp;quot;%03d&amp;quot; $i)&lt;br /&gt;
&lt;br /&gt;
    rrd_ds=&amp;quot;&amp;quot;&lt;br /&gt;
    rrd_value=&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    for disk_rawvalue in ${ATTRIBUTES[$i]}&lt;br /&gt;
    do&lt;br /&gt;
      rrd_ds+=${disk_rawvalue%'#'*}:&lt;br /&gt;
      rrd_value+=${disk_rawvalue#*'#'}:&lt;br /&gt;
    done&lt;br /&gt;
&lt;br /&gt;
    rrd_ds=${rrd_ds%:}&lt;br /&gt;
    rrd_value=${rrd_value%:}&lt;br /&gt;
&lt;br /&gt;
    # create RRD if not yet exist&lt;br /&gt;
    if [[&amp;amp;nbsp;! -f $script_dir/rrd/$smart_ID3.rrd ]]; then&lt;br /&gt;
      rrdtool create &amp;quot;$script_dir/rrd/$smart_ID3.rrd&amp;quot; \&lt;br /&gt;
        --step 1800 \&lt;br /&gt;
        DS:sda:GAUGE:3600:0:U \&lt;br /&gt;
        DS:sdb:GAUGE:3600:0:U \&lt;br /&gt;
        DS:sdc:GAUGE:3600:0:U \&lt;br /&gt;
        DS:sdd:GAUGE:3600:0:U \&lt;br /&gt;
        RRA:MAX:0.5:1:336 \&lt;br /&gt;
        RRA:MAX:0.5:2:744 \&lt;br /&gt;
        RRA:MAX:0.5:48:365&lt;br /&gt;
&lt;br /&gt;
        # RRA:MAX:0.5:1:336  -&amp;amp;gt; every 30min for 2x24x7 times (one week in 30min interval)&lt;br /&gt;
        # RRA:MAX:0.5:2:744  -&amp;amp;gt; every second 30min for 24x31 times (one month in 1h interval)&lt;br /&gt;
        # RRA:MAX:0.5:48:365 -&amp;amp;gt; every 48th 30min for 365 times (one year in 1day interval)&lt;br /&gt;
    fi&lt;br /&gt;
&lt;br /&gt;
    rrdtool update &amp;quot;$script_dir/rrd/$smart_ID3.rrd&amp;quot; -t $rrd_ds $script_runtime:$rrd_value&lt;br /&gt;
&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Create charts for all existing *.rrd file&lt;br /&gt;
&lt;br /&gt;
for filename in $script_dir/rrd/*.rrd&lt;br /&gt;
do&lt;br /&gt;
  smart_ID3=${filename%'.'*}&lt;br /&gt;
  smart_ID3=${smart_ID3#*'/'rrd'/'}&lt;br /&gt;
  smart_ID=$(echo $smart_ID3 | sed 's/^0*//')&lt;br /&gt;
&lt;br /&gt;
  rrdtool graph &amp;quot;$http_path/${smart_ID3}_week.png&amp;quot; -a PNG --title=&amp;quot;${smart_attributes[$smart_ID]}&amp;quot; \&lt;br /&gt;
    --vertical-label &amp;quot;RAW_VALUE&amp;quot; --start end-1w --end $script_runtime \&lt;br /&gt;
    DEF:a=$filename:sda:MAX \&lt;br /&gt;
    DEF:b=$filename:sdb:MAX \&lt;br /&gt;
    DEF:c=$filename:sdc:MAX \&lt;br /&gt;
    DEF:d=$filename:sdd:MAX \&lt;br /&gt;
    LINE1:a#FF0000:&amp;quot;/dev/sda&amp;quot; GPRINT:a:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s&amp;quot; \&lt;br /&gt;
    LINE2:b#800000:&amp;quot;/dev/sdb&amp;quot; GPRINT:b:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s\n&amp;quot; \&lt;br /&gt;
    LINE3:c#00FF00:&amp;quot;/dev/sdc&amp;quot; GPRINT:c:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s&amp;quot; \&lt;br /&gt;
    LINE4:d#0000FF:&amp;quot;/dev/sdd&amp;quot; GPRINT:d:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  rrdtool graph &amp;quot;$http_path/${smart_ID3}_month.png&amp;quot; -a PNG --title=&amp;quot;${smart_attributes[$smart_ID]}&amp;quot; \&lt;br /&gt;
    --vertical-label &amp;quot;RAW_VALUE&amp;quot; --start end-1m --end $script_runtime \&lt;br /&gt;
    DEF:a=$filename:sda:MAX \&lt;br /&gt;
    DEF:b=$filename:sdb:MAX \&lt;br /&gt;
    DEF:c=$filename:sdc:MAX \&lt;br /&gt;
    DEF:d=$filename:sdd:MAX \&lt;br /&gt;
    LINE1:a#FF0000:&amp;quot;/dev/sda&amp;quot; GPRINT:a:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s&amp;quot; \&lt;br /&gt;
    LINE2:b#800000:&amp;quot;/dev/sdb&amp;quot; GPRINT:b:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s\n&amp;quot; \&lt;br /&gt;
    LINE3:c#00FF00:&amp;quot;/dev/sdc&amp;quot; GPRINT:c:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s&amp;quot; \&lt;br /&gt;
    LINE4:d#0000FF:&amp;quot;/dev/sdd&amp;quot; GPRINT:d:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
  rrdtool graph &amp;quot;$http_path/${smart_ID3}_year.png&amp;quot; -a PNG --title=&amp;quot;${smart_attributes[$smart_ID]}&amp;quot; \&lt;br /&gt;
    --vertical-label &amp;quot;RAW_VALUE&amp;quot; --start end-1y --end $script_runtime \&lt;br /&gt;
    DEF:a=$filename:sda:MAX \&lt;br /&gt;
    DEF:b=$filename:sdb:MAX \&lt;br /&gt;
    DEF:c=$filename:sdc:MAX \&lt;br /&gt;
    DEF:d=$filename:sdd:MAX \&lt;br /&gt;
    LINE1:a#FF0000:&amp;quot;/dev/sda&amp;quot; GPRINT:a:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s&amp;quot; \&lt;br /&gt;
    LINE2:b#800000:&amp;quot;/dev/sdb&amp;quot; GPRINT:b:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s\n&amp;quot; \&lt;br /&gt;
    LINE3:c#00FF00:&amp;quot;/dev/sdc&amp;quot; GPRINT:c:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s&amp;quot; \&lt;br /&gt;
    LINE4:d#0000FF:&amp;quot;/dev/sdd&amp;quot; GPRINT:d:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s&amp;quot;&lt;br /&gt;
&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
# Recreate index.html&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;&amp;quot; &amp;amp;gt; $http_path/index.html&lt;br /&gt;
&lt;br /&gt;
for i in {1..256}&lt;br /&gt;
do&lt;br /&gt;
  if [[ ${ATTRIBUTES[$i]} ]]; then&lt;br /&gt;
&lt;br /&gt;
    smart_ID3=$(printf &amp;quot;%03d&amp;quot; $i)&lt;br /&gt;
    echo &amp;quot;&amp;amp;lt;img src=\&amp;quot;${smart_ID3}_week.png\&amp;quot;&amp;amp;gt;&amp;amp;lt;img src=\&amp;quot;${smart_ID3}_month.png\&amp;quot;&amp;amp;gt;&amp;amp;lt;img src=\&amp;quot;${smart_ID3}_year.png\&amp;quot;&amp;amp;gt;&amp;amp;lt;br&amp;amp;gt;&amp;quot; \&lt;br /&gt;
      &amp;amp;gt;&amp;amp;gt; $http_path/index.html&lt;br /&gt;
  fi&lt;br /&gt;
done&amp;lt;/pre&amp;gt; &lt;br /&gt;
The script is designed for the '''4 drives sda, sdb, sdc, sdd'''.&amp;amp;nbsp;&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
There are several positions in the script that have to be addapted accordingly if you have more or less drives or different identifiers (e.g. sda).&amp;lt;br&amp;gt;I posted this script here with the hope that somebody would make it more flexible later .-) &lt;br /&gt;
&lt;br /&gt;
*for disk in /dev/sd[a-d] &amp;amp;nbsp;-&amp;amp;gt; change according to what &amp;quot;fdisk -l&amp;quot; says about installed drives &lt;br /&gt;
*DS:sda:GAUGE:3600:0:U -&amp;amp;gt; add/remove additional drives &lt;br /&gt;
*DEF:a=$filename:sda:MAX \ -&amp;amp;gt; add/remove additional drives &lt;br /&gt;
*LINE1:a#FF0000:&amp;quot;/dev/sda&amp;quot; GPRINT:a:LAST:&amp;quot;%6.lf&amp;amp;nbsp;%s&amp;quot; \&amp;amp;nbsp;-&amp;amp;gt; add/remove additional drives in all 3 charts (week/month/year), also '''change the color'''&lt;br /&gt;
&lt;br /&gt;
== Install Script Config File  ==&lt;br /&gt;
&lt;br /&gt;
Save the following file to '''/mnt/HDA_ROOT/smartrrd/smartctl_all_drives.conf&amp;lt;br&amp;gt;'''The array is used to create meaningful chart titles. &lt;br /&gt;
&amp;lt;pre&amp;gt;smart_attributes[1]='001 Raw_Read_Error_Rate'&lt;br /&gt;
smart_attributes[2]='002 Throughput_Performance'&lt;br /&gt;
smart_attributes[3]='003 Spin_Up_Time'&lt;br /&gt;
smart_attributes[4]='004 Start_Stop_Count'&lt;br /&gt;
smart_attributes[5]='005 Reallocated_Sector_Ct'&lt;br /&gt;
smart_attributes[7]='007 Seek_Error_Rate'&lt;br /&gt;
smart_attributes[8]='008 Seek_Time_Performance'&lt;br /&gt;
smart_attributes[9]='009 Power_On_Hours'&lt;br /&gt;
smart_attributes[10]='010 Spin_Retry_Count'&lt;br /&gt;
smart_attributes[11]='011 Calibration_Retry_Count'&lt;br /&gt;
smart_attributes[12]='012 Power_Cycle_Count'&lt;br /&gt;
smart_attributes[181]='181 Program_Fail_Cnt_Total'&lt;br /&gt;
smart_attributes[183]='183 Runtime_Bad_Block'&lt;br /&gt;
smart_attributes[184]='184 End-to-End_Error'&lt;br /&gt;
smart_attributes[187]='187 Reported_Uncorrect'&lt;br /&gt;
smart_attributes[188]='188 Command_Timeout'&lt;br /&gt;
smart_attributes[189]='189 High_Fly_Writes'&lt;br /&gt;
smart_attributes[190]='190 Airflow_Temperature_Cel'&lt;br /&gt;
#smart_attributes[190]='190&amp;amp;nbsp;??'&lt;br /&gt;
smart_attributes[191]='191 G-Sense_Error_Rate'&lt;br /&gt;
smart_attributes[192]='192 Power-Off_Retract_Count'&lt;br /&gt;
smart_attributes[193]='193 Load_Cycle_Count'&lt;br /&gt;
smart_attributes[194]='194 Temperature_Celsius'&lt;br /&gt;
smart_attributes[195]='195 Hardware_ECC_Recovered'&lt;br /&gt;
smart_attributes[196]='196 Reallocated_Event_Count'&lt;br /&gt;
smart_attributes[197]='197 Current_Pending_Sector'&lt;br /&gt;
smart_attributes[198]='198 Offline_Uncorrectable'&lt;br /&gt;
smart_attributes[199]='199 UDMA_CRC_Error_Count'&lt;br /&gt;
smart_attributes[200]='200 Multi_Zone_Error_Rate'&lt;br /&gt;
#smart_attributes[200]='200&amp;amp;nbsp;???'&lt;br /&gt;
smart_attributes[223]='223 Load_Retry_Count'&lt;br /&gt;
smart_attributes[225]='225 Load_Cycle_Count'&lt;br /&gt;
smart_attributes[240]='240 Head_Flying_Hours'&lt;br /&gt;
#smart_attributes[240]='240&amp;amp;nbsp;???'&lt;br /&gt;
smart_attributes[241]='241 Total_LBAs_Written'&lt;br /&gt;
smart_attributes[242]='242 Total_LBAs_Read'&amp;lt;/pre&amp;gt; &lt;br /&gt;
In case you miss values here, please edit this wiki page and add them above. You should identify the attribute name using &lt;br /&gt;
&amp;lt;pre&amp;gt;smartctl -d ata -A /dev/hda&amp;lt;/pre&amp;gt; &lt;br /&gt;
Unfortunately there are IDs that have multiple meanings like 190, 200, 230, 231, 232, 233, 240&amp;amp;nbsp;(see: http://en.wikipedia.org/wiki/S.M.A.R.T.)&amp;lt;br&amp;gt;In case your drives use the strings that are commented out, adapt the .conf file accordingly. &lt;br /&gt;
&lt;br /&gt;
== Setup crontab  ==&lt;br /&gt;
&amp;lt;pre&amp;gt;# vi /etc/config/crontab&lt;br /&gt;
&lt;br /&gt;
add the following line:&lt;br /&gt;
*/30 * * * * /mnt/HDA_ROOT/smartrrd/smartctl_all_drives.sh&lt;br /&gt;
&lt;br /&gt;
# crontab /etc/config/crontab&lt;br /&gt;
# /etc/init.d/crond.sh restart&amp;lt;/pre&amp;gt; &lt;br /&gt;
After 30 minutes there should be files in the directory /mnt/HDA_ROOT/smartrrd/rrd as well as in /share/Web/smartrrd &lt;br /&gt;
&lt;br /&gt;
On my system, I tested the smartctl_all_drives.sh script at the command line and got an error apparently related to rrd directory creation. Also: chmod +x the smartctl_all_drives.sh and smartctl_all_drives.conf.&amp;lt;br&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Manually creating the rrd directory seemed to make things work. &lt;br /&gt;
&amp;lt;pre&amp;gt;[/mnt/HDA_ROOT/smartrrd] # ./smartctl_all_drives.sh&lt;br /&gt;
ERROR: creating './rrd/001.rrd': No such file or directory&lt;br /&gt;
ERROR: opening './rrd/001.rrd': No such file or directory&lt;br /&gt;
..&lt;br /&gt;
[/mnt/HDA_ROOT/smartrrd] # mkdir rrd&lt;br /&gt;
[/mnt/HDA_ROOT/smartrrd] # ./smartctl_all_drives.sh&lt;br /&gt;
497x207&lt;br /&gt;
497x207&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
== Open Monitoring Website  ==&lt;br /&gt;
&lt;br /&gt;
Make sure Web Server service is enabled (Control Panel, Applications, Web Server)&amp;amp;nbsp;. &lt;br /&gt;
&lt;br /&gt;
Now you can open the monitoring site which should be available somewhere under &lt;br /&gt;
&amp;lt;pre&amp;gt;http://&amp;amp;lt;QNAP&amp;amp;gt;/smartrrd &lt;br /&gt;
https://&amp;amp;lt;QNAP&amp;amp;gt;/smartrrd&lt;br /&gt;
https://&amp;amp;lt;QNAP&amp;amp;gt;:8081/smartrrd&amp;lt;/pre&amp;gt; &lt;br /&gt;
Enjoy&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>