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!

  • 2
    What do you expect logwatch to do with an unmounted LV? Does it even have a filesystem on it? – womble Mar 7 '12 at 4:01
  • Size usage would be nice, I guess. I would just prefer to monitor the entire volume over each individual logical volume. – user98651 Mar 7 '12 at 4:51
  • 1
    So you've got a VG, rather than an LV, and you want to know how full it is? – womble Mar 7 '12 at 9:29
  • @womble Yes, correct, sorry for the confusion. Any thoughts? – user98651 Mar 7 '12 at 13:52
  • Apart from "use a real monitoring system"? Nothing much. Looks like you worked out an appropriate hack for your situation. – womble Mar 7 '12 at 20:04

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.


Thanks for the suggestions. I figured out a solution that I was looking for, which was pretty simple in the end. Nothing fancy to see here but, this is what I added to zz-disk_space.conf:

$disk_cmd = "{ df $df_options ; echo ; } & vgdisplay"

Or, if you would prefer a less verbose output, I found the -s to be more concise.

$disk_cmd = "{ df $df_options ; echo ; } & vgdisplay -s "

The echo is there to add a line break between the outputs so they are visually separated and more consistent with the rest of the Logwatch report.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.