<p>I'm using Kubernetes on Google Compute Engine and Stackdriver. The Kubernetes metrics show up in Stackdriver as custom metrics. I successfully set up a dashboard with charts that show a few custom metrics such as "node cpu reservation". I can even set up an aggregate mean of all node cpu reservations to see if my total Kubernetes cluster CPU reservation is getting too high. See screenshot.</p>

<p><a href="https://i.stack.imgur.com/ilrKd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ilrKd.png" alt="enter image description here"></a></p>

<p>My problem is, I can't seem to set up an alert on the mean of a custom metric. I can set up an alert on each node, but that isn't what I want. I can also set up "Group Aggregate Threshold Condition", but custom metrics don't seem to work for that. Notice how "Custom Metric" is not in the dropdown.</p>

<p><a href="https://i.stack.imgur.com/sF4fn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sF4fn.png" alt="enter image description here"></a></p>

<p>Is there a way to set an alert for an aggregate of a custom metric? If not, is there some way I can alert when my Kubernetes cluster is getting too high on CPU reservation? </p>

<p>alerting on an aggregation of custom metrics is currently not available in Stackdriver. We are considering various solutions to the problem you're facing.
Note that sometimes it's possible to alert directly on symptoms of the problem rather than monitoring the underlying resources. For example, if you're concerned about cpu because X happens and users notice, and X is bad - you could consider alerting on symptoms of X instead of alerting on cpu. </p>
