Skip to content

Instantly share code, notes, and snippets.

@cabal95
Created March 30, 2014 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cabal95/9878682 to your computer and use it in GitHub Desktop.
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.
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