Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# raidctrl.rb

raidctrl_name = "none"

# linux software raid
check_linuxmd = ((%x{cat /proc/mdstat 2>/dev/null}.to_s =~ /^md.*: .*raid/m) != nil)
if check_linuxmd then
        raidctrl_name = "linuxmd"
end

# hp smartarray / cciss
check_cciss = %x{/usr/bin/lspci -d '103c:' 2>/dev/null}.to_s
if check_cciss.include?("Smart Array") or check_cciss.include?("3238") then
        raidctrl_name = "cciss"
end

# areca raid
check_areca = %x{/usr/bin/lspci -d '17d3:' 2>/dev/null}.to_s
if check_areca.include?("RAID") then
        raidctrl_name = "areca"
end


Facter.add("raidctrl") do
        setcode do
                result = raidctrl_name
        end
end