Re: Using SMARTd to monitor drives

Ray Andrews <[email protected]> Sun, 05 Feb 2017 08:53:24 -0800
Newsgroups gmane.linux.utilities.smartmontools
Message-ID <[email protected]>
On 05/02/17 07:30 AM, Christian Franke wrote:
>
> Or course, as you restricted the messages to LOG_ERR or worse (-p err)
> and to previous boot (-b -1). Most of smartd's messages are invisible
> then because these use LOG_INFO level.

Live and learn.  Smartd is the first program that has required me to 
look any further into these logs, so before now I've only learned to 
list the errors and I thought all these messages would be considered 
errors.  There is so much to know, and very little help for the 
beginner.   Things can become so complex that even the masters forget 
how they work.  IMHO there should always be a simple introduction to any 
program and a simple way to use it for simple things.  Anyway, after 
what you showed me I wrote an alias:

# cut down log of smartd activity fits within 80 character terminal:
alias smart='grep -w smartd /var/log/daemon.log | sed -r 
"s|^(.{16})(.{43})(.{3})(.{6})|\1\3|" | sed "s|SMART Usage Attribute||"'

... so now I can see activity whenever I want:

...
Feb  3 18:57:22 sdc, 77 Currently unreadable (pending) sectors
Feb  3 19:27:17 sdb, : 190 Airflow_Temperature_Cel changed from 68 to 69
Feb  3 19:27:17 sdb, : 194 Temperature_Celsius changed from 111 to 112
Feb  3 19:27:21 sdc, 77 Currently unreadable (pending) sectors
Feb  3 19:57:17 sdb, : 190 Airflow_Temperature_Cel changed from 69 to 67
Feb  3 19:57:18 sdb, : 194 Temperature_Celsius changed from 112 to 110
Feb  3 19:57:21 sdc, 77 Currently unreadable (pending) sectors
Binary file /var/log/daemon.log matches

... and now I can try to figure out how to filter out the pointless 
messages.  BTW interesting that grep considers the file binary, but you 
can do text searches.
> Note that systemd journals are often not persistent by default (at least
> on Debian). Using 'journalctl -b -1' always fails then.

Yes, I've learned to make it persistent already.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot