5

I'm currently exploring more and more of Google Cloud Platform and try to evaluate how I can change my default stack. I like the idea of using all the built-in tooling instead of having to go to various Saas products. One of the more open questions has been how to make use of Stackdriver Monitoring. I understand that the built-in monitoring uses Heapster with the Google Cloud Sink. However, how do I expose my own custom metrics to Stackdriver for use? I don't mean the logs-based metrics, but the real thing?

I know I could always install the agent myself onto the cluster, but it appears to me that as part of Google Container Engine, it is already running, so how could I push metrics to it?

nambrot
  • 2,551
  • 2
  • 19
  • 31

3 Answers3

1

The fluentd pod pre-installed in GKE is in kube-system namespace and managed by k8s, so you shouldn't mess with it. Currently it seems only proxying stdout/stderr to Stackdriver. But according to this post, k8s team is working on providing accessible node-wide fluentd port out of the box.

This document has details about setting up custom logging.

Community
  • 1
  • 1
Ken Chen
  • 691
  • 3
  • 16
  • As I asked in my other question https://stackoverflow.com/questions/43451973/google-container-engine-logging-to-stackdriver-error-reporting, Stackdriver Error Reporting is indeed already doable with the built-in integration of fluent-d that listens to stdout. However, what's unclear to me is whether Stackdriver Monitoring can do the same. Unless I'm misunderstanding your comment about fluentd being accessible – nambrot Jun 02 '17 at 20:13
  • I meant currently making changes to pre-installed pods are not supported so it is not practical to add custom metrics. The pre-installed fluentd is configured to stream stdout/stderr to stackdriver error report so when you output to stdout/stderr, it will go to stackdriver. But monitor metrics is different things. – Ken Chen Jun 05 '17 at 03:55
  • Yeah I was afraid that was the case. I guess my only hope for out of the box integration is for Kubernetes to expose monitoring somehow and have stackdriver automatically consume that for application metrics – nambrot Jun 06 '17 at 14:51
1

To answer my own question, the best strategy for now seems to be using https://github.com/GoogleCloudPlatform/k8s-stackdriver/tree/master/prometheus-to-sd

nambrot
  • 2,551
  • 2
  • 19
  • 31
-2

I think GCP already give us related docs, see Using Custom Metrics

Crazykev
  • 392
  • 1
  • 9
  • 1
    Crazykev, could you elaborate? I'm not sure how I can log custom metrics without installing the agent myself. Ideally, I would like to reuse the mechanism that GKE provides, but as far as I can tell, that is not possible? – nambrot Apr 30 '17 at 09:27