AT&T M2X Partner Ruby


Get your AT&T M2X based project off the ground quickly using sample app code and deploy in one-step.


AT&T M2X is a cloud-based fully managed time-series data storage service for network connected machine-to-machine (M2M) devices and the industrial Internet of Things (IoT). From trucks and turbines to vending machines and freight containers, M2X enables the devices that power your business to connect and share valuable data.

This QuickStart contains several demo applications that report data to AT&T M2X:

  • A Ruby application that reports the system load (on 1-minute, 5-minute, and 15-minute averages, as reported by uptime) to M2X every minute.
  • A Python application that reports the current stock price of AT&T's stock (ticker symbol "T") every minute.

All the steps required to set up all demos are in .openshift/action_hooks/deploy, so if you want to replicate any part of this setup on your own systems, you can easily see what we've done.

Please note that the virtual machine and M2X are using times in UTC, not in your local time zone.


You will need an account on AT&T's M2X service, which has a free Developer plan and usage based paid plans for higher volumes of data. Check out the M2X Pricing page for more details.


After you deploy your app you'll need to get your M2X API Master Key. Log into M2X, and click your name in the upper right-hand corner, then the "Account Settings" dropdown, then the "Master Keys" tab. Here's a direct link.

Then you'll need to send those changes to OpenShift:

rhc env set M2X_API_KEY=long-string-of-master-key-here

Ruby Demo

You should now be sending data on 1-minute, 5-minute, and 15-minute load averages from your OpenShift application to AT&T M2X. It should be updating every minute, and if you refresh your AT&T M2X "loadreport-openshift" Device page, you should be able to click each load average and see graphs showing your load averages over time.

If not, you can look at loadreport.log in the $OPENSHIFT_LOG_DIR, which records any errors in sending the data to M2X. You can also SSH to the OpenShift gear with the rhc ssh command to run standard Linux/Unix troubleshooting commands.

Python Demo

Your should now be reporting the price of AT&T's stock to AT&T M2X every minute. (Please note that the NYSE is open from 9:30 AM to 4 PM Eastern Time, and the stock price reported outside those hours will not change.)

If there are any errors from, they will be logged in stockreport.log in your $OPENSHIFT_LOG_DIR directory, or you can rhc ssh to the OpenShift gear for troubleshooting.


This library is released under the MIT license. See LICENSE for the terms.

ruby-1.9|ruby-2.0, cron-1.4