alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.55k stars 222 forks source link

scrutiny no discs #72

Closed pssc closed 3 years ago

pssc commented 3 years ago
time="2021-11-02T14:00:01Z" level=info msg="Collecting smartctl results for sdc\n" type=metrics
time="2021-11-02T14:00:01Z" level=info msg="Executing command: smartctl -x -j /dev/sdc" type=metrics
time="2021-11-02T14:00:01Z" level=error msg="smartctl returned an error code (2) while processing sdc\n" type=metrics

The error is permission denied:-

root@db21ed7f-scrutiny:/# smartctl -x -j /dev/sda
{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      1
    ],
    "svn_revision": "5022",
    "platform_info": "x86_64-linux-5.10.0-9-amd64",
    "build_info": "(local build)",
    "argv": [
      "smartctl",
      "-x",
      "-j",
      "/dev/sda"
    ],
    "messages": [
      {
        "string": "Smartctl open device: /dev/sda failed: Operation not permitted",
        "severity": "error"
      }
    ],
    "exit_status": 2
  }
}
root@db21ed7f-scrutiny:/# smartctl -x -j /dev/sde
{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      1
    ],
    "svn_revision": "5022",
    "platform_info": "x86_64-linux-5.10.0-9-amd64",
    "build_info": "(local build)",
    "argv": [
      "smartctl",
      "-x",
      "-j",
      "/dev/sde"
    ],
    "messages": [
      {
        "string": "Smartctl open device: /dev/sde failed: Operation not permitted",
        "severity": "error"
      }
    ],
    "exit_status": 2
  }
}
root@db21ed7f-scrutiny:/# 

This probably need to run with protected mode disabled but that option is not available?

That or the device section needs updating i would suggest:- "devices": [ "/dev/sda", "/dev/sdb", "/dev/sdc", "/dev/sdd", "/dev/sde", "/dev/sdf", "/dev/sdg", "/dev/sdh", "/dev/sdi", ],

I don't think pattern patches are supported.

alexbelgium commented 3 years ago

Thanks, I've pushed a new version with your proposed modification. Could you test if it works? Thanks

pssc commented 3 years ago

@alexbelgium yup have metrics for discs a-d. But e is not producing stats in the web interface but I can report the command works as expected manually. So I think that's a different issue I will investigate and open new if required.

alexbelgium commented 3 years ago

Great, thanks!