📄 smartd.conf.5.in
字号:
.I diminishing\- send additional warning reminder emails, after a one-day interval,then a two-day interval, then a four-day interval, and so on for eachtype of disk problem detected. Each interval is twice as long as theprevious interval.In addition, one may add zero or more of the following Directives:.I test\- send a single test emailimmediately upon\fBsmartd\fPstartup. This allows one to verify that email is delivered correctly.Note that if this Directive is used,\fBsmartd\fPwill also send the normal email warnings that were enabled with the \'\-m\' Directive,in addition to the single test email!.I exec PATH\- run the executable PATH instead of the default mail command, when\fBsmartd\fPneeds to send email. PATH must point to an executable binary file orscript.By setting PATH to point to a customized script, you can make\fBsmartd\fP perform useful tricks when a disk problem is detected(beeping the console, shutting down the machine, broadcasting warningsto all logged-in users, etc.) But please be careful. \fBsmartd\fPwill \fBblock\fP until the executable PATH returns, so if yourexecutable hangs, then \fBsmartd\fP will also hang. Some samplescripts are included in/usr/local/share/doc/smartmontools-5.1/examplescripts/.The return status of the executable is recorded by \fBsmartd\fP inSYSLOG. The executable is not expected to write to STDOUT orSTDERR. If it does, then this is interpreted as indicating thatsomething is going wrong with your executable, and a fragment of thisoutput is logged to SYSLOG to help you to understand the problem.Normally, if you wish to leave some record behind, the executableshould send mail or write to a file or device.Before running the executable, \fBsmartd\fP sets a number ofenvironment variables. These environment variables may be used tocontrol the executable\'s behavior. The environment variablesexported by \fBsmartd\fP are:.RS 7.IP \fBSMARTD_MAILER\fP 4is set to the argument of \-M exec, if present or else to \'mail\'(examples: /bin/mail, mail)..IP \fBSMARTD_DEVICE\fP 4is set to the device path (examples: /dev/hda, /dev/sdb)..IP \fBSMARTD_DEVICETYPE\fP 4is set to the device type (possible values: ata, scsi, 3ware,N, hpt,L/M/N).Here N=0,...,23 denotes the ATA disk behind a 3ware RAID controller andL/M/N denotes the SATA disk behind a HighPoint RocketRAID controller..IP \fBSMARTD_DEVICESTRING\fP 4is set to the device description. For SMARTD_DEVICETYPE of ata orscsi, this is the same as SMARTD_DEVICE. For 3ware RAID controllers,the form used is \'/dev/sdc [3ware_disk_01]\'. For HighPoint RocketRAIDcontroller, the form is \'/dev/sdd [hpt_1/1/1]\'. In these cases thedevice string contains a space and is NOT quoted. So to use$SMARTD_DEVICESTRING in a bash script you should probably enclose itin double quotes..IP \fBSMARTD_FAILTYPE\fP 4gives the reason for the warning or message email. The possible values thatit takes and their meanings are:.nf.fi\fIEmailTest\fP: this is an email test message..nf.fi\fIHealth\fP: the SMART health status indicates imminent failure..nf.fi\fIUsage\fP: a usage Attribute has failed..nf.fi\fISelfTest\fP: the number of self-test failures has increased..nf.fi\fIErrorCount\fP: the number of errors in the ATA error log has increased..nf.fi\fICurrentPendingSector\fP: one of more disk sectors could not beread and are marked to be reallocated (replaced with spare sectors)..nf.fi\fIOfflineUncorrectableSector\fP: during off\-line testing, or self\-testing,one or more disk sectors could not be read..nf.fi\fIFailedHealthCheck\fP: the SMART health status command failed..nf.fi\fIFailedReadSmartData\fP: the command to read SMART Attribute data failed..nf.fi\fIFailedReadSmartErrorLog\fP: the command to read the SMART error log failed..nf.fi\fIFailedReadSmartSelfTestLog\fP: the command to read the SMART self-test log failed..nf.fi\fIFailedOpenDevice\fP: the open() command to the device failed..IP \fBSMARTD_ADDRESS\fP 4is determined by the address argument ADD of the \'\-m\' Directive.If ADD is \fB<nomailer>\fP, then \fBSMARTD_ADDRESS\fP is not set.Otherwise, it is set to the comma-separated-list of email addressesgiven by the argument ADD, with the commas replaced by spaces(example:admin@example.com root). If more than one email address isgiven, then this string will contain space characters and is NOTquoted, so to use it in a bash script you may want to enclose it indouble quotes..IP \fBSMARTD_MESSAGE\fP 4is set to the one sentence summary warning email message string from\fBsmartd\fP. This message string contains space characters and is NOT quoted. So touse $SMARTD_MESSAGE in a bash script you should probably enclose it indouble quotes..IP \fBSMARTD_FULLMESSAGE\fP 4is set to the contents of the entire email warning message string from\fBsmartd\fP. This message string contains space and return characters and is NOT quoted. So touse $SMARTD_FULLMESSAGE in a bash script you should probably enclose it indouble quotes..IP \fBSMARTD_TFIRST\fP 4is a text string giving the time and date at which the first problemof this type was reported. This text string contains space charactersand no newlines, and is NOT quoted. For example:.nf.fiSun Feb 9 14:58:19 2003 CST.IP \fBSMARTD_TFIRSTEPOCH\fP 4is an integer, which is the unix epoch (number of seconds since Jan 1,1970) for \fBSMARTD_TFIRST\fP..RE.\" The following two lines are a workaround for a man2html bug. Please leave them..\" They define a non-existent option; useful because man2html can't correctly reset the margins..TP.B \&The shell which is used to run PATH is system-dependent. For vanillaLinux/glibc it\'s bash. For other systems, the man page for\fBpopen\fP(3) should say what shell is used.If the \'\-m ADD\' Directive is given with a normal address argument,then the executable pointed to by PATH will be run in a shell withSTDIN receiving the body of the email message, and with the samecommand-line arguments:.nf-s "$SMARTD_SUBJECT" $SMARTD_ADDRESS.fithat would normally be provided to \'mail\'. Examples include:.nf.B -m user@home -M exec /bin/mail.B -m admin@work -M exec /usr/local/bin/mailto.B -m root -M exec /Example_1/bash/script/below.fiNote that on Windows, the syntax of the \'\fBBlat\fP\' mailer isused:.nf- -q -subject "$SMARTD_SUBJECT" -to "$SMARTD_ADDRESS".fiIf the \'\-m ADD\' Directive is given with the special address argument.B <nomailer>then the executable pointed to by PATH is run in a shell with.B noSTDIN and.B nocommand-line arguments, for example:.nf.B -m <nomailer> -M exec /Example_2/bash/script/below.fiIf the executable produces any STDERR/STDOUT output, then \fBsmartd\fPassumes that something is going wrong, and a snippet of that outputwill be copied to SYSLOG. The remainder of the output is thendiscarded.Some EXAMPLES of scripts that can be used with the \'\-M exec\'Directive are given below. Some sample scripts are also included in/usr/local/share/doc/smartmontools-5.1/examplescripts/..TP.B \-fCheck for \'failure\' of any Usage Attributes. If these Attributes areless than or equal to the threshold, it does NOT indicate imminentdisk failure. It "indicates an advisory condition where the usage orage of the device has exceeded its intended design life period."[Please see the \fBsmartctl \-A\fP command-line option.].TP.B \-pReport anytime that a Prefail Attribute has changedits value since the last check, 30 minutes ago. [Please see the.B smartctl \-Acommand-line option.].TP.B \-uReport anytime that a Usage Attribute has changed its valuesince the last check, 30 minutes ago. [Please see the.B smartctl \-Acommand-line option.].TP.B \-tEquivalent to turning on the two previous flags \'\-p\' and \'\-u\'.Tracks changes in \fIall\fP device Attributes (both Prefailure andUsage). [Please see the \fBsmartctl\fP \-A command-line option.].TP.B \-i IDIgnore device Attribute number \fBID\fP when checking for failure ofUsage Attributes. \fBID\fP must be a decimal integer in the rangefrom 1 to 255. This Directive modifies the behavior of the \'\-f\'Directive and has no effect without it.This is useful, for example, if you have a very old disk and don\'twant to keep getting messages about the hours-on-lifetime Attribute(usually Attribute 9) failing. This Directive may appear multipletimes for a single device, if you want to ignore multiple Attributes..TP.B \-I IDIgnore device Attribute \fBID\fP when tracking changes in theAttribute values. \fBID\fP must be a decimal integer in the rangefrom 1 to 255. This Directive modifies the behavior of the \'\-p\',\'\-u\', and \'\-t\' tracking Directives and has no effect without oneof them.This is useful, for example, if one of the device Attributes is the disktemperature (usually Attribute 194 or 231). It\'s annoying to get reportseach time the temperature changes. This Directive may appear multipletimes for a single device, if you want to ignore multiple Attributes..TP.B \-r IDWhen tracking, report the \fIRaw\fP value of Attribute \fBID\fP alongwith its (normally reported) \fINormalized\fP value. \fBID\fP must bea decimal integer in the range from 1 to 255. This Directive modifiesthe behavior of the \'\-p\', \'\-u\', and \'\-t\' tracking Directivesand has no effect without one of them. This Directive may be givenmultiple times.A common use of this Directive is to track the device Temperature(often ID=194 or 231)..TP.B \-R IDWhen tracking, report whenever the \fIRaw\fP value of Attribute\fBID\fP changes. (Normally \fBsmartd\fP only tracks/reports changesof the \fINormalized\fP Attribute values.) \fBID\fP must be a decimalinteger in the range from 1 to 255. This Directive modifies thebehavior of the \'\-p\', \'\-u\', and \'\-t\' tracking Directives andhas no effect without one of them. This Directive may be givenmultiple times.If this Directive is given, it automatically implies the \'\-r\'Directive for the same Attribute, so that the Raw value of theAttribute is reported.A common use of this Directive is to track the device Temperature(often ID=194 or 231). It is also useful for understanding howdifferent types of system behavior affects the values of certainAttributes..TP.B \-C ID[ATA only] Report if the current number of pending sectors isnon-zero. Here \fBID\fP is the id number of the Attribute whose rawvalue is the Current Pending Sector count. The allowed range of\fBID\fP is 0 to 255 inclusive. To turn off this reporting, useID\ =\ 0. If the \fB\-C ID\fP option is not given, then it defaults to\fB\-C 197\fP (since Attribute 197 is generally used to monitorpending sectors).A pending sector is a disk sector (containing 512 bytes of your data)which the device would like to mark as ``bad" and reallocate.Typically this is because your computer tried to read that sector, andthe read failed because the data on it has been corrupted and hasinconsistent Error Checking and Correction (ECC) codes. This isimportant to know, because it means that there is some unreadable dataon the disk. The problem of figuring out what file this data belongsto is operating system and file system specific. You can typicallyforce the sector to reallocate by writing to it (translation: make thedevice substitute a spare good sector for the bad one) but at theprice of losing the 512 bytes of data stored there..TP.B \-U ID[ATA only] Report if the number of offline uncorrectable sectors isnon-zero. Here \fBID\fP is the id number of the Attribute whose rawvalue is the Offline Uncorrectable Sector count. The allowed range of\fBID\fP is 0 to 255 inclusive. To turn off this reporting, useID\ =\ 0. If the \fB\-U ID\fP option is not given, then it defaults to\fB\-U 198\fP (since Attribute 198 is generally used to monitoroffline uncorrectable sectors).An offline uncorrectable sector is a disk sector which was notreadable during an off\-line scan or a self\-test. This is importantto know, because if you have data stored in this disk sector, and youneed to read it, the read will fail. Please see the previous \'\-C\'option for more details..TP.B \-W DIFF[,INFO[,CRIT]]Report if the current temperature had changed by at least \fBDIFF\fPdegrees since last report. Report or Warn if the temperature is greateror equal than one of \fBINFO\fP or \fBCRIT\fP degrees Celsius. If thelimit \fBCRIT\fP is reached, a message with loglevel\fB\'LOG_CRITICAL\'\fP will be logged to syslog and a warning emailwill be send if '-m' is specified. If only the limit \fBINFO\fP isreached, a message with loglevel \fB\'LOG_INFO\'\fP will be logged.To disable any of the 3 reports, set the corresponding limit to 0.Trailing zero arguments may be omitted. By default, all temperaturereports are disabled (\'-W 0\').To track temperature changes of at least 2 degrees, use:.nf\fB \-W 2.fiTo log informal messages on temperatures of at least 40 degrees, use:.nf\fB \-W 0,40.fiFor warning messages/mails on temperatures of at least 45 degrees, use:.nf\fB \-W 0,0,45.fiTo combine all of the above reports, use:.nf\fB \-W 2,40,45.fiFor ATA devices, smartd interprets Attribute 194 as Temperature Celsiusby default. This can be changed to Attribute 9 or 220 by the drivedatabase or by the \'-v\' directive, see below..TP.B \-F TYPE[ATA only] Modifies the behavior of \fBsmartd\fP to compensate forsome known and understood device firmware bug. The arguments to thisDirective are exclusive, so that only the final Directive given isused. The valid values are:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -