Skip to content

Instantly share code, notes, and snippets.

@phstc
Last active February 13, 2020 09:32
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save phstc/5044114 to your computer and use it in GitHub Desktop.
Save phstc/5044114 to your computer and use it in GitHub Desktop.
Homemade Pingdom with Monit + Twilio http://pablocantero.com/blog/2013/02/21/look-whos-talking/
# /usr/bin/notify-site-is-down.rb
require "rubygems"
require "twilio-ruby"
account_sid = ENV["TWILIO_ACCOUNT_SID"]
auth_token = ENV["TWILIO_AUTH_TOKEN"]
@client = Twilio::REST::Client.new account_sid, auth_token
@client.account.SMS.messages.create(
from: "+5511…",
to: "+5511…",
body: "Houston we have a problem, the website is down."
)
# /etc/monitrc
check host localhost with address 127.0.0.1
if failed port 8080
with timeout 15 seconds
then
exec "ruby /usr/bin/notify-site-is-down.rb'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment