---
title: "Host Template: Cloud - GCP - MySQL"
description: ""
url: "https://docs.itrsgroup.com/docs/opsview/6.11.7/opspacks/cloud-gcp-opspack/cloud-gcp-mysql-host-template/index.html"
---## Overview

Monitor your GCP Cloud MySQL resources, with Service Checks including CPU, Disk and Memory Usage, Network Bytes, Connections, Queries and Sent and Received Bytes.

This Host Template includes the following Service Checks:

| Service&nbsp;Check&nbsp;Name | Description | Default&nbsp;Thresholds (Metric:&nbsp;Warning,&nbsp;Critical) | UOM |
|:-----------------------------|:------------|:------------------------------------------------:|:---:|
| GCP - MySQL - Network Bytes | Network received and sent bytes for the MySQL instance. | N/A | B |
| GCP - MySQL - Disk Operations | Disk read and write operations for the MySQL instance. | N/A | N/A |
| GCP - MySQL - Database Availability | Database uptime percentage over the period checked for the MySQL instance. | availability: &#8203;`100:`,`80:` | % |
| GCP - MySQL - Status | Current serving state of the MySQL instance. | N/A | N/A |
| GCP - MySQL - Memory Usage | Memory used by the MySQL instance. | memory_usage: &#8203;`70`,`90` | % |
| GCP - MySQL - Disk Usage | Disk used by the MySQL instance. | disk_usage: &#8203;`70`,`90` | % |
| GCP - MySQL - CPU Usage | CPU used by the MySQL instance. | cpu_usage: &#8203;`70`,`90` | % |
| GCP - MySQL - Queries | Number of received and executed MySQL queries on the MySQL instance. | N/A | N/A |
| GCP - MySQL - Bytes | Number of bytes received and sent by the MySQL instance. | N/A | B |
| GCP - MySQL - Network Connections | Number of network connections to the MySQL instance. | N/A | N/A |


**Note**


See details about [Monitoring Plugin thresholds here](https://www.monitoring-plugins.org/doc/guidelines.html#THRESHOLDFORMAT).



## Usage Instructions

Please review the overall [Cloud - GCP Opspack](https://docs.itrsgroup.com/docs/opsview/6.11.7/opspacks/cloud-gcp-opspack/cloud-gcp-opspack/index.html) documentation for details on prerequisites, known issues, and other necessary configurations that apply to all Host Templates in the Opspack.

### Add this Host Template

Add the **Cloud - GCP - MySQL** Host Template to your Opsview Monitor host.
If the resource you're monitoring has no hostname or public IP, then open the **Advanced** settings pane and change **Host Check Command** to **Always assumed to be UP**.


**Note**


For more information, refer to the documentation on [Adding Host Templates to Hosts](https://docs.itrsgroup.com/docs/opsview/6.11.7/host/index.html#host-templates).



### Add and configure Variables

The Service Checks in this Host Template use the following variables, and they will be added to your Opsview Monitor instance alongside the Host Template:

- [**GCP_PROJECT_ID**](#gcp_project_id)
- [**GCP_MYSQL_DATABASE_ID**](#gcp_mysql_database_id)
- [**GCP_CREDENTIALS_FILE**](#gcp_credentials_file)


**Note**


For more information, refer to the documentation on [Adding Variables to Hosts](https://docs.itrsgroup.com/docs/opsview/6.11.7/adding-a-new-variable/index.html#adding-a-variable-to-a-host).



### Apply Changes

Apply Changes and the system will now be monitored:

![View Output](https://docscdn.itrsgroup.com/opsview/images/opspacks-cloud-gcp-output-cloud-gcp-mysql.png)

## Additional Information

The SQL API Library must be enabled to use this host template. To do this, log into your SQL Admin API Library at [Google Console - APIs](https://console.developers.google.com/apis/api/sqladmin.googleapis.com), and click the **Enable** button. It may take some time until the API is fully active.

![GCP SQL API menu](img/gcp_sql_api.png)

## Available Variables

### GCP_PROJECT_ID

| Plugin&nbsp;Parameter | Position&nbsp;in Variable | Name | Description |
|:---------------------:|:-------------------------:|:-----|:------------|
| `--project-id` | Arg1 | Monitored Project ID | ID of the project to monitor |

### GCP_MYSQL_DATABASE_ID

| Plugin&nbsp;Parameter | Position&nbsp;in Variable | Name | Description |
|:---------------------:|:-------------------------:|:-----|:------------|
| `--mysql-database-id` | Arg1 | MySQL Database ID | ID of the MySQL database |

### GCP_CREDENTIALS_FILE


**Opsview Cloud**

 For Opsview Cloud customers, please contact [ITRS Support](https://www.itrsgroup.com/about/contact) for assistance with these steps, as they require Orchestrator access. 

This argument is **optional**, to be used if you have a credentials file in a custom location. We recommend not setting it, and relying on the default location as follows: Create your `credentials.json` file and run as opsview user `/opt/opsview/orchestrator/bin/orchestratorimportscripts etc-plugins cloud-gcp /path/to/credentials.json` followed by an Apply Changes to set it up with the correct permissions in the default location (`/opt/opsview/monitoringscripts/etc/plugins/cloud-gcp/credentials.json`) on all Opsview collectors.

**Note**

For more information on the credentials file, refer to [Create access credentials](https://developers.google.com/workspace/guides/create-credentials#create_credentials_for_a_service_account)


| Plugin&nbsp;Parameter | Position&nbsp;in Variable | Name | Description |
|:---------------------:|:-------------------------:|:-----|:------------|
| `--credentials-file` | Arg1 | Credentials File | Path of the JSON file with GCP Service Account Credentials |

## Plugin help

Plugin: `check_gcp`


**Plugin Security**


This plugin does not display arguments in the process list.



For mode-specific help, run the plugin with the `-h -m <mode>` flags. This will list the required and optional Variable Arguments for that mode.
The appropriate mode for each Service Check is listed here:

| Service&nbsp;Check&nbsp;Name | Mode |
|:-----------------------------|:-----|
| GCP - MySQL - Network Bytes | `GCP.MySQL.Net.Bytes` |
| GCP - MySQL - Disk Operations | `GCP.MySQL.Disk.Ops` |
| GCP - MySQL - Database Availability | `GCP.MySQL.Availability` |
| GCP - MySQL - Status | `GCP.MySQL.Status` |
| GCP - MySQL - Memory Usage | `GCP.MySQL.Mem.Usage` |
| GCP - MySQL - Disk Usage | `GCP.MySQL.Disk.Usage` |
| GCP - MySQL - CPU Usage | `GCP.MySQL.CPU.Usage` |
| GCP - MySQL - Queries | `GCP.MySQL.Queries` |
| GCP - MySQL - Bytes | `GCP.MySQL.Bytes` |
| GCP - MySQL - Network Connections | `GCP.MySQL.Net.Connections` |


