Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/puppet/provider/nimsoft_disk/nimsoft.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
map_property :missing, :attribute => :active, :section => 'missing', :symbolize => true

{
:warning => 'warning',
:critical => 'error'
:warning => 'warning',
:critical => 'error',
:delta_error => 'delta_error',
:delta_warning => 'delta_warning'
}.each_pair do |property, section_name|
define_method(property) do
if section = element.child(section_name)
Expand Down
36 changes: 35 additions & 1 deletion lib/puppet/type/nimsoft_disk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
description => '/var managed by puppet',
warning => '20',
critical => '10',
delta_error => '200',
delta_warning => absent,
}"

newparam(:name) do
Expand All @@ -21,7 +23,7 @@
desc "A short description of the Filesystem"
end

newproperty(:device) do
newproperty(:device) do
desc "The underlying blockdevice or nfs share that is mounted"
end

Expand Down Expand Up @@ -74,4 +76,36 @@
end
end
end

newproperty(:delta_error) do
desc "The delta error threshold size in MB. Set this to absent if you want to remove the delta_error threshold"
newvalues :absent, /^\d+$/

validate do |value|
return true if value == :absent or value == 'absent'
if /^\d+$/.match(value)
if value.to_i < 0
raise Puppet::Error, "threshold has to be > 0, not #{value}"
end
else
raise Puppet::Error, "threshold has to be numeric, not #{value}"
end
end
end

newproperty(:delta_warning) do
desc "The delta warning threshold size in MB. Set this to absent if you want to remove the delta_error threshold"
newvalues :absent, /^\d+$/

validate do |value|
return true if value == :absent or value == 'absent'
if /^\d+$/.match(value)
if value.to_i < 0
raise Puppet::Error, "threshold has to be > 0, not #{value}"
end
else
raise Puppet::Error, "threshold has to be numeric, not #{value}"
end
end
end
end