--- /dev/null
+#!/usr/bin/perl
+use strict;
+
+if (getpwuid($<) ne 'root') {
+ print "This script must be run by root.\n";
+ exit 1;
+}
+if ($#ARGV != 0) {
+ print "Usage: $0 <name-of-volume-group>\n";
+ exit 1;
+}
+my $vg = $ARGV[0];
+my $allvgs = `/usr/sbin/vgs --noheadings -o vg_name`;
+unless (grep { $_ eq $vg } split /\s+/,$allvgs) {
+ print "Unknown volume group.\n";
+ exit;
+}
+
+my $free = `/usr/sbin/vgs --noheadings -o vg_free_count $vg`;
+my $total = `/usr/sbin/vgs --noheadings -o vg_extent_count $vg`;
+printf "%.3f\n", 100-(($free/$total)*100);
\ No newline at end of file