NearTheX – Nutanix monitoring app integrated with iBeacon technology

By Jason Langone

What is iBeacon?

It is not iBacon.

iBeacon is a technology being heavily showcased at CES right now that delivers indoor positioning capabilities to mobile devices. Previously, location-awareness in mobile devices has primarily been delivered based on GPS coordinates, but GPS often struggles indoors and is not very accurate (accurate to a city block, not to the trash can in the corner of your office). iBeacon and other indoor positioning devices use Bluetooth low-energy radio modules with a range of up to 75 feet and are very sensitive in terms of range (in a good way); this means an iBeacon can tell if I’m 50 feet away (far), 20 feet away (near), or 3 feet away (immediate).

Here you can read how Apple began rolling out iBeacons at its 254 US retail stores or how grocery stores are implementing iBeacons to deliver a more rich shopping experience (or cheaper, with geo-coupons).

What is NearTheX

“Walking the datacenter floor” is a routine admin task where an IT administrator walks around the datacenter looking for orange lights. Orange lights might indicate a failed drive or power supply, but that’s often the extent of the information they relay. Some servers or blade chassis have clumsy LCD panels in the front that are often hard to read, positioned at difficult angles, or unpleasant to use. NearTheX, a play on the X in the Nutanix logo, is an iOS app that integrates with a Bluetooth beacon in your rack(s) of Nutanix gear.

As you walk through the datacenter and get near your Nutanix gear, or, “near the X,” your app is updated with the current health of the Nutanix cluster.

How is this done? Through the Nutanix Prism API, of course!

The app’s workflow looks like this (for hardcore techies, code examples are below):


Nothing crazy here. Login to your NearTheX account.

Two-way mirroring

Your profile is loaded. It pulls:

  • Your associated (if applicable) Nutanix beacon ID
  • Number of outstanding support requests according to SFDC
  • Your current Nutanix certification level according to SFDC
  • Your bio, as defined by you, including picture and banner wallpaper
  • The Nutanix models you currently have according to the Nutanix Prism API
    • In this example, I’ve got NX-3xxx and an NX-7xxx but no NX-6xxx nodes. Remember, you can mix and match Nutanix models together in a single cluster. #sheikclass

The Beacon component can be manually called or automatically launched when in range.

You’ll notice that there’s currently no data.  “Ranging” is beacon-speak for searching for a beacon transmitter.  Now, as I walk down the row of racks in my datacenter, as soon as I get close enough to my Nutanix gear, VIOLA!

The very small text along the bottom was primarily for my testing but shows the existence of a configured beacon UUID (each beacon has its own UUID), the UUID itself, and the current range (undetermined, near, immediate, etc.)

Upon getting in range, NearTheX places an API call to Nutanix Prism and receives a JSON file. That JSON file is parsed and delivers the data (poc03, SO BOSS, 5, etc.) that you see above.

Want to learn more about iBeacon, Nutanix Prism API calls, or JSON parsin?

Let’s do this.

The Data Structure of Nutanix Prism API

From the Nutanix UI, go to Admin à REST API Explorer.

This is a gem and guides you through the many calls you can make to access data you care about.

For me I’m most concerned with cluster health.  So click /cluster to get all the options.  Again, I’m most concerned with just plain ole’ cluster details.

Now you start to get to the gems.  Here’s the URL I’ll need to use in my app (

You also see under, “Response Body” what the returning JSON file will look like.


Getting Data from Nutanix Prism API

The code below sets up making a call (essentially sending the URL we determined above) to the Nutanix Prism API and getting the JSON response.

Background task so we aren’t waiting for synchronous tasks to complete (bad UX):

Great. Now lets load up the JSON response into a way we can mess with it.

Let’s look at the first part of the JSON response from Nutanix Prism API:

For the NearTheX app we populate the cluster name field. That corresponds with “name” in the above JSON.


Pretty damn easy, simply create a new NSString variable (or use an existing one), JSONname, and then pull the value from the JSON for the “name” key.

You can use NSLOG to dump the text to the console for quick double-checking. For the record, JSONname is now equal to “poc03” which is the name of our nearby Nutanix cluster. Sweet.

If you wanted to update the text in the iOS app’s UI un-comment the beaconClusterName.text line. beaconClusterName is an IBOutlet assigned to a LABEL in our UI (done via Storyboard). If this was Greek to you just go find a tutorial on building your first iOS app. It will cover this for you.

Now do the same thing to determine the number of nodes in your cluster.

NOW THE TRICKY PART. Grab a drink.

Let’s get the value for avg_io_latency_usecs, to determine if the cluster is performing OK and there aren’t any weird issues going on. Average latency seems like a decent metric for this judgment.

The above two values (name and numNodes) were damn easy to grab out of the JSON file because they were parent keys. Look at JSON Example_1:

Pretty simply. Now look what is returned for objectForKey:@”stats”:

Lots more going on, and if you look at it in the context of the larger JSON file in full, it starts to get a bit nested. So to get our value we are going to have to load up the “stats” key in a NSDictionary and pull nested data from there.

Here we load up the XML for, “stats” and then pull the value from “avg_io_latency_usecs”. Again, I dump it to the console for quick checking. Since we pulled the latency as a string variable let’s go ahead and convert it to an integer (last line of the code snippet).

Why convert to an integer? Well because now we can make mathematical comparisons and do something with them.

So if the latency is less than 30ms then let’s call the cluster healthy (aka SO BOSS). Otherwise, it needs to see a doctor.

A note about iBeacon.

This post has already dragged on long enough, but if you are interested in coding for beacons I’d strongly suggest learning CLLocationManager. A bit of code to run with:

Below is a rough outline of the workflow of the app.


This app took me 3 nights to code (and that includes writing this blog post). I’m a pretty lousy coder so someone more familiar with obj-c could crank this out over a long lunch break probably.

iBeacons and the ability to use geo-fencing technologies in an app offer up new possibilities. Update me to the health of my Nutanix gear when I walk by it. Get a cool offer when you walk up to our tabletop at an event.

Interacting with Nutanix in a programmatic way through our API could not be easier. Our engineers built a beautiful interface to navigate through all the API possibilities. I read ZERO documentation on the Nutanix Prism API, I just poked around the explorer and channel my inner Steve Poitras.

Stay tuned for a Nutanix Hangout in the near future we we’re going to build an app that talks to Nutanix Prism API in 25 minutes.