Last active
February 13, 2020 09:32
-
-
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/
This file contains 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
# /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." | |
) |
This file contains 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
# /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