Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save donovanbray/920553 to your computer and use it in GitHub Desktop.
Save donovanbray/920553 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# Pingdom_http_custom_check
# DFF - 2011
# put this in {Apache Files}/cgi-bin/
# make sure to chmod +x the file
# Your ruby interpreter might not be where mine is. Check the above.
#
require 'cgi'
too_old=360
#Get modification time:
age_in_seconds = (Time.now - File.mtime('APACHE_CONTENT_DIR/FILE_TO_TIMESTAMP')).to_i
cgi = CGI.new('html3')
cgi.out do
cgi.out { "<pingdom_http_custom_check>\n\t<status>#{ age_in_seconds < too_old ? 'OK' : 'ERROR' }</status>\n\t<response_time>#{age_in_seconds.to_s }</response_time>\n</pingdom_http_custo
m_check>" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment