Skip to content

Instantly share code, notes, and snippets.

@pirapira
Created July 14, 2011 13:44
Show Gist options
  • Select an option

  • Save pirapira/1082481 to your computer and use it in GitHub Desktop.

Select an option

Save pirapira/1082481 to your computer and use it in GitHub Desktop.
http server monitor
#! /usr/local/bin/ruby
require 'net/http'
Net::HTTP.version_1_2
begin
r = Net::HTTP.start('example.com', 80) {|http|
res = http.get('/directory/file')
}
rescue
system('echo "NG" | mail -c addr@example.com -s "server faillure" addr2@example.com')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment