3

I'm wondering if there is any way to have my device's state data that is sent through Google IoT Core show up in Stackdriver, possibly as a custom metric.

Essentially, I would like to use Stackdriver to monitor my devices but rather than deploy the agent to all of them I could leverage the existing and secure connection that exists because they are connected to IoT Core. I could publish an MQTT message to the state topic from the device with some relevant information (e.g., CPU percentage, number of processes running, etc). Then I could use Stackdriver to visualize and alert when something looks wrong.

From what I can tell, I can only monitor basic things about IoT Core in Stackdriver like how many bytes have been sent. I can read the state data by subscribing to the telemetry topics in Google Cloud Pub/Sub but then the challenge is getting that data into Stackdriver.

Any ideas?

Matt Dodge
  • 10,833
  • 7
  • 38
  • 58

1 Answers1

3

I hear ya. There are some potential concerns around logging content (state, telemetry, etc) of any kind from IoT Core. As you've found (and for anyone else seeing this answer) the metrics we log can be found here:

https://cloud.google.com/monitoring/api/metrics_gcp#gcp-cloudiot

At least in terms of what you're looking to do, take a look at this tutorial:

https://cloud.google.com/community/tutorials/cloud-iot-rtdp

It does what you're describing (with a little tweaking) that might at least easily give you a solution to what you want to do.

Gabe Weiss
  • 3,134
  • 1
  • 12
  • 15
  • Great, thanks for this answer. The better architecture does seem to be to get this data into Big Query. I'm finding that Stackdriver isn't as well suited to be an all around monitoring tool. So at least visualizing and storing the state data gets us part of the way there. – Matt Dodge May 10 '18 at 16:37
  • There are some folks that use Stackdriver as their 100% monitoring tool, but I've found (at least myself and the folks I chat with) that it's rare that you ONLY want to monitor things. And if you're going to do stuff to the data anyway, may as well set it all up on the downstream tools. – Gabe Weiss May 11 '18 at 20:51