Monitoring Vmfs Filesystems Under Esx

by Oct 12, 2006

The current ESX agent does not display VMFS volume information so I decided to hack perfparse.sh a bit to make this work.

Basically, I changed perfparse.sh to use vmware's vdf command instead of df -lk and modified the df_k_disp() function to handle the formatting.

So, change DFBIN

CODE
#DFBIN=”df -lk”
DFBIN=”/usr/sbin/vdf”

And df_k_disp function now looks like this …

CODE
df_k_disp() {
# We answer the output of the df command in kilobytes but strip some filesystems like proc and shm that are not needed
echo $DATESTR
#$DFBIN | egrep -v '/dev/shm|/proc|/dev/cdrom|/dev/fd0|/dev/pts|usb|:|Filesystem' | $AWKBIN '{ if ( $6 != “/tmp” ) { if ( $2 == “” ) { fs = $1; getline; print fs ” ” $0 } else { print $0 } } }'
$DFBIN | egrep -v '/dev/shm|/proc|/dev/cdrom|/dev/fd0|/dev/pts|usb|:/|^ |Filesystem' | $AWKBIN '{ if ( $6 != “/tmp” ) { if ( $2 == “” ) { fs = $1; getline; print fs ” ” $0 } else { print $0 } } }'
}

A quick rescan of the agent and it's looking good. The only thing is that vdf only shows the hba paths for the filesystem info rather than the LUN name. Massimiliano Daneri of VMTS has written a perl script to parse vdf and display with LUN names. I tried putting this into the df_k_disp fucntion however the LUN name has a space and is in brackets (and is there truncated giving same output as vdf), so I assume the script is seeing this as another field and is there excluding it. I just can't find where it's doing this.

vdf output yields

CODE
# vdf
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p6      2015904    670620   1242880  36% /
/dev/cciss/c0d0p1        51342     17771     30920  37% /boot
/dev/cciss/c0d0p7      2015904    252572   1660928  14% /home
none                    401724         0    401724   0% /dev/shm
/dev/cciss/c0d0p8       493891    107989    360403  24% /var
/dev/cciss/c0d0p2     10079884     32828   9535016   1% /vmimages
p-filer-xxxxxx.myhostname.com:/vol/vol010/vmware
                         51200       160     51040   1% /mnt/NAS
vmhba0:0:0:3          54072240   8396720  45675520  15% /vmfs/vmhba0:0:0:3
vmhba2:0:146:1        58924016  39758832  19165184  67% /vmfs/vmhba2:0:146:1
vmhba2:0:147:1        58924016  50244592   8679424  85% /vmfs/vmhba2:0:147:1
vmhba2:0:148:1        58924016  48051184  10872832  81% /vmfs/vmhba2:0:148:1
vmhba2:0:149:1        58924016  22979568  35944448  38% /vmfs/vmhba2:0:149:1
vmhba2:0:150:1        58924016  24577008  34347008  41% /vmfs/vmhba2:0:150:1

and vdf+ -V

CODE
# /mnt/NAS/vdf+ -V
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p6      2015904    670620   1242880  36% /
/dev/cciss/c0d0p1        51342     17771     30920  37% /boot
/dev/cciss/c0d0p7      2015904    252596   1660904  14% /home
none                    401724         0    401724   0% /dev/shm
/dev/cciss/c0d0p8       493891    107991    360401  24% /var
/dev/cciss/c0d0p2     10079884     32828   9535016   1% /vmimages
p-filer-xxxxxx.myhostname.com:/vol/vol010/vmware
                         51200       160     51040   1% /mnt/NAS
vmhba0:0:0:3          54072240   8396720  45675520  15% /vmfs/vmhba0:0:0:3 (local)
vmhba2:0:146:1        58924016  39758832  19165184  67% /vmfs/vmhba2:0:146:1 (San0)
vmhba2:0:147:1        58924016  50244592   8679424  85% /vmfs/vmhba2:0:147:1 (San1)
vmhba2:0:148:1        58924016  48051184  10872832  81% /vmfs/vmhba2:0:148:1 (San2)
vmhba2:0:149:1        58924016  22979568  35944448  38% /vmfs/vmhba2:0:149:1 (San3)
vmhba2:0:150:1        58924016  24577008  34347008  41% /vmfs/vmhba2:0:150:1 (Templates)

I would really like to have the LUN names displayed as the hba mapping are not that intuitive.

So in the uptime console my Disk -> File System Capacity stats look like this

CODE
Filesystem         Size         Used        Available     % Used     Device  
/vmfs/vmhba0:0:0:3    51.57 GB     8.01 GB     43.56 GB     15 %     vmhba0:0:0:3
/vmfs/vmhba2:0:146:1    56.19 GB     37.92 GB     18.28 GB     67 %     vmhba2:0:146:1
/vmfs/vmhba2:0:147:1    56.19 GB     47.92 GB     8.28 GB     85 %     vmhba2:0:147:1
/vmfs/vmhba2:0:148:1    56.19 GB     45.83 GB     10.37 GB     81 %     vmhba2:0:148:1
/vmfs/vmhba2:0:149:1    56.19 GB     21.92 GB     34.28 GB     38 %     vmhba2:0:149:1
/vmfs/vmhba2:0:150:1    56.19 GB     23.44 GB     32.76 GB     41 %     vmhba2:0:150:1

When I want them to look like this …

CODE
Filesystem         Size         Used        Available     % Used     Device  
/vmfs/local        51.57 GB     8.01 GB     43.56 GB     15 %     vmhba0:0:0:3
/vmfs/San0        56.19 GB     37.92 GB     18.28 GB     67 %     vmhba2:0:146:1
/vmfs/San1        56.19 GB     47.92 GB     8.28 GB     85 %     vmhba2:0:147:1
/vmfs/San2        56.19 GB     45.83 GB     10.37 GB     81 %     vmhba2:0:148:1
/vmfs/San3        56.19 GB     21.92 GB     34.28 GB     38 %     vmhba2:0:149:1
/vmfs/Templates        56.19 GB     23.44 GB     32.76 GB     41 %     vmhba2:0:150:1

Can you help?

Thanks

Nick