Managed DNS Express: Fast, reliable DNS without breaking the bank. Get your first month FREE today! Get it now

Your Current Language Is:

Power Outages: Using DynDNS Pro To Get Updates Faster Than Your Power Company Can

By

Sr. Business Systems Analyst

As many of you know, the northeastern portion of the United States experienced a major winter storm this past weekend. As a result of the early snowfall, millions of people lost power at their homes and businesses — Dyn and its employees included. While this event did not have any negative effect on our services to customers, many Dyners have been staying with other employees, friends and family who do have power and heat.

However, we’ve noticed that the local power companies do not always provide timely updates on when the lights will go back on. After a few hours or days in the dark, many people start asking two questions:

  1. When is power going to be restored to my area?
  2. Does my home currently have power?

The answer to the first question is often up to your power company. Hopefully, their emergency response teams provide accurate Estimates-to-Recovery (ETR). To answer the second question, through a clever use of our DynDNS Pro service, you can set up a quick script to check from any smartphone on whether your home or business has power (and Internet).

To accomplish this, you’ll need a few things.

  1. A DynDNS Pro account
  2. A computer, router or other device on your local network updating your IP address to the Dyn’s systems.
  3. A computer running a web server which can be accessed outside of your network (such as Apache) and optionally, some sort of scripting language. In this example, I use PHP.
    1. Note: The computer needs to be set to auto-restart after a power failure (this can be set in BIOS on a PC or on a Mac in System Preferences/Energy Saver on your computer)
    2. An HTML file or other script loaded on your webserver which you can access from outside your network.
    3. A smartphone or computer on a completely different network with Internet access to check your DynDNS Pro host name.

Let’s get started

The basic principle is that once your home or business’ power has been restored, your computer will turn on automatically and start the webserver. Along with this, your Internet provider (cable or DSL modem) and networking equipment should also turn on once power is restored. Note that I am making the broad assumption that your Internet service comes online at the same time as power, which may not always be the case.

When your computer or router turns on, it should then update your new IP address with Dyn’s systems. Once everything is up and running, you can then point a web browser from your smartphone or another computer to your DynDNS host name and path where you installed the HTML file or script.

If all goes well, you will see something like this:

Dyn - Power On

Hooray, your power and Internet are on! In my example (see code below), I also wanted to know how long the power has been on.

If the power is still off, you will see something like this:

Dyn - Power Off

Unfortunately, you will still need to be nice to your hosts for at least a few more hours.

The Code

I’m a finance guy who knows just enough PHP to be dangerous. So I crafted the following basic script to let me know if the power is on. I put this into an index.php file so that I could know how long my server has been turned on.

	//Script to get server uptime
  	$shellcommand = shell_exec('uptime');
  	$uptime = explode(' up ', $shellcommand);
  	$uptime = explode(',', $uptime[1]);
  	$uptime = $uptime[0].', '.$uptime[1];

  	echo ('Server uptime: ' . $uptime . '');

Other Uses

Obviously, you don’t need to only use a web server. Dyn has many customers who use DynDNS Pro accounts to access weather stations, web/security cameras, home automation and other services. If you use your DynDNS Pro account for any other service and can access these remotely, you’ll also know your home has power.

Good luck and on behalf of Dyn and all of its employees, we hope you and your family get your power restored soon (if not already) if you were affected by this weekend’s storm.

David DePiano is a Sr. Business Systems Analyst for Dyn, the world leader in Internet performance solutions. Follow him on Twitter: @DDepiano and @Dyn.