• Stop being a LURKER - join our dealer community and get involved. Sign up and start a conversation.

How do you know if your website is up and running??

Rick Buffkin

Sausage King of Chicago
Oct 29, 2009
730
833
Awards
8
First Name
Rick
Guys and Girls....

This past weekend I ran into an issue. A VPS (virtual private server) of mine went offline. It was a very simple easy fix. Simply, reboot the server and get it back online. The issue was, I had no idea it went offline. By looking at the stats it was down for a couple of hours. It was by a freak chance that I caught it. I called the provider I have the server setup with and ask them, "Do you guys not have a method or way of alerting me when the server goes offline???" The rep kindly replied, "no, we don't" ! She did say that there were scripts that I could place on the server that would alert me but they didn't have access to them because they were custom scripts written by other customers that have a VPS like mine. That got me thinking on how to go about getting alerts on when this thing decides to go offline again. Keep in mind, this is the first time this has happened to me. It's been running flawless for months now.

I'm sure there are programs and software that you can subscribe to and they will provide alerts, calls, charts and more data than you can shake a stick at. I get that. I need something simple, reliable, fast and Free!!!

I figured out a way to get the alerts now for my VPS but I started thinking, How many times have I ran into the issue of where I get a phone call from managers or sales reps at the dealership saying "Rick, our website is down or offline". It doesn't happen very often but I'm always one of the last people to know. I figure there's other people out there like me that have multiple websites who would like to be proactive instead of only reactive and know if the sites are down immediately so you can get on the phone with tech support to get them back up ASAP and not spend every waking moment surfing your own websites making sure they're up and running correctly.

I did a little searching on Google and I found a Google Apps script on Digital Inspiration that shows you how to send a SMS using Apps script and Twilio. Here's the link: https://ctrlq.org/code/20200-send-sms-google-script

A couple of steps that Digital Inspiration doesn't explain, I'll explain here for you.

Create a free account at www.twilio.com
Once you create your account, you will be prompted to give a cell number to receive a text message or call for a verification code.

Once you get your code and verify your account with twilio, login to twilio. At the Console Dashboard, click on the "Programmable SMS" link. With the free account, your allowed 1 twilio phone number that you can send SMS with. Get your free twilio phone number and it will be linked to your account!! Your done.

Now, you have your number, lets use Google Apps Script to ping your websites and get the response code from the header. If the response returned back isn't a 200 (200 meaning everything is working fine) then send you a SMS letting you know something was wrong and include the site name and the response that was returned back and include this in the text message.


Here you go!!
http://www.rickbuffkin.com/SMSnotifier.txt


Originally had the code posted here but, I had to edit my original post, DR kept altering the code!!!

Once you have your script, click on Run and you'll be prompted by google to allow the script to run. Simply select the GMail account your using and hit OK. If everything is working correctly, you shouldn't be getting any alerts at all. You can click on the View>Logs to see the response returned. The script is set to only send a text message if there is a response other than a 200.



Now that you have your code, and you've made your edits, the next thing you have to do is set your Script to run at a certain interval. In Scripts Apps click on Edit > Current Project's Triggers. Then click on the link to add a Trigger. In the next window you can set up the interval you want the script to run. I have mine running every min. You can set it to run as often as you want though. You can also set up an alert if for some reason that Google Apps Script errors and doesn't run your script. Just click on "notifications" and set your email address and when you want it sent. Mine is set to send immediately.

This was my solution and so far it seems to be working pretty well with no issues. Anyone else want to chime in with their solution??
 
Last edited:
The first time this happened to me (8 years ago) I realized that it was a problem that had to be solved.
The worst feeling is receiving a call from a client and having them inform you that something is offline and you are not aware of it.

At this point in time we're using a few things:

- Nagios / Zappix - both open source monitoring tools that let us know how exactly the server is performing. Especially when your VPS is on a host machine shared by 12+ other people, this is critical. Being online is great, but being online with MySQL using 90% of your CPU is not online enough for me.

- Pingdom - Pingdom pings the site every 60 seconds and confirms it is online. We also get a report every week showing the average load time of the site as a timeline across the week so we can identify any times that the server may be struggling to keep up.

- AWS Resource alerts - all our servers with AWS have resource alerts so that if anything spikes about 50% we are alerted and on the case immediately. We always maintain < 50% server usage so that spikes are mere blips on our radar when they happen.

- Chauffeur - this is an in-house tool we developed that actually checks and validates our websites. Not only does it show that they are online, but it also confirms that the necessary APIs are functioning and that the site is responding to performance checks.

- Ghost Inspector - this is more of a QA tool, but we still use it across the sites. Ghost Inspector lets you script front-end testing of the website, so you can ensure that not only are you online and responding quickly, but it can also confirm that lead submissions are working as expected and that every site has inventory showing, etc.

It's a fairly complicated stack, but it means that if a server ever goes offline, our office lights up like a christmas tree and every developer, devops and manager is aware immediately. Thankfully for my sanity this is a very rare occurrence, but even AWS goes down sometimes so the safety net is in place. Now that we have redundant copies of everything running on a separate server in a separate region, downtime actually just means a failover to a backup website, rather than a red alert site offline situation. If you can have 2 VPS running with a live-live redundancy you'll sleep easy :)
 
@craigh That looks like a very, very solid set up. If something does happen to go down, what type of communication alert do you guys get? Text Message??? Or, does the tools your running have apps and send out a push notification or something.

There's a number of things that happen:
  1. Slack messages for everything - there are 2 "channels" that these go into. Medium alerts go into just a communication channel so developers can get a notification when they have time. Anything that's high priority or critical goes into a channel where every single developer and devops employee gets an immediate alert on their phone and on their computer. These are very hard to miss.

  2. Emails for everything - even if a slack message is sent, the developer email distribution group receives alerts for everything. The team have mail rules to manage these, but if they contain the word "critical" my phone freaks out and makes sure we all know.

  3. SMS - we have text message alerts for a few things, but ultimately they end up coming in 1-3 seconds after Slack messages in practice.
at the end of the day, Slack has become the most important tool in our suite of tools.
We get notifications for code commits, product deployments, client creations, errors on any client website, resource usage, continuous integration test results, etc - it's my hub for the pulse of the entire development team, including all of our infrastructure.

It's not cheap, but it works :D
 
Yeah, @craigh stole my Pingdom post thunder! ;-)

stole_my_thunder_dog_tshirt.jpg
 
I've been using a tool called Uptime Robot for about a year now. There is a free tier that pings your website(s) every 5 minutes, or there are paid plans for more intense uptime monitoring. Even on the free plan, you can add up to 50 URLs for it to ping. It sends me email alerts, so I know immediately when my sites are down. I'm not sure exactly what they mean by "every 5 minutes," because I sometimes get two emails within a couple minutes saying my site was down, then back up. It has been working great for me, and free is best!

https://uptimerobot.com/
 
Last edited: