From: Bruce A. <ba...@gr...> - 2004-01-28 21:27:44
|
Hi Hugh, > Sorry for asking this again but I'm a bit confused with the return value > of the smart command line. You mean 'the smartctl command line'? From the man page: RETURN VALUES The return values of smartctl are defined by a bit- mask. If all is well with the disk, the return value (exit status) of smartctl is 0 (all bits turned off). If a problem occurs, or an error, potential error, or fault is detected, then a non- zero status is returned. In this case, the eight different bits in the return value have the follow- ing meanings: Bit 0: Command line did not parse. Bit 1: Device open failed, or device did not return an IDENTIFY DEVICE structure. Bit 2: Some SMART command to the disk failed, or there was a checksum error in a SMART data structure (see '-b' option above). Bit 3: SMART status check returned "DISK FAILING". Bit 4: SMART status check returned "DISK OK" but we found prefail Attributes <= threshold. Bit 5: SMART status check returned "DISK OK" but we found that some (usage or prefail) Attributes have been <= threshold at some time in the past. Bit 6: The device error log contains records of errors. Bit 7: The device self-test log contains records of errors. To test within the shell for whether or not the different bits are turned on or off, you can use the following type of construction (this is bash syntax): smartstat=$(($? & 8)) This looks at only at bit 3 of the exit sta- tus $? (since 8=2^3). The shell variable $smartstat will be nonzero if SMART status check returned "disk failing" and zero oth- erwise. > I'm getting the following return values when I use the command line with > the like this system "/usr/sbin/smartctl -q silent -a -d 3ware,$j > /dev/sd$k"; > > I get the following return codes: > > 0 -> everything is ok with the $j connected to the 3ware controller card > 2 -> Device open failed, or device did not return an IDENTIFY DEVICE > structure. > 4 -> Some SMART command to the disk failed, or there was a checksum > error in a SMART > data structure > 64 -> The device error log contains records of errors. > > > Is my understanding of the return code correct??? Yes! > How can I determine what was the command to the disk that failed??? My > 3ware controller driver for Redhat is the version 1.02.00.036. You'll have to turn off the --quiet option of smartctl to see what command failed. (Unfortunately the exit status of smartctl is only 8 bits, so it's impossible to get very much detailed information into it.) Cheers, Bruce Bruce > Hi, > > > Can I then ask you shouldn't the bit 4 or 5 of the return value be set > in the case of everything is OK??? Meaning that the return value should > be 16 (bit 4 on 2^4) or 32 (bit 5 on > 2^5) ??? > > > Bit 4: SMART status check returned "DISK OK" but we found > prefail > Attributes <= threshold. > > Bit 5: SMART status check returned "DISK OK" but we found that some > (usage > or prefail) Attributes have been <= threshold at some > time in the > past. > > > > I don't use the daemon since we a uniform monitoring tool that call > sensors ( in this case a script that calls smart command line) for > monitoring certain quntitites in the machines > > Thank you very much > > > > > -----Original Message----- > From: Bruce Allen [mailto:ba...@gr...] > Sent: Monday, January 26, 2004 4:09 PM > To: Hugo Cacote > Cc: sma...@li... > Subject: Re: [smartmontools-support]smartctl return value > > > > I'm trying to return information from disks behind a 3ware card. For > > this I have a script that issues the following command: > > > > system "/usr/sbin/smartctl -q silent -a -d 3ware,0 /dev/sda"; > > Afterwards I check the exit status to see if the disk is failing or is > > > OK. But I'm always receiving as exit code 0 (= 00000000), what does > > this mean ? > > > > The driver of the 3ware card is 1.02.00.031 running in a Red-Hat 7.1 > > Exit code 0 means everything is OK. > > [You might consider using smartd to monitor the disk, instead of doing > it your self with your own script.] > > Bruce > > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration See the > breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Smartmontools-support mailing list > Sma...@li... > https://lists.sourceforge.net/lists/listinfo/smartmontools-support > > > ------------------------------------------------------- > The SF.Net email is sponsored by EclipseCon 2004 > Premiere Conference on Open Tools Development and Integration > See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. > http://www.eclipsecon.org/osdn > _______________________________________________ > Smartmontools-support mailing list > Sma...@li... > https://lists.sourceforge.net/lists/listinfo/smartmontools-support > > |