My Big Data “Pet” Project: How I used Splunk to be a better lizard parent

By |Published On: December 12th, 2017|

Areas that get heavy snowfall are susceptible to dangerous road conditions. This means that people end up trapped inside. So, what is there to do when this happens? Why not work on one of your pet projects? That’s exactly what I did for part of the first snowfall of the year in Connecticut.

Allow me to introduce you to the famed lizard from my niece’s 3rd grade class, and my new pet: Glitzy Whitaker.

Glitzy is a Green Anole that my niece “won”, named, and I ended up adopting. The jury is still out on if I actually “won” Glitzy, or if my niece just wanted a lizard and dropped it off at my house. Nevertheless, I don’t have any choice in the matter and I am therefore embracing my new parent status.

When I received this lizard, I did what any respectable parent would do: Started to worry. I had so many immediate questions. Could I afford this lizard child? Was I feeding this precious little angel enough? Was her tank nice and warm and cozy? I wanted to answer as many of these questions as I could. Of course, this is a Splunk-centered article, so you better believe there is some data coming to backup my terrific parenting skills.

Was I feeding Glitzy enough?

To answer this question, I had to first define “enough”. I was told when I adopted Glitzy that feeding her twice a week was the appropriate amount. That seems to align with most websites I read. Seeing as how I am not a reptile expert, I’m happy to hear any feedback anyone has on this number. I did look into a couple different websites and they told me this twice a week number was about right.

http://www.reptilesncritters.com/care-guide-brown-anole.html

http://lizardsandfriends.org/wp-content/uploads/2013/06/lizardcare_STI2013.pdf

So, how can I track feeding a Lizard with data? I’m sure there are many ways, but this one is actually somewhat manual so far. As it stands, I’m exporting a CSV of my credit card transactions at the local pet store. I’m not going to screenshot that process for obvious reasons.

The data collection is 90% done for me, as long as I purchase crickets with my credit card. I just need to copy and paste my transactions from my Credit Card’s website into a lookup table. This seems to work quite well so far for my needs. One really nice app to get this done is the Lookup File Editor app.

With the table populated, I can run a quick search to look at feeding times over time. I can actually use some fancy SPL to turn a date from a lookup table into a _time field to be used with the timechart command as shown below.

And, if I’m at work, and I can’t remember if I need to buy crickets, I just ask Alexa: “Alexa, Ask Splunk ‘When was the last time Ryan fed his Lizard?’”

Was Glitzy’s tank warm enough?

This was my favorite part of this project. I didn’t want to have a thermometer I had to manually read sitting on the side of the tank, I wanted to know how many rays of light my precious little lizard was soaking up, in real-time. I finally had a legitimate use case for building a circuit with a Raspberry Pi. The circuit was straightforward with great instructions that can be found here.

Once I had the circuit constructed, I slightly modified the script provided in the article mentioned above. This resulted in a very simple python script that could export data from my thermometer at a given internal.

Copy to Clipboard

With the script created, the rest of this was simple. I already had a Raspberry Pi up and running with the Splunk Universal Forwarder for my Coffee, so I just needed to create a small app that can be found here to run this script and send the data to my Splunk instance. So, what does that data look like?

Could I afford to take care of Glitzy?

This was a fun question to answer and I had to think through how I was going to do it. To start, I had to determine all of my costs. I figured my costs were limited to a couple of different things.

  1. What was it costing me to heat the tank?
  2. What was it costing me to feed Glitzy?

What was it costing me to feed Glitzy?

Figuring out cost of feeding this little beast was pretty straight forward. Like I said before, it is somewhat manual. So, finding that data was a matter of using my lookup table.

What was it costing me to heat the tank?

Measuring the cost of heating was fairly straightforward by using some of the technology I had already set up for my coffee blog. The TP-Link has proven to be a really versatile device and is capable of outputting some great data on a very regular basis. In my case, I have a power strip hooked up to it with both of my light bulbs and a heating pad. It looks something like this.

The reason I’m showing you this diagram is that even though there are three different devices here, the amount of kWh they are using, is all going to be recorded on the same TP-Link. As a result I can take the number of kWh from my TP-Link, multiply it by my cost per kWh ($0.0814) from my electric bill, and automatically I will have a cost of how much this tank cost me to run that day. As it turns out, this tank setup is quite inexpensive. Overall, the days I’m spending the most money on Glitzy, are the days I’m buying crickets.

Another benefit to this configuration is that even though these devices are all through the same TP-Link, they all have different electrical signatures. So the combination of any two devices should be unique. This way I can still determine when my Day light is on, and when the Night Light is on. This is extremely helpful if I can’t remember if I switched it. I can say to Alexa, “Alexa ask Splunk what light is on in the lizard tank?”

Share with your network!
Get monthly updates from Hurricane Labs
* indicates required

About Hurricane Labs

Hurricane Labs is a dynamic Managed Services Provider that unlocks the potential of Splunk and security for diverse enterprises across the United States. With a dedicated, Splunk-focused team and an emphasis on humanity and collaboration, we provide the skills, resources, and results to help make our customers’ lives easier.

For more information, visit www.hurricanelabs.com and follow us on Twitter @hurricanelabs.