Arduino Network Uptime Monitor with Twitter Updates

We’ve been looking for excuses to use our Arduino Ethernet shield in more projects recently; we had the idea today to see if we could get it monitoring our network servers and report the status of them to Twitter.

It was actually surprisingly easy; we had the Twitter posting code from the previous project and we found an Arduino ICMP library so that we could test a ping to the hosts and see if it was responding or not, we added this to our task scheduling code and the rest just fell into place.

So, what’s needed?

  • Arduino
  • An Arduino Ethernet Shield
  • Twitter Library
  • ICMP Ping Library by Blake F

Click on any of the above links to download them. In order to use the Twitter library you will need to generate a Secret Token for your Twitter account – There are instructions on how to do this on the library page linked above. You will also need to place both the Twitter library and ICMP Ping library in your Arduino Libraries folder (or import it via the menu in the IDE).

That’s about it really for the set-up, the actual code to make this work is all posted below:

The first thing you’ll need to do is change your IP/DNS/Gateway for the Ethernet shield on your network, after you have done this you will need to enter your Twitter Secret that you created earlier; this is so that it can authenticate with Twitter properly without needing your username/password.

You’ll notice that the servers are in a struct; so you’ll need to enter a friendly name and IP address of the host you wish to monitor, as well as increase the size of the array if you’re adding more hosts. Adding hosts is as simple as changing the servers serverList[3]; to servers serverList[x]; where x is the number of hosts you wish to monitor. You can add more hosts by using the function below in the setup() section of the sketch:

We’ve had this running on our test Twitter account for a couple of hours and it seems to be running well, the only downside is that if you choose a large name for the host and you go over the 200 Twitter character limit then you will not see all of the data, this could be easily modified to give a summary of servers instead of full names though.

Leave a Comment