Modifying logwatch to work with ESX 4.1

I just like how some software, like logwatch, does a great job at monitoring and sending you daily log files. You can really stay on top of things with a wonderful free opensource product like this.

 

Unfortunately, logwatch does not really know about ESX, and the differences between a regular Linux server and the additional abilities ESX has. The biggest issue was in the “Disk Space” report. Logwatch uses a “df” command and in ESX, df will not report on VMFS type devices. So, how do we fix that? Simple:

 

vi /usr/share/logwatch/default.conf/services/zz-disk_space.conf

 

This will let open the zz-disk_space.conf file for edit. Find the following line and add:

 

# The variables df_options and disk_cmd are used to customize the reporting
# of filesystem disk usage.  For example, the following are the defaults
# for Linux OS:
# $df_options = “-h -l -x tmpfs”
# $disk_cmd = “df $df_options”
$disk_cmd = “/usr/sbin/vdf $df_options”
$df_options = “-h -P”

 

What we have done is told logwatch to use the /usr/sbin/vdf command and use only the “-h” and “-P” options. You now get a nice report in your email showing the disk space in a human [G or M instead of blocks] readable format.