Created
March 30, 2014 19:56
-
-
Save cabal95/9878682 to your computer and use it in GitHub Desktop.
Sample Facter plugin for sal that checks for disk I/O errors in the system.log and reports them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'facter' | |
begin | |
errors = 0 | |
File.open("/var/log/system.log").each_line do |line| | |
begin | |
if ( line.chomp =~ /disk.*: I\/O error/ ) | |
errors = 1 | |
break | |
end | |
rescue | |
end | |
end | |
end | |
Facter.add("diskerror") do | |
setcode do | |
errors | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment