Centos – Add drive to Logwatch disk space check

centoslogwatchlvm

I'm looking to add a LVM volume to a Logwatch report for a Xen dom0. Currently this LVM volume doesn't show in the report as it is not mounted on the machine but is a physical drive. Any ideas on how to accomplish that?

I have no other reason for this drive to be mounted (it is used for domU's). Open to suggestions!

Best Answer

To report FS usage, logwatch invokes df which only queries mounted filesystems. You'll need to change this logic. I suggest mounting-invoking-unmounting since there's no universal way to query an unmounted filesystem (moreover, it may be in use by something like fsck/mkfs/dd and/or unformatted so the info obtained could be garbage).

The script for you to edit is /usr/share/logwatch/scripts/services/zz-disk-space (and probably its configuration file, /usr/share/logwatch/default.conf/services/zz-disk-space.conf). Both are written in Perl.