Christian Franke | 11 Jul 2008 18:45
Picon
Favicon

Re: Help Needed - Reading SMART values from script

Ivo Pereira wrote:
> Hello, all !!
>
> I am currently implementing SMART monitoring on my servers, we use 
> lots of ATA disks and I need to read specific SMART values from a 
> script, to return them to my monitoring system for graphing, data 
> storage, etc..
>
> I have a script that can parse the output when given a disk and 
> attribute as parameters, but sometimes it fails because of the so 
> poorly-formatted output of smartctl...
>

IMO, the smartctl attribute table is not poorly-formatted :-)

> Any simple ideias on how to read only *one *attribute at a time, just 
> having as output the raw value?
>

The output format of the raw value may differ depending on type, value 
or drive database entry. This can be suppressed by '-v' option.

Examples:

Print temperature (last byte of raw value, remaining bytes may encode 
min/max)

$ smartctl -A -v N,raw8 /dev/ice | awk '$1==194 {print $15}'
31

Print attribute number/raw value pairs

$ smartctl -A -v N,raw48 /dev/ice | sed '1,/^ID#/d' | awk '{print $1,$10}'
1 0
3 7936
4 2266
5 0
7 0
8 11734
9 4539
10 0
11 0
12 1161
190 31
194 31
195 1892941
...

Cheers,
  Christian

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08

Gmane