Google Cloud

Google Cloud Platform, offered by Google, is a suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search, Gmail, file storage, and YouTube.

Available solutions

Zabbix version 8.0 7.4 7.2 7.0 6.4 6.0
Download

GCP by HTTP

Overview

This template is designed to monitor GCP by HTTP. It works without any external scripts and uses the script item. Currently, the template supports the discovery of Compute Engine instances, Cloud SQL instances (Microsoft SQL Server, MySQL, and PostgreSQL, including replicas), Cloud Run services, Application Load Balancers, Cost Monitoring, and Cloud Storage resources.

Included Monitoring Templates

  • GCP Application Load Balancer by HTTP
  • GCP Cost Monitoring by HTTP
  • GCP Compute Engine Instance by HTTP
  • GCP Cloud SQL MSSQL by HTTP
  • GCP Cloud SQL MSSQL Replica by HTTP
  • GCP Cloud SQL MySQL by HTTP
  • GCP Cloud SQL MySQL Replica by HTTP
  • GCP Cloud SQL PostgreSQL by HTTP
  • GCP Cloud SQL PostgreSQL Replica by HTTP
  • GCP Cloud Run Service by HTTP
  • GCP Cloud Storage Bucket by HTTP

The template additionally supports the collection of Compute Engine project quota metrics.

Requirements

Zabbix version: 8.0 and higher.

Tested versions

This template has been tested on:

  • Google Cloud Platform

Configuration

Zabbix should be configured according to the instructions in the Templates out of the box section.

Setup

  1. Enable the Stackdriver Monitoring API for the GCP project you wish to monitor.

More on enabling Monitoring API.

  1. Create a service account in Google Cloud Console for the same GCP project.

More on managing service accounts.

  1. Create and download the service account key in JSON format.

More on service account keys.

  1. If you want to monitor Cloud SQL services - don't forget to activate the Cloud SQL Admin API.

More on Cloud SQL Admin API.

  1. For monitoring Cloud Run services - activate the Cloud Run Admin API.

More on Cloud Run APIs.

  1. Copy the project_id, private_key_id, private_key, client_email from the JSON key file and add them to their corresponding macros {$GCP.PROJECT.ID}, {$GCP.PRIVATE.KEY.ID}, {$GCP.PRIVATE.KEY}, {$GCP.CLIENT.EMAIL} on the Zabbix template/host.

Notes

- Make sure that you're creating the Google Cloud Console service account using the credentials with the Project Owner/Project IAM Admin/Service Account Admin role.

- The service account JSON key file can only be downloaded **once**: regenerate it if the previous key has been lost.

- The service account should have Project Viewer permissions or granular permissions for the GCP Compute Engine API/GCP Cloud SQL/Cloud Run Viewer.

- You can copy and paste `private_key` string data from the Service Account JSON key file as is, or replace the new line metasymbol (`\n`) with actual line breaks.

Refer to the vendor documentation on managing access to service accounts.

IMPORTANT

 - The Zabbix secret authorization token (used for GCP API authentication) is defined as a plain text in host prototype settings by default due to template export/import limitations. It is highly recommended to change the user macro `{$GCP.AUTH.TOKEN}` value type to `SECRET` for all host prototypes after importing the *GCP by HTTP* template.

 - All the discovered instances/quotas/metrics are related to a particular GCP project. To monitor several GCP projects, create their corresponding service accounts and Zabbix hosts.

 - The GCP Access Token is available for 1 hour (3600 seconds) after the generation request.

 - To avoid GCP token inconsistencies between the Zabbix database and Zabbix server configuration cache, do not set the Zabbix server configuration parameter `CacheUpdateFrequency` above 45 minutes, and do not set the GCP authorization item update interval above 1 hour (the maximum `CacheUpdateFrequency` value).

More on metrics and used API methods:

Macros used

Name Description Default
{$GCP.PROJECT.ID}

GCP project ID.

{$GCP.CLIENT.EMAIL}

Service account client e-mail.

{$GCP.PRIVATE.KEY.ID}

Service account private key id.

{$GCP.PRIVATE.KEY}

Service account private key data.

{$GCP.AUTH.FREQUENCY}

The update interval for the GCP Authorization item, which also equals to the access token regeneration request frequency.

Check the template documentation notes carefully for more details.

45m
{$GCP.RUN.LOCATION.FILTER}

Cloud Run Service filter locations. If empty - all locations are monitored.

The value must be a string. The operator must be either =, !=, >, <, <=, >= or :.

Example: name="europe-west1" OR name="europe-north1" OR name="asia-southeast2", name!= "us-central1", name!= "me-*.

{$GCP.GCE.QUOTA.PUSED.MIN.WARN}

GCP Compute Engine project quota warning utilization threshold.

80
{$GCP.GCE.QUOTA.PUSED.MIN.CRIT}

GCP Compute Engine project quota critical quota utilization threshold.

95
{$GCP.DATA.TIMEOUT}

Response timeout for API.

15s
{$GCP.PROXY}

Sets HTTP proxy value. If this macro is empty, then no proxy is used.

{$HTTP.TLS.VERIFY}

TLS certificate verification for script items and JavaScript preprocessing: "none" - disabled, "peer" - verify the certificate chain and expiration, "full" - full verification. Any other value enables full verification. To override the setting for this template only, define the macro with the context "GCP", e.g. {$HTTP.TLS.VERIFY:"GCP"}.

full
{$GCP.GCE.INST.NAME.MATCHES}

The filter to include GCP Compute Engine instances by namespace.

.*
{$GCP.GCE.INST.NAME.NOT_MATCHES}

The filter to exclude GCP Compute Engine instances by namespace.

CHANGE_IF_NEEDED
{$GCP.GCE.ZONE.MATCHES}

The filter to include GCP Compute Engine instances by zone.

.*
{$GCP.GCE.ZONE.NOT_MATCHES}

The filter to exclude GCP Compute Engine instances by zone.

CHANGE_IF_NEEDED
{$GCP.MYSQL.INST.NAME.MATCHES}

The filter to include GCP Cloud SQL MySQL instances by namespace.

.*
{$GCP.MYSQL.INST.NAME.NOT_MATCHES}

The filter to exclude GCP Cloud SQL MySQL instances by namespace.

CHANGE_IF_NEEDED
{$GCP.MYSQL.ZONE.MATCHES}

The filter to include GCP Cloud SQL MySQL instances by zone.

.*
{$GCP.MYSQL.ZONE.NOT_MATCHES}

The filter to exclude GCP Cloud SQL MySQL instances by zone.

CHANGE_IF_NEEDED
{$GCP.MYSQL.INST.TYPE.MATCHES}

The filter to include GCP Cloud SQL MySQL instances by type (standalone/replica).

.*
{$GCP.MYSQL.INST.TYPE.NOT_MATCHES}

The filter to exclude GCP Cloud SQL MySQL instances by type (standalone/replica).

Set a macro value 'CLOUD_SQL_INSTANCE' to exclude standalone Instances or 'READ_REPLICA_INSTANCE' to exclude read-only Replicas.

CHANGE_IF_NEEDED
{$GCP.PGSQL.INST.NAME.MATCHES}

The filter to include GCP Cloud SQL PostgreSQL instances by namespace.

.*
{$GCP.PGSQL.INST.NAME.NOT_MATCHES}

The filter to exclude GCP Cloud SQL PostgreSQL instances by namespace.

CHANGE_IF_NEEDED
{$GCP.PGSQL.ZONE.MATCHES}

The filter to include GCP Cloud SQL PostgreSQL instances by zone.

.*
{$GCP.PGSQL.ZONE.NOT_MATCHES}

The filter to exclude GCP Cloud SQL PostgreSQL instances by zone.

CHANGE_IF_NEEDED
{$GCP.PGSQL.INST.TYPE.MATCHES}

The filter to include GCP Cloud SQL PostgreSQL instances by type (standalone/replica).

.*
{$GCP.PGSQL.INST.TYPE.NOT_MATCHES}

The filter to exclude GCP Cloud SQL PostgreSQL instances by type (standalone/replica).

Set a macro value 'CLOUD_SQL_INSTANCE' to exclude standalone Instances or 'READ_REPLICA_INSTANCE' to exclude read-only Replicas.

CHANGE_IF_NEEDED
{$GCP.MSSQL.INST.NAME.MATCHES}

The filter to include GCP Cloud SQL MSSQL instances by namespace.

.*
{$GCP.MSSQL.INST.NAME.NOT_MATCHES}

The filter to exclude GCP Cloud SQL MSSQL instances by namespace.

CHANGE_IF_NEEDED
{$GCP.MSSQL.ZONE.MATCHES}

The filter to include GCP Cloud SQL MSSQL instances by zone.

.*
{$GCP.MSSQL.ZONE.NOT_MATCHES}

The filter to exclude GCP Cloud SQL MSSQL instances by zone.

CHANGE_IF_NEEDED
{$GCP.MSSQL.INST.TYPE.MATCHES}

The filter to include GCP Cloud SQL MSSQL instances by type (standalone/replica).

.*
{$GCP.MSSQL.INST.TYPE.NOT_MATCHES}

The filter to exclude GCP Cloud SQL MSSQL instances by type (standalone/replica).

Set a macro value 'CLOUD_SQL_INSTANCE' to exclude standalone Instances or 'READ_REPLICA_INSTANCE' to exclude read-only Replicas.

CHANGE_IF_NEEDED
{$GCP.GCE.QUOTA.MATCHES}

The filter to include GCP Compute Engine project quotas by namespace.

.*
{$GCP.GCE.QUOTA.NOT_MATCHES}

The filter to exclude GCP Compute Engine project quotas by namespace.

CHANGE_IF_NEEDED
{$GCP.CLOUD.RUN.SERVICE.NAME.MATCHES}

The filter to include GCP Cloud Run services by name.

.*
{$GCP.CLOUD.RUN.SERVICE.NAME.NOT_MATCHES}

The filter to exclude GCP Cloud Run services by name.

CHANGE_IF_NEEDED
{$GCP.CLOUD.RUN.SERVICE.CONDITION.MATCHES}

The filter to include GCP Cloud Run services by condition.

.*
{$GCP.CLOUD.RUN.SERVICE.CONDITION.NOT_MATCHES}

The filter to exclude GCP Cloud Run services by condition.

CHANGE_IF_NEEDED
{$GCP.BUCKET.NAME.MATCHES}

The filter to include GCP Cloud Storage buckets by name.

.*
{$GCP.BUCKET.NAME.NOT_MATCHES}

The filter to exclude GCP Cloud Storage buckets by name.

CHANGE_IF_NEEDED
{$GCP.LB.NAME.MATCHES}

The filter to include load balancers by name.

.*
{$GCP.LB.NAME.NOT_MATCHES}

The filter to exclude load balancers by name.

CHANGE_IF_NEEDED
{$GCP.LB.SCHEME.MATCHES}

The filter to include load balancers by scheme.

.*
{$GCP.LB.SCHEME.NOT_MATCHES}

The filter to exclude load balancers by scheme.

CHANGE_IF_NEEDED
{$GCP.LB.PROTOCOL.MATCHES}

The filter to include load balancers by protocol.

.*
{$GCP.LB.PROTOCOL.NOT_MATCHES}

The filter to exclude load balancers by protocol.

CHANGE_IF_NEEDED
{$GCP.LB.SCOPE.MATCHES}

The filter to include load balancers by scope.

.*
{$GCP.LB.SCOPE.NOT_MATCHES}

The filter to exclude load balancers by scope.

CHANGE_IF_NEEDED

Items

Name Description Type Key and additional info
Authorization

Google Cloud Platform REST authorization with service account authentication parameters and temporary-generated RSA-based JWT-token usage.

The necessary scopes are pre-defined.

Returns a signed authorization token with 1 hour lifetime; it is required only once, and is used for all the dependent script items.

Check the template documentation for the details.

Script gcp.authorization
GCE instances get

Get GCP Compute Engine instances.

Dependent item gcp.gce.instances.get

Preprocessing

  • JavaScript: The text is too long. Please see the template.

Cloud Run service get

Get GCP Cloud Run services.

Dependent item gcp.run.services.get

Preprocessing

  • JavaScript: The text is too long. Please see the template.

Authorization errors check

A list of errors from API requests.

Dependent item gcp.auth.err.check

Preprocessing

  • JSON Path: $.error

    ⛔️Custom on fail: Set value to: ``

Cloud SQL instances get

GCP Cloud SQL: Instances get.

Dependent item gcp.cloudsql.instances.get

Preprocessing

  • JavaScript: The text is too long. Please see the template.

Cloud SQL instances total

GCP Cloud SQL instances total count.

Dependent item gcp.cloudsql.instances.total

Preprocessing

  • JSON Path: $.[*].length()

MSSQL instances count

GCP Cloud SQL MSSQL instances count.

Dependent item gcp.cloudsql.instances.mssql_count

Preprocessing

  • JSON Path: $[?(@.db_type =~ 'SQLSERVER')].length()

    ⛔️Custom on fail: Discard value

MySQL instances count

GCP Cloud SQL MySQL instances count.

Dependent item gcp.cloudsql.instances.mysql_count

Preprocessing

  • JSON Path: $[?(@.db_type =~ 'MYSQL')].length()

    ⛔️Custom on fail: Discard value

PostgreSQL instances count

GCP Cloud SQL PostgreSQL instances count.

Dependent item gcp.cloudsql.instances.pgsql_count

Preprocessing

  • JSON Path: $[?(@.db_type =~ 'POSTGRES')].length()

    ⛔️Custom on fail: Discard value

GCE instances total

GCP Compute Engine instances total count.

Dependent item gcp.gce.instances.total

Preprocessing

  • JSON Path: $.[*].length()

    ⛔️Custom on fail: Discard value

Regular GCE instances count

GCP Compute Engine: Regular instances count.

Dependent item gcp.gce.instances.regular_count

Preprocessing

  • JSON Path: $[?(@.i_type == 'regular')].length()

    ⛔️Custom on fail: Discard value

Container-optimized GCE instances count

GCP Compute Engine: count of instances with Container-Optimized OS used.

Dependent item gcp.gce.instances.cos_count

Preprocessing

  • JSON Path: $[?(@.i_type == 'container-optimized')].length()

    ⛔️Custom on fail: Discard value

Project quotas get

GCP Compute Engine resource quotas available for the particular project.

Dependent item gcp.gce.quotas.get

Preprocessing

  • JavaScript: The text is too long. Please see the template.

Cloud Run service total

GCP Cloud Run services total count.

Dependent item gcp.run.service.total

Preprocessing

  • JSON Path: $.[*].length()

    ⛔️Custom on fail: Discard value

Cloud Storage buckets get

GCP Cloud Storage: Buckets get.

Dependent item gcp.storage.buckets.get

Preprocessing

  • JavaScript: The text is too long. Please see the template.

Cloud Storage buckets total

GCP Cloud Storage buckets total count.

Dependent item gcp.storage.buckets.total

Preprocessing

  • JSON Path: $.[*].length()

    ⛔️Custom on fail: Discard value

Load balancers (forwarding rules) get

GCP Application Load Balancing forwarding rules.

Dependent item gcp.lb.forwarding_rules.get

Preprocessing

  • JavaScript: The text is too long. Please see the template.

Global load balancers total

GCP Application Load Balancing global forwarding rules total count.

Dependent item gcp.lb.forwarding_rules.global.total

Preprocessing

  • JSON Path: $[?(@.scope=="global")].length()

    ⛔️Custom on fail: Discard value

Regional load balancers total

GCP Application Load Balancing regional forwarding rules total count.

Dependent item gcp.lb.forwarding_rules.regional.total

Preprocessing

  • JSON Path: $[?(@.scope=="regional")].length()

    ⛔️Custom on fail: Discard value

Triggers

Name Description Expression Severity Dependencies and additional info
GCP: Authorization has failed

GCP: Authorization has failed.
Check the authorization parameters and GCP API availability from a network segment, where Zabbix-server/proxy is located.

length(last(/GCP by HTTP/gcp.auth.err.check)) > 0 Average

LLD rule GCP Compute Engine: Instances discovery

Name Description Type Key and additional info
GCP Compute Engine: Instances discovery

GCP Compute Engine: Instances discovery.

Dependent item gcp.gce.inst.discovery

Preprocessing

  • Discard unchanged with heartbeat: 3h

LLD rule GCP Cloud SQL: PostgreSQL instances discovery

Name Description Type Key and additional info
GCP Cloud SQL: PostgreSQL instances discovery

GCP Cloud SQL: PostgreSQL instances discovery.

Dependent item gcp.cloudsql.pgsql.inst.discovery

Preprocessing

  • Discard unchanged with heartbeat: 3h

LLD rule GCP Cloud SQL: MSSQL instances discovery

Name Description Type Key and additional info
GCP Cloud SQL: MSSQL instances discovery

GCP Cloud SQL: MSSQL instances discovery.

Dependent item gcp.cloudsql.mssql.inst.discovery

Preprocessing

  • Discard unchanged with heartbeat: 3h

LLD rule GCP Cloud SQL: MySQL instances discovery

Name Description Type Key and additional info
GCP Cloud SQL: MySQL instances discovery

GCP Cloud SQL: MySQL instances discovery.

Dependent item gcp.cloudsql.mysql.inst.discovery

Preprocessing

  • Discard unchanged with heartbeat: 3h

LLD rule GCP Compute Engine: Project quotas discovery

Name Description Type Key and additional info
GCP Compute Engine: Project quotas discovery

GCP Compute Engine: Quotas discovery.

Dependent item gcp.gce.quotas.discovery

Preprocessing

  • Discard unchanged with heartbeat: 3h

Item prototypes for GCP Compute Engine: Project quotas discovery

Name Description Type Key and additional info
Quota [{#GCE.QUOTA.NAME}]: Raw data

GCP Compute Engine: Get metrics for [{#GCE.QUOTA.NAME}] quota.

Dependent item gcp.gce.quota.single.raw[{#GCE.QUOTA.NAME}]

Preprocessing

  • JSON Path: $[?(@.metric == "{#GCE.QUOTA.NAME}")].first()

Quota [{#GCE.QUOTA.NAME}]: Usage

GCP Compute Engine: The current usage value for [{#GCE.QUOTA.NAME}] quota.

Dependent item gcp.gce.quota.usage[{#GCE.QUOTA.NAME}]

Preprocessing

  • JSON Path: $.usage

Quota [{#GCE.QUOTA.NAME}]: Limit

GCP Compute Engine: The current limit value for [{#GCE.QUOTA.NAME}] quota.

Dependent item gcp.gce.quota.limit[{#GCE.QUOTA.NAME}]

Preprocessing

  • JSON Path: $.limit

Quota [{#GCE.QUOTA.NAME}]: Percentage used

GCP Compute Engine: Percentage usage for [{#GCE.QUOTA.NAME}] quota.

Dependent item gcp.gce.quota.pused[{#GCE.QUOTA.NAME}]

Preprocessing

  • Check for not supported value: any error

    ⛔️Custom on fail: Discard value

  • JSON Path: $.p_used

Trigger prototypes for GCP Compute Engine: Project quotas discovery

Name Description Expression Severity Dependencies and additional info
GCP: Quota [{#GCE.QUOTA.NAME}] limit has been changed

GCP Compute Engine: The limit for the {#GCE.QUOTA.NAME} quota has been changed.

change(/GCP by HTTP/gcp.gce.quota.limit[{#GCE.QUOTA.NAME}]) <> 0 Info Manual close: Yes
GCP: Quota [{#GCE.QUOTA.NAME}] usage is close to reaching the limit

GCP Compute Engine: The usage percentage for the {#GCE.QUOTA.NAME} quota is close to reaching the limit.

last(/GCP by HTTP/gcp.gce.quota.pused[{#GCE.QUOTA.NAME}]) >= {$GCP.GCE.QUOTA.PUSED.MIN.WARN:"{#GCE.QUOTA.NAME}"} Warning Manual close: Yes
Depends on:
  • GCP: Quota [{#GCE.QUOTA.NAME}] usage is critically close to reaching the limit
GCP: Quota [{#GCE.QUOTA.NAME}] usage is critically close to reaching the limit

GCP Compute Engine: The usage percentage for the {#GCE.QUOTA.NAME} quota is critically close to reaching the limit.

last(/GCP by HTTP/gcp.gce.quota.pused[{#GCE.QUOTA.NAME}]) >= {$GCP.GCE.QUOTA.PUSED.MIN.CRIT:"{#GCE.QUOTA.NAME}"} Average Manual close: Yes

LLD rule GCP Cloud Run: Service discovery

Name Description Type Key and additional info
GCP Cloud Run: Service discovery

GCP Cloud Run services discovery.

Dependent item gcp.run.service.discovery

Preprocessing

  • Discard unchanged with heartbeat: 3h

LLD rule GCP Cloud Storage: Buckets discovery

Name Description Type Key and additional info
GCP Cloud Storage: Buckets discovery

GCP Cloud Storage: Buckets discovery.

Dependent item gcp.storage.buckets.discovery

Preprocessing

  • Discard unchanged with heartbeat: 3h

LLD rule GCP Application Load Balancing: Load balancer discovery

Name Description Type Key and additional info
GCP Application Load Balancing: Load balancer discovery

Discovers GCP forwarding rules representing Load Balancers

using the Compute Engine aggregated forwardingRules API.

The discovery automatically creates monitored hosts for:

- Global external Application Load Balancers

- Regional external Application Load Balancers

- Internal Application Load Balancers

It also supports discovery of Network Load Balancers.

Dependent item gcp.lb.discovery

Preprocessing

  • Discard unchanged with heartbeat: 3h

Didn't find what you are looking for?