Skip to main content

Google CloudSQL MySQL

Monitoring Connector Assets

Monitored Objects

The Monitoring Connector Google CloudSQL MySQL collects metrics for:

  • Cpu
  • Innodb
  • Network
  • Queries
  • Storage

Discovery rules

The Centreon Monitoring Connector Google CloudSQL MySQL includes a Host Discovery provider to automatically discover databases for a given Google Cloud Project.

This provider is named Google CloudSQL MySQL:

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
database_id~aggregation#database.cpu.utilization.percentageUtilization of the reserved CPU%
database_id~aggregation#database.cpu.reserved_cores.countNumber of cores reserved for the database instance

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-CloudSQL-MySQL-Api
  1. On the Centreon Web interface in Configuration > Monitoring Connector Manager, install the Google CloudSQL MySQL Monitoring Connector

Host configuration

  • Add a new Host and apply the Cloud-Gcp-CloudSQL-MySQL-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.database_id
XGCPDIMENSIONOPERATORDefine the type of filter match to use. Default: equals
XGCPDIMENSIONVALUEID of the database 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

WARNING: 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_cloudsql_mysql_api.pl \
--plugin=cloud::google::gcp::cloudsql::mysql::plugin \
--mode=cpu \
--key-file=/var/lib/centreon-engine/centreon-dev-6e5531fc9e82.json \
--dimension-name='resource.labels.database_id' \
--dimension-operator='equals' \
--dimension-value='centreon-dev:centreon-mysql' \
--aggregation='average' \
--warning-utilization='90' \
--critical-utilization='95' \
--verbose

Expected command output is shown below:

OK: Instance 'centreon-dev:centreon-mysql' aggregation 'average' metrics cpu utilization: 2.40 %, cpu reserved cores: 1.00 | 'centreon-dev:centreon-mysql~average#database.cpu.utilization.percentage'=2.40%;0:95;;0;100 'centreon-dev:centreon-mysql~average#database.cpu.reserved_cores.count'=1.00;;;;
Checking 'centreon-dev:centreon-mysql'
aggregation 'average' metrics cpu utilization: 2.40 %, cpu reserved cores: 1.00

The command above monitors cpu usage of a Google MySQL instance (--plugin=cloud::google::gcp::cloudsql::mysql::plugin --mode=cpu) identified by the name centreon-dev:centreon-mysql (--dimension-name='resource.labels.database_id' --dimension-operator='equals' --dimension-value='centreon-dev:centreon-mysql').

This command would trigger a WARNING alarm if cpu utilization is more than 90% (--warning-utilization='90') and a CRITICAL alarm for more than 95% (--critical-utilization='95').

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_cloudsql_mysql_api.pl \
--plugin=cloud::google::gcp::cloudsql::mysql::plugin \
--mode=cpu \
--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.