Pavel Madr
Pavel Madr

Reputation: 96

Google compute engine - balancing based on custom metric

I'm trying to have instance group on compute engine autobalanced according my custom metric. The google monitoring/api/v3 sample github source creates custom metric and I can see it in Stackdriver. Great!

But when I want to use that metric in my instance group, the group is not autoscaled. Only 1 instance is presented.

Am I doing autoscaler setup correctly?

gcloud compute instance-groups managed set-autoscaling $MY_GROUP \
     --max-num-replicas 2 --min-num-replicas 1 \
     --custom-metric-utilization metric=custom.googleapis.com/custom_measurement,utilization-target=3,utilization-target-type=GAUGE \
     --zone us-central1-f

Note: in custom_metric.py I have set INSTANCE_ID to id of my 1st VM instance and run custom_metric.py multiple times to simulate some data, because my test VM instance does nothing real.

Upvotes: 1

Views: 339

Answers (1)

d.ansimov
d.ansimov

Reputation: 2171

V3 API currently won't work with autoscaler, mate, only shows up in Stackdriver.

Note: Autoscaler does not yet support Google Cloud Monitoring V3.

If you want to scale on custom metrics - use V2 API. It's deprecated (and won't show up in Stackdriver), however, still one and only way to make autoscaler work on your own metrics. It's an answer I got today for support ticket.

Upvotes: 0

Related Questions