On 07/11/2011 10:37 PM, Victor Hooi wrote:
As long as we have more the <x> bytes available when we install
things, we know we'll be fine.
Here is a proof of concept.
With a little tweaking you should be able to test for
an absolute amount of free space on any mounted volume.
Hope that helps,
--vagn
#! /usr/bin/puppet apply
Exec {
path =>
"/u0/home/vagn/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
}
$script = inline_template("#! /bin/bash
d=\$1
p=\$2
t=\$( df -h \$d | tail -n +2 | sed 's/%//g' | while read a b c d e f ;
do echo \$e ; done )
if test \$t -gt \$p
then
echo \$t greater than \$p PASSED
exit 0
else
echo \$t not greater than \$p FAILED
exit 1
fi
)")
define diskspace($dev, $percent) {
exec { "diskspace $title $dev $percent":
command => "/usr/local/bin/diskspace-script ${dev}
${percent}",
logoutput => true,
require => File [ "/usr/local/bin/diskspace-script" ],
}
}
node default {
file { "/usr/local/bin/diskspace-script":
content => $script,
mode => 775,
}
diskspace { "check 1": dev => "/dev/sda1", percent => "30", }
diskspace { "check 2": dev => "/dev/sda1", percent => "40", }
}
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.