centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
308 stars 270 forks source link

Cannot find metric(s) that match type = "alloydb.googleapis.com/instance/cpu/maximum_utilization #4960

Open drapiti opened 3 months ago

drapiti commented 3 months ago

Hello we are trying to access the following alloydb metric on the gcp api however it doesn't seem to find the metric where the dimension name has a specific cluster_id(instance name). Is the alloydb api working?

/usr/lib/centreon/plugins/centreon_gcp_management_stackdriver_api.pl --plugin=cloud::google::gcp::management::stackdriver::plugin --mode=get-metrics --key-file=test.json --instance-key='Instance/instance/cpu/maximum_utilization' --dimension-name='metric.labels.cluster_id' --dimension-operator=equals --dimension-value='cavltg0ew12s00' --metric='instance/cpu/maximum_utilization' --api='alloydb.googleapis.com' --warning-metric='90' --critical-metric='95' --verbose --proxyurl= http://10.244.5.20:9090 --http-backend='curl' --zeroed --insecure --debug

Cannot find metric(s) that match type = "alloydb.googleapis.com/instance/cpu/maximum_utilization" label = cluster_id. If a metric was created recently, it could take up to 10 minutes to become available. Please try again soon.

As far as we can see from the GCP documentation there is an extra "Instance" in the api, not sure if this is to be added in instance-key: image

we have tried different combinations to no avial, can anyone point me in the right direction. Thanks.

drapiti commented 3 months ago

small update the dimension name does not use a metric label but rather a resource label. Therefore we have:

[root@sglcl0027 ~]# /usr/lib/centreon/plugins/centreon_gcp_management_stackdriver_api.pl --plugin=cloud::google::gcp::management::stackdriver::plugin --mode=get-metrics --key-file=/opt/centreon/plugins/gcp/test.json --dimension-name='resource.labels.cluster_id' --dimension-operator=equals --dimension-value=cavltg0ew12s00 --metric='instance/cpu/maximum_utilization' --api='alloydb.googleapis.com' --warning-metric='90' --critical-metric='95' --verbose --proxyurl= http://10.244.5.20:9090 --http-backend='curl' --aggregation='average' --zeroed --insecure

Use of uninitialized value in string eq at /usr/lib/centreon/plugins/centreon_gcp_management_stackdriver_api.pl line 8947. OK:

however now we have an uninitialized value error.

drapiti commented 3 months ago

The api call works in postman so it seems the centreon plugin is not correctly forming the api call. Anyone have any ideas?

curl --location --request GET 'https://monitoring.googleapis.com/v3/projects/projectname/timeSeries?aggregation.alignmentPeriod=60s&interval.endTime=2024-03-25T15:10:00Z&interval.startTime=2024-03-25T15:00:00Z&filter=metric.type%20=%20%22alloydb.googleapis.com/instance/cpu/maximum_utilization%22%20AND%20resource.labels.cluster_id%20=%20%22cavltg0ew12s00%22' \ --header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'