prometheus-community / stackdriver_exporter

Google Stackdriver Prometheus exporter
Apache License 2.0
257 stars 98 forks source link

No metrics from compute_engine #46

Open baboune opened 5 years ago

baboune commented 5 years ago

Hi,

Using latest stackdriver_exporter, I seem to have ran into an issue extracting metrics from Stackdriver.

I use a service account with the Monitoring Viewer role that I inject into a docker container.

docker run --rm -it -p 9255:9255  \
  -e GOOGLE_APPLICATION_CREDENTIALS=/certs/flames-dev-monitoring-stackdriver-sa.json \
  -e STACKDRIVER_EXPORTER_GOOGLE_PROJECT_ID="flames-dev" \
  -e STACKDRIVER_EXPORTER_MONITORING_METRICS_TYPE_PREFIXES="compute.googleapis.com/instance,pubsub.googleapis.com/subscription,redis.googleapis.com/stats" \
  -e STACKDRIVER_EXPORTER_MONITORING_METRICS_INTERVAL="1m" \
  -v /local/git/flames/flames-infrastructure-k8s-addons/workspace/json-sa/:/certs/ \
  frodenas/stackdriver-exporter --log.level="debug"

On port 9255/metrics, I can see that many pubsub metrics are available. E.g.

stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_num_retained_acked_messages{project_id="flames-dev",subscription_id="flames-service-event%us-central1%event-source-subscription",unit="1"} 0
stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_num_retained_acked_messages{project_id="flames-dev",subscription_id="flames-service-subscription%no-region%event-source-subscription",unit="1"} 0
stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_num_retained_acked_messages{project_id="flames-dev",subscription_id="gcf-cloudBuildSlackIntegration-cloud-builds",unit="1"} 0
stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_num_retained_acked_messages{project_id="flames-dev",subscription_id="gcf-orchestrationMWInitialStepTransform-orchestration.mw_step_convert",unit="1"} 0
stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_num_retained_acked_messages{project_id="flames-dev",subscription_id="gcr-triggers",unit="1"} 0
stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_num_retained_acked_messages{project_id="flames-dev",subscription_id="pp_mp_file_sub",unit="1"} 0
stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_num_retained_acked_messages{project_id="flames-dev",subscription_id="spinnaker",unit="1"} 0
stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_num_retained_acked_messages{project_id="flames-dev",subscription_id="spinnaker-gcr",unit="1"} 0

There are no errors from the stackdriver_exporter prometheus counter:

# HELP stackdriver_monitoring_last_scrape_error Whether the last metrics scrape from Google Stackdriver Monitoring resulted in an error (1 for error, 0 for success).
# TYPE stackdriver_monitoring_last_scrape_error gauge
stackdriver_monitoring_last_scrape_error{project_id="flames-dev"} 0

But, there are no metrics from either redis or compute.

I also tried with the example in the stackdriver_exporter, --monitoring.metrics-type-prefixes "compute.googleapis.com/instance/cpu,compute.googleapis.com/instance/disk" and do not get any values or instances.

What am I doing wrong?

pie-r commented 4 years ago

same problem on:

- name: STACKDRIVER_EXPORTER_MONITORING_METRICS_TYPE_PREFIXES
              value: "cloudsql.googleapis.com"

But Setting STACKDRIVER_EXPORTER_MONITORING_METRICS_INTERVAL="2m" it works.

I don't know why 1m gives no metrics. (no errors in log)

this issue is related: https://github.com/prometheus-community/stackdriver_exporter/issues/32

SuperQ commented 4 years ago

The default metrics interval is 5 minutes. I'm guessing 1m is too fast.

pie-r commented 4 years ago

@SuperQ where I can see that the default is 5m? is due to cloudsql? I already know that the exporter has 5m as default.

SuperQ commented 4 years ago

5m is the exporter default. I don't know why it's the default. The change to 5m was made with no additional comment0.

TamasNeumer commented 3 years ago

same problem on:

- name: STACKDRIVER_EXPORTER_MONITORING_METRICS_TYPE_PREFIXES
              value: "cloudsql.googleapis.com"

But Setting STACKDRIVER_EXPORTER_MONITORING_METRICS_INTERVAL="2m" it works.

I don't know why 1m gives no metrics. (no errors in log)

this issue is related:

32

Hi,

does it still work for you? I get metrics for "gce", but for cloudsql not... I'm using the latest `version="0.11.0"...

Update: