git00ll
V2EX  ›  问与答

smartctl 的日志怎么输出到 syslog 里面

  •  
  •   git00ll · Aug 8, 2024 · 1137 views
    This topic created in 649 days ago, the information mentioned may be changed or developed.

    想要定时执行 smartctl 的 self-test ,并且通过扫描 syslog 的日志在 motd 中展示是否自检通过。

    但是执行 smartctl -t short /dev/sda 始终无法将日志输出到 syslog 中,不知道哪里漏配置了还是啥。

    大概像下面这样的日志,,曾经不知道输入了啥出现过,后来就再也出不来了,有大佬知道吗

    2024-08-06T01:44:51.359610+08:00 debian smartd[2350]: Device: /dev/sda [SAT], self-test in progress, 70% remaining
    2024-08-06T02:14:51.595760+08:00 debian smartd[2350]: Device: /dev/sda [SAT], self-test in progress, 30% remaining
    2024-08-06T02:44:51.875260+08:00 debian smartd[2350]: Device: /dev/sda [SAT], self-test in progress, 10% remaining
    2024-08-06T03:14:51.159457+08:00 debian smartd[2350]: Device: /dev/sda [SAT], previous self-test completed without error
    
    

    还想问一下,通过 crontab 的方式定时执行自检这种方案合理吗

    3 replies    2024-08-09 10:08:09 +08:00
    yinmin
        1
    yinmin  
       Aug 9, 2024 via iPhone
    试试这个:

    smartctl -t short /dev/sda 2>&1 | /usr/bin/systemd-cat -t smartctl
    dbak
        2
    dbak  
       Aug 9, 2024
    -l TYPE, --log=TYPE
    Show device log. TYPE: error, selftest, selective, directory[,g|s],
    xerror[,N][,error], xselftest[,N][,selftest], background,
    sasphy[,reset], sataphy[,reset], scttemp[sts,hist],
    scttempint,N[,p], scterc[,N,M], devstat[,N], defects[,N], ssd,
    gplog,N[,RANGE], smartlog,N[,RANGE], nvmelog,N,SIZE
    julyclyde
        3
    julyclyde  
       Aug 9, 2024
    smartd
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5120 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 01:21 · PVG 09:21 · LAX 18:21 · JFK 21:21
    ♥ Do have faith in what you're doing.