diff --git a/README.md b/README.md index 5918c9b..bcd9890 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Puppet smartd Module * [Parameters](#parameters) * [Pedantic Example](#pedantic-example) * [Hiera Data Bindings](#hiera-data-bindings) + * [Facts](#facts) 4. [Limitations](#limitations) * [Tested Platforms](#tested-platforms) 5. [Versioning](#versioning) @@ -277,6 +278,87 @@ smartd::devices: options: '-a -o on -S on -s (S/../.././18|L/../../3/20|C/../.././19)' ``` +### Facts + +#### `megacli` + +Path to the `MegaCli` executable. Example: + + megacli => /usr/bin/MegaCli + +#### `megacli_version` + +Version string of the `MegaCli` executable. Example: + + megacli_version => 8.07.07 + +#### `megaraid_adapters` + +The count of LSI MegaRAID adapters detected in the system. *Note that this +module presently only supports a single adapter per system.* Example: + + megaraid_adapters => 1 + +#### `megaraid_fw_package_build` + +The LSI MegaRAID adapter firmware package string. Example: + + megaraid_fw_package_build => 23.22.0-0012 + +#### `megaraid_fw_version` + +The LSI MegaRAID adapter firmware version string. Example: + + megaraid_fw_version => 3.340.05-2939 + +#### `megaraid_physical_drives` + +The LSI MegaRAID unique device ID(s) for all attached disks. Example: + + megaraid_physical_drives => 116,117,120,121,122,123,124,125,126,127,128,129,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,200,201,202,203,204,205,206,207 + +#### `megaraid_physical_drives_sas` + +The LSI MegaRAID unique device ID(s) for only attached ####SAS* disks. Example: + + megaraid_physical_drives_sas => 116,117,120,121,122,123,124,125,126,127,128,129,131,132,133,134,135,136,137,138,139,140,187,188,189,190,191,192,193,194,195,196,197,198,200,201,202,203,204,205,206,207 + +#### `megaraid_physical_drives_sata` + +The LSI MegaRAID unique device ID(s) for only attached ####SATA* disks. Example: + + megaraid_physical_drives_sata => 141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186 + +#### `megaraid_product_name` + +The LSI MegaRAID product name string. Example: + + megaraid_product_name => LSI MegaRAID SAS 9286CV-8e + +#### `megaraid_serial` + +The LSI MegaRAID serial number string. Example: + + megaraid_serial => SV22925366 + +#### `megaraid_virtual_drives` + +A listing of `/dev/` devices exported by a LSI MegaRAID controller. Example: + + megaraid_virtual_drives => sda,sdb,sdc,sdd,sde,sdf,sdg,sdh,sdk,sdl + +#### `smartd` + +Path to the `smartd` executable. Example: + + smartd => /usr/sbin/smartd + +#### `smartmontools_version` + +Version of the install `smartmontools` package. Example: + + smartmontools_version => 5.43 + Limitations ----------- diff --git a/lib/facter/megacli_version.rb b/lib/facter/megacli_version.rb index affaeee..4339db0 100644 --- a/lib/facter/megacli_version.rb +++ b/lib/facter/megacli_version.rb @@ -3,7 +3,7 @@ setcode do unless megacli.nil? - output = Facter::Util::Resolution.exec("#{megacli} -Version -Cli -aALL") + output = Facter::Util::Resolution.exec("#{megacli} -Version -Cli -aALL -NoLog") next if output.nil? m = output.match(/MegaCLI SAS RAID Management Tool Ver ([\d\.]+)/) next unless m.size == 2 diff --git a/lib/facter/megaraid_fw_package_build.rb b/lib/facter/megaraid_fw_package_build.rb index b052276..9904504 100644 --- a/lib/facter/megaraid_fw_package_build.rb +++ b/lib/facter/megaraid_fw_package_build.rb @@ -3,7 +3,7 @@ setcode do unless megacli.nil? - output = Facter::Util::Resolution.exec("#{megacli} -Version -Ctrl -aALL") + output = Facter::Util::Resolution.exec("#{megacli} -Version -Ctrl -aALL -NoLog") next if output.nil? m = output.match(/Fw Package Build : ([\d\.\-]+)\s*$/) next unless m.size == 2 diff --git a/lib/facter/megaraid_fw_version.rb b/lib/facter/megaraid_fw_version.rb index 9dfaf30..c0799d4 100644 --- a/lib/facter/megaraid_fw_version.rb +++ b/lib/facter/megaraid_fw_version.rb @@ -3,7 +3,7 @@ setcode do unless megacli.nil? - output = Facter::Util::Resolution.exec("#{megacli} -Version -Ctrl -aALL") + output = Facter::Util::Resolution.exec("#{megacli} -Version -Ctrl -aALL -NoLog") next if output.nil? m = output.match(/FW Version : ([\d\.\-]+)\s*$/) next unless m.size == 2 diff --git a/lib/facter/megaraid_product_name.rb b/lib/facter/megaraid_product_name.rb index b1cce05..35f3135 100644 --- a/lib/facter/megaraid_product_name.rb +++ b/lib/facter/megaraid_product_name.rb @@ -3,7 +3,7 @@ setcode do unless megacli.nil? - output = Facter::Util::Resolution.exec("#{megacli} -Version -Ctrl -aALL") + output = Facter::Util::Resolution.exec("#{megacli} -Version -Ctrl -aALL -NoLog") next if output.nil? m = output.match(/Product Name : (.+)\s*$/) next unless m.size == 2 diff --git a/lib/facter/megaraid_serial.rb b/lib/facter/megaraid_serial.rb index daa3166..fe1553c 100644 --- a/lib/facter/megaraid_serial.rb +++ b/lib/facter/megaraid_serial.rb @@ -3,7 +3,7 @@ setcode do unless megacli.nil? - output = Facter::Util::Resolution.exec("#{megacli} -Version -Ctrl -aALL") + output = Facter::Util::Resolution.exec("#{megacli} -Version -Ctrl -aALL -NoLog") next if output.nil? m = output.match(/Serial No : (\S+)\s*$/) next unless m.size == 2 diff --git a/spec/unit/facts/megacli_version_spec.rb b/spec/unit/facts/megacli_version_spec.rb index 0cd8447..2cf8be4 100644 --- a/spec/unit/facts/megacli_version_spec.rb +++ b/spec/unit/facts/megacli_version_spec.rb @@ -21,7 +21,7 @@ it 'should get the version string' do Facter.fact(:megacli).stubs(:value).returns('/usr/bin/MegaCli') Facter::Util::Resolution.stubs(:exec). - with('/usr/bin/MegaCli -Version -Cli -aALL'). + with('/usr/bin/MegaCli -Version -Cli -aALL -NoLog'). returns(File.read(fixtures('megacli', 'version-cli-aall-8.07.07'))) Facter.fact(:megacli_version).value.should == '8.07.07' end diff --git a/spec/unit/facts/megaraid_fw_package_build_spec.rb b/spec/unit/facts/megaraid_fw_package_build_spec.rb index 4af4f71..6faad41 100644 --- a/spec/unit/facts/megaraid_fw_package_build_spec.rb +++ b/spec/unit/facts/megaraid_fw_package_build_spec.rb @@ -21,7 +21,7 @@ it 'should get the version string' do Facter.fact(:megacli).stubs(:value).returns('/usr/bin/MegaCli') Facter::Util::Resolution.stubs(:exec). - with('/usr/bin/MegaCli -Version -Ctrl -aALL'). + with('/usr/bin/MegaCli -Version -Ctrl -aALL -NoLog'). returns(File.read(fixtures('megacli', 'version-ctrl-aall-8.07.07'))) Facter.fact(:megaraid_fw_package_build).value.should == '23.22.0-0012' end diff --git a/spec/unit/facts/megaraid_fw_version_spec.rb b/spec/unit/facts/megaraid_fw_version_spec.rb index 054c1ed..8578497 100644 --- a/spec/unit/facts/megaraid_fw_version_spec.rb +++ b/spec/unit/facts/megaraid_fw_version_spec.rb @@ -21,7 +21,7 @@ it 'should get the version string' do Facter.fact(:megacli).stubs(:value).returns('/usr/bin/MegaCli') Facter::Util::Resolution.stubs(:exec). - with('/usr/bin/MegaCli -Version -Ctrl -aALL'). + with('/usr/bin/MegaCli -Version -Ctrl -aALL -NoLog'). returns(File.read(fixtures('megacli', 'version-ctrl-aall-8.07.07'))) Facter.fact(:megaraid_fw_version).value.should == '3.340.05-2939' end diff --git a/spec/unit/facts/megaraid_product_name_spec.rb b/spec/unit/facts/megaraid_product_name_spec.rb index b359fd7..29441e8 100644 --- a/spec/unit/facts/megaraid_product_name_spec.rb +++ b/spec/unit/facts/megaraid_product_name_spec.rb @@ -21,7 +21,7 @@ it 'should get the version string' do Facter.fact(:megacli).stubs(:value).returns('/usr/bin/MegaCli') Facter::Util::Resolution.stubs(:exec). - with('/usr/bin/MegaCli -Version -Ctrl -aALL'). + with('/usr/bin/MegaCli -Version -Ctrl -aALL -NoLog'). returns(File.read(fixtures('megacli', 'version-ctrl-aall-8.07.07'))) Facter.fact(:megaraid_product_name).value.should == 'LSI MegaRAID SAS 9286CV-8e' end diff --git a/spec/unit/facts/megaraid_serial_spec.rb b/spec/unit/facts/megaraid_serial_spec.rb index a61bdae..c042d69 100644 --- a/spec/unit/facts/megaraid_serial_spec.rb +++ b/spec/unit/facts/megaraid_serial_spec.rb @@ -21,7 +21,7 @@ it 'should get the version string' do Facter.fact(:megacli).stubs(:value).returns('/usr/bin/MegaCli') Facter::Util::Resolution.stubs(:exec). - with('/usr/bin/MegaCli -Version -Ctrl -aALL'). + with('/usr/bin/MegaCli -Version -Ctrl -aALL -NoLog'). returns(File.read(fixtures('megacli', 'version-ctrl-aall-8.07.07'))) Facter.fact(:megaraid_serial).value.should == 'SV22925366' end