Skip to main content

Google Storage

Plugin-Pack Assets​

Monitored Objects​

The Plugin-Pack Google Storage collects metrics for:

  • Bucket

Discovery rules​

The Centreon Plugin-Pack Google Storage includes a Host Discovery provider to automatically discover storages for a given Google Cloud Project.

This provider is named Google Storage:

image

Note that the key file must be deployed on the Poller(s) expected to discover GCP assets.

More information about the Host Discovery module is available in the Centreon documentation: Host Discovery

Collected Metrics​

For all collected metrics, we can choose the aggregation: average, minimum, maximum and total.

Metric nameDescriptionUnit
bucket_name~aggregation#storage.bucket.objects.countNumber of objects
bucket_name~aggregation#storage.network.received.volume.bytesCount of bytes received over the networkB
bucket_name~aggregation#storage.network.received.volume.bytespersecondCount of bytes received per second over the networkB/s
bucket_name~aggregation#storage.network.sent.volume.bytesCount of bytes sent over the networkB
bucket_name~aggregation#storage.network.sent.volume.bytespersecondCount of bytes sent per second over the networkB/s

Prerequisites​

Google Cloud Configuration​

Configure a service account key (download its private key as a JSON file) for which the following privileges have to be granted:

Google ScopeDescription
https://www.googleapis.com/auth/cloud-platformView and manage your data across Google Cloud Platform services

How to create a service account key: https://developers.google.com/identity/protocols/oauth2/service-account

Centreon​

Deploy the key file on every Poller expected to monitor Google Cloud resources. The key file should be readable by centreon-engine poller.

Setup​

  1. Install the Centreon Plugin on every Poller:
yum install centreon-plugin-Cloud-Gcp-Storage-Api
  1. On the Centreon Web interface in "Configuration > Plugin packs > Manager", install the Google Storage Plugin-Pack

Host configuration​

  • Add a new Host and apply the Cloud-Gcp-Storage-custom Host Template

Once the template applied, some Macros have to be configured:

MandatoryNameDescription
XGCPKEYFILEPATHService account key json file
XGCPSCOPEENDPOINTGoogle Scope. Default: https://www.googleapis.com/auth/cloud-platform
XGCPDIMENSIONNAMEThe name of the dimension to filter on. Default: resource.labels.bucket_name
XGCPDIMENSIONOPERATORDefine the type of filter match to use. Default: equals
XGCPDIMENSIONVALUEName of the bucket you want to monitor.
PROXYURLConfigure proxy URL
GCPEXTRAOPTIONSAny extra option you may want to add to every command_line (eg. a --verbose flag)
DUMMYSTATUSHost state. Default is OK, do not modify it until you know what you are doing
DUMMYOUTPUTHost check output. Default is 'This is a dummy check'. Customize it with your own if needed

Service account key file must be stored on Centreon Poller. centreon-engine user account must have read privileges on that file.

FAQ​

How to test the Plugin and what are the main options for?​

Once the plugin installed, log into your Centreon Poller CLI using the centreon-engine user account and test the Plugin by running the following command:

/usr/lib/centreon/plugins/centreon_gcp_storage_api.pl \
--plugin=cloud::google::gcp::storage::plugin \
--mode=bucket \
--key-file=/var/lib/centreon-engine/centreon-dev-6e5531fc9e82.json \
--dimension-name='resource.labels.bucket_name' \
--dimension-operator='equals' \
--dimension-value='centreon-dev.appspot.com' \
--aggregation='average' \
--warning-bucket-objects='1000' \
--critical-bucket-objects='2000' \
--verbose

Expected command output is shown below:

OK: Instance 'centreon-dev.appspot.com' aggregation 'average' metrics objects: 0.00, received: 0.00 B, sent: 382.00 B | 'centreon-dev.appspot.com~average#storage.bucket.objects.count'=0.00;0:1000;0:2000;0; 'centreon-dev.appspot.com~average#storage.network.received.volume.bytes'=0.00B;;;0; 'centreon-dev.appspot.com~average#storage.network.sent.volume.bytes'=382.00B;;;0;
Checking 'centreon-dev.appspot.com'
aggregation 'average' metrics objects: 0.00, received: 0.00 B, sent: 382.00 B

The command above monitors bucket usage of a Google Storage (--plugin=cloud::google::gcp::storage::plugin --mode=bucket) identified by the name centreon-dev.appspot.com (--dimension-name='resource.labels.bucket_name' --dimension-operator='equals' --dimension-value='centreon-dev.appspot.com').

This command would trigger a WARNING alarm if number of objects is more than 1000 (--warning-bucket-objects='1000') and a CRITICAL alarm for more than 2000 (--critical-bucket-objects='2000').

All the options as well as all the available thresholds can be displayed by adding the --help parameter to the command:

/usr/lib/centreon/plugins/centreon_gcp_storage_api.pl \
--plugin=cloud::google::gcp::storage::plugin \
--mode=bucket \
--help

Why do I get the following result UNKNOWN: No metrics. Check your options or use --zeroed option to set 0 on undefined values ?​

This command result means that Google Cloud does not have any value for the requested period.

This result can be overriden by adding the --zeroed option in the command. This will force a value of 0 when no metric has been collected and will prevent the UNKNOWN error message.