nagios: Added support for checking Linux md arrays to nrpe
This commit is contained in:
parent
df119e389e
commit
422fc90f78
2 changed files with 26 additions and 0 deletions
15
custom/lib/facter/mdarrays.rb
Normal file
15
custom/lib/facter/mdarrays.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
Facter.add(:mdarrays) do
|
||||||
|
confine :kernel => :linux
|
||||||
|
setcode do
|
||||||
|
arrays = []
|
||||||
|
mdstat = "/proc/mdstat"
|
||||||
|
if File.exists?(mdstat)
|
||||||
|
File.readlines(mdstat).each do |line|
|
||||||
|
if m = line.match(/^md[0-9]+/)
|
||||||
|
arrays << m[0]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
arrays.sort.join(',')
|
||||||
|
end
|
||||||
|
end
|
|
@ -291,6 +291,17 @@ class nagios::target::nrpe inherits nagios::target {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $::kernel == "Linux" and $::mdarrays {
|
||||||
|
nagios::target::nrpe::service { "check_linux_raid":
|
||||||
|
description => "RAID",
|
||||||
|
package => $::operatingsystem ? {
|
||||||
|
"debian" => "nagios-plugins-standard",
|
||||||
|
"ubuntu" => "nagios-plugins-standard",
|
||||||
|
default => "nagios-plugins-linux_raid",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue