Re: Logwatch disk space report

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kanwar Ranbir Sandhu wrote:
Hi Everyone,

[I originally sent this using the wrong email account.  I'm not sure if
the first email will make it through, so here it is again]

So, I wanted to figure out why the logwatch report mangles the disk
space usage report.  Here's what I receive for one of my servers:

/dev/mapper/VolGroup00-LogVol00
/dev/hda1             101M   15M   80M  16% /boot
/dev/mapper/VolGroup00-home
/dev/mapper/VolGroup00-tmp
/dev/mapper/VolGroup00-usr
/dev/mapper/VolGroup00-var

That's obviously incomplete.  If I just run df -h, I get this:

/dev/mapper/VolGroup00-LogVol00
                      496M  172M  299M  37% /
/dev/hda1             101M   15M   80M  16% /boot
none                  173M     0  173M   0% /dev/shm
/dev/mapper/VolGroup00-home
                      434M   34M  379M   9% /home
/dev/mapper/VolGroup00-tmp
                      496M   13M  459M   3% /tmp
/dev/mapper/VolGroup00-usr
                      2.9G  830M  2.0G  30% /usr
/dev/mapper/VolGroup00-var
                      992M  234M  708M  25% /var

Much better (except for the ugly output).

Anyway, here's the line in the script that logwatch fires up to create
the disk usage report:

df -h | grep '^/dev/'

It appears that if the path to the device being is sufficiently long
enough, the disk usage for that device isn't printed.  I've tried the
same command on my laptop (also setup with LVM), and the same thing
happens:

/dev/mapper/vg00-root
/dev/hda1              99M   12M   82M  13% /boot
/dev/mapper/vg00-home
/dev/mapper/vg00-opt 1008M   34M  924M   4% /opt
/dev/mapper/vg00-tmp 1008M   34M  924M   4% /tmp
/dev/mapper/vg00-usr  3.9G  2.6G  1.1G  71% /usr
/dev/mapper/vg00-local
/dev/mapper/vg00-var 1008M  415M  542M  44% /var

Notice that /dev/mapper/vg00-home and /dev/mapper/vg00-local are both
empty.

Questions:

1. Why the need to grep for /dev?  df -h alone does the job well.
2. What's the solution?
        a. change the script to use df -h ?
        b. use shorter VG labels?
        c. something else entirely?

This one's been bugging me a little too, and your message prompted me to have a look at it.


Try editing /etc/log.d/scripts/services/zz-disk_space and changing:

grep '^/dev/'

to:

awk '/^\/dev/ { print; if (NF < 6) { getline; print } }'

I'd guess that the search for /dev/ is there to select only local filesystems, and it's not using the "-l" option so as to avoid the pseudo-filesystems that you get with that option.

Paul.




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux