Netdata Community

Make smartd_log plugin also search /var/lib/smartmontools on ubuntu instead of failing when /var/log/smartd is missing

ubuntu smartd version 6.5+svn4324-1ubuntu0 and later (ubuntu 18.04 and newer) does not run with -A but still writes metrics into /var/lib/smartmontools csv files

it would be useful to make the plugin also search for this path instead of the default /var/log/smartd, which would allow smartd support out of the box

from ubuntu 18.04 man page

       -A PREFIX, --attributelog=PREFIX

If  this  option is not specified, attribute information is written to files ´/var/lib/smartmontools/attrlog.MODEL-SERIAL.ata.csv´.  To
              disable attribute log files, specify this option with an empty string argument: ´-A ""´.

also instructions are incomplete for redhat & clones, because selinux

Aug 18 00:00:33 server python[17067]: SELinux is preventing /usr/sbin/smartd from write access on the directory /var/log/smartd/.

                                         *****  Plugin catchall (100. confidence) suggests   **************************

                                         If you believe that smartd should be allowed write access on the  directory by default.
                                         Then you should report this as a bug.
                                         You can generate a local policy module to allow this access.
                                         allow this access for now by executing:
                                         # ausearch -c 'smartd' --raw | audit2allow -M my-smartd
                                         # semodule -i my-smartd.pp

you would have to do the ausearch/audit2allow/semodule dance for about 4-5 iterations of restarting smartd, because after each run you get new type of denials

also debian has csv files /var/lib/smartmontools/ enabled by default