Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
drapiti opened this issue Mar 22, 2024 · 3 comments

Comments

@drapiti
Copy link

drapiti commented Mar 22, 2024

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
Copy link
Author

drapiti commented Mar 22, 2024

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
Copy link
Author

drapiti commented Mar 27, 2024

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'

@lucie-dubrunfaut
Copy link
Contributor

Hello :)

From what I understand, even if the API allows access to the instance/cpu/maximum_utilization metric, you are unable to use the plugin on this metric? Can you tell me if the mode worked for your situation with one or more other metric(s)?
Regarding the second point, it seems that the dimension-name option does not support the resource variable either in the plugin or in the API request itself.
Would you be willing to provide us with the curl command as well as the JSON return for the desired API call to allow us to troubleshoot this issue? (I didn't really understand if the curl command in the last comment just above was functional or not?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants