Skip to main content

We are encountering an issue regarding the retrieval of metrics from Google Cloud Monitoring into Centreon. Specifically, some metrics do not appear to be correctly interpreted—particularly those returned in a distribution format.

When querying the Cloud Monitoring API, we receive values in the following format:

json

"value": {

  "distributionValue": {

     "count": "2",

     "mean": 0.4811553955078125,

     "sumOfSquaredDeviation": 0.0042963802115991712,

     "bucketOptions": { 

        "linearBuckets": {

           "numFiniteBuckets": 100,

           "width": 0.01 

         }

      }

   }

}

Centreon appears to expect a single value, such as those of type int64, rather than an aggregated distribution. Could you confirm whether this type of format (distribution) is supported? If not, is there a configuration or method that would allow us to extract a more usable value from this data?

I think we’re missing a bit of context in order to help. Could you share more details on how you are retrieving those metrics exactly? (which check, plugin, template are you using, and what parameters are you passing?). It would help if you could share the full check command you are using and the debug/verbose response you get. You can add the parameters --debug and --verbose to the check command.


### We are using the following Centreon plugin command:
"

/usr/lib/centreon/plugins//centreon_gcp_management_stackdriver_api.pl \
--plugin=cloud::google::gcp::management::stackdriver::plugin \
--mode=get-metrics \
--key-file='/path/to/your/gcp-key.json' \
--scope-endpoint='https://www.googleapis.com/auth/cloud-platform' \
--http-backend=curl \
--dimension-name='resource.labels.url_map_name' \
--dimension-operator='equals' \
--dimension-value='example-urlmap' \
--api='loadbalancing.googleapis.com' \
--metric='https/frontend_tcp_rtt' \
--timeframe='900' \
--aggregation='maximum' \
--debug 
 

### Actual Result: The result returned is not readable and appears as a Perl hash reference: OK: Metric 'https/frontend_tcp_rtt' of resource 'example-urlmap' value is HASH(0x56068dd1a8d8)


This seems to be due to the fact that the metric is of type DISTRIBUTION, and Centreon does not properly parse or extract a usable value (like the mean).

Here is an excerpt of the actual JSON response from the GCP API:

"value": {
  "distributionValue": {
    "count": "69",
    "bucketOptions": {
      "exponentialBuckets": {
        "numFiniteBuckets": 66,
        "growthFactor": 1.4,
        "scale": 1
      }
    },
    "bucketCounts": ,
      "69"
    ]
  }
}


ah ok

so that is absolutely not what I was talking about then

 

I personnaly don’t use that plugin so I don’t have experience with it, you really should post that on the plublic forum here on the watch, or you can also open an issue on the github, sometimes it is faster as the centreon devs are more aware of the problem there

 

here is an example issue for your plugin wcloud::google::gcp::management::stackdriver::plugin] - mode(get-metrics): Cannot find metric(s) that match type = "alloydb.googleapis.com/instance/cpu/maximum_utilization · Issue #4960 · centreon/centreon-plugins 

just create a new  issue with the same type of subject syntax

 

also try to run your command with  --debug that will give you more details to post here or on github, (beware to mask your tokens/private info)


Reply