Files
templates-default/GCP_by_HTTP.yaml
T

1706 lines
70 KiB
YAML

zabbix_export:
version: '7.0'
template_groups:
- uuid: c2c162144c2d4c5491c8801193af4945
name: Templates/Cloud
host_groups:
- uuid: 748ad4d098d447d492bb935c907f652f
name: Databases
- uuid: 137f19e6e2dc4219b33553b812627bc2
name: 'Virtual machines'
templates:
- uuid: 4e1e9372a5fe4297936210bc4fc4b1c0
template: 'GCP by HTTP'
name: 'GCP by HTTP'
description: |
Discover GCP Compute Engine/Cloud SQL Instances and Compute Engine project quota metrics.
Don't forget to read the README.md for the correct setup of the template.
You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback
Generated by official Zabbix template tool "Templator"
vendor:
name: Zabbix
version: 7.0-5
groups:
- name: Templates/Cloud
items:
- uuid: b003e61fbede488a957b6c866ffaa9ba
name: 'Authorization errors check'
type: DEPENDENT
key: gcp.auth.err.check
delay: '0'
value_type: TEXT
trends: '0'
description: 'A list of errors from API requests.'
preprocessing:
- type: JSONPATH
parameters:
- $.error
error_handler: CUSTOM_VALUE
master_item:
key: gcp.authorization
tags:
- tag: component
value: status
triggers:
- uuid: 74c0e16244314ab4a920e32faca50444
expression: 'length(last(/GCP by HTTP/gcp.auth.err.check)) > 0'
name: 'GCP: Authorization has failed'
priority: AVERAGE
description: |
GCP: Authorization has failed.
Check the authorization parameters and GCP API availability from a network segment, where Zabbix-server/proxy is located.
tags:
- tag: scope
value: availability
- uuid: 5cc3faa82f404b38b513958f323f3d7d
name: Authorization
type: SCRIPT
key: gcp.authorization
delay: '{$GCP.AUTH.FREQUENCY}'
history: '0'
value_type: TEXT
trends: '0'
params: |
const CTlsConfig = function (raw_value) {
raw_value = String(raw_value).trim().toLowerCase();
if (['none', 'peer', 'full'].indexOf(raw_value) === -1) {
raw_value = 'full';
}
this.options = {
SSLVerifyPeer: (raw_value === 'peer' || raw_value === 'full'),
SSLVerifyHost: (raw_value === 'full')
};
this.enabled = (raw_value !== 'none');
this.checkURL = function (url) {
if (this.enabled && !/^https:\/\//i.test(url)) {
throw 'TLS certificate verification is enabled by {$' + 'HTTP.TLS.VERIFY}, but the URL uses plain HTTP: ' + url +
'. Use an "https://" URL, or set {$' + 'HTTP.TLS.VERIFY} to `none` to disable verification.';
}
return url;
};
}
var auth_url = 'https://oauth2.googleapis.com/token',
issued = Math.floor(new Date().getTime() / 1000),
expires = issued + 3600,
endpoint = 'https://www.googleapis.com/auth/',
scopes = ['cloud-platform.read-only', 'monitoring', 'compute.readonly', 'sqlservice.admin'],
scope = scopes.map(function (path) { return endpoint + path; }).join(' ');
function base64url(source) {
encodedSource = btoa(source);
encodedSource = encodedSource.replace(/=+$/, '');
encodedSource = encodedSource.replace(/\+/g, '-');
encodedSource = encodedSource.replace(/\//g, '_');
return encodedSource;
}
function fromHex(hex) {
var utf8array = [];
if (hex.length % 2)
throw 'Invalid length of a hex string!';
for (var i = 0; i < hex.length; i += 2) {
utf8array.push(parseInt(hex.substr(i, 2), 16));
}
return new Uint8Array(utf8array);
}
function encodeJWT(headers, payload, secret) {
unsignedToken = base64url(JSON.stringify(headers)) + '.' + base64url(JSON.stringify(payload));
jwt = unsignedToken + '.' + base64url(fromHex(sign('sha256', secret, unsignedToken)));
return jwt;
}
function exchangeJwtForAccessToken(signed_jwt) {
var tls = new CTlsConfig(script_params.tls_verify),
request = new HttpRequest(tls.options),
params = {
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
assertion: signed_jwt
}
if (typeof script_params.proxy !== 'undefined' && script_params.proxy !== '') {
request.setProxy(script_params.proxy);
};
var response = request.post(auth_url, JSON.stringify(params));
Zabbix.log(4, '[ GCP API ] [ ' + auth_url + ' ] Received response with status code ' + request.getStatus() + ': ' + response);
if (response !== null) {
try {
response = JSON.parse(response);
}
catch (error) {
throw 'Failed to parse response received from GCP API. Check debug log for more information.';
}
}
if (typeof response !== 'object' || response === null) {
throw 'Cannot process response data: received data is not an object. Check debug log for more information.';
}
if (request.getStatus() !== 200) {
if (typeof (response.error && response.error.message) !== 'undefined') {
throw response.error.message;
}
else {
throw 'Failed to receive data: invalid response status code. Check debug log for more information.';
}
}
if (typeof response.access_token !== 'undefined') {
return response.access_token;
}
else {
throw 'No access token in the JWT exchange request.';
}
}
function checkParams(params) {
['pkey_id', 'private_key', 'email'].forEach(function (field) {
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
throw 'Required param is not set: ' + field + '.';
}
});
return params;
}
var script_params = checkParams(JSON.parse(value)),
headers = {
alg: 'RS256',
kid: script_params.pkey_id,
typ: 'JWT'
},
payload = {
iss: script_params.email,
sub: script_params.email,
aud: auth_url,
iat: issued,
exp: expires,
scope: scope
};
try {
jwt = encodeJWT(headers, payload, script_params.private_key);
token = exchangeJwtForAccessToken(jwt);
return token;
}
catch (err) {
return JSON.stringify({ error: err });
}
description: |
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.
timeout: '{$GCP.DATA.TIMEOUT}'
parameters:
- name: email
value: '{$GCP.CLIENT.EMAIL}'
- name: pkey_id
value: '{$GCP.PRIVATE.KEY.ID}'
- name: private_key
value: '{$GCP.PRIVATE.KEY}'
- name: proxy
value: '{$GCP.PROXY}'
- name: tls_verify
value: '{$HTTP.TLS.VERIFY:"GCP"}'
tags:
- tag: component
value: raw
- uuid: 3ac5c859692140c0b686e772efa05032
name: 'Cloud SQL instances get'
type: DEPENDENT
key: gcp.cloudsql.instances.get
delay: '0'
history: '0'
value_type: TEXT
trends: '0'
description: 'GCP Cloud SQL: Instances get.'
preprocessing:
- type: JAVASCRIPT
parameters:
- |
const CTlsConfig = function (raw_value) {
raw_value = String(raw_value).trim().toLowerCase();
if (['none', 'peer', 'full'].indexOf(raw_value) === -1) {
raw_value = 'full';
}
this.options = {
SSLVerifyPeer: (raw_value === 'peer' || raw_value === 'full'),
SSLVerifyHost: (raw_value === 'full')
};
this.enabled = (raw_value !== 'none');
this.checkURL = function (url) {
if (this.enabled && !/^https:\/\//i.test(url)) {
throw 'TLS certificate verification is enabled by {$' + 'HTTP.TLS.VERIFY}, but the URL uses plain HTTP: ' + url +
'. Use an "https://" URL, or set {$' + 'HTTP.TLS.VERIFY} to `none` to disable verification.';
}
return url;
};
}
var token = value,
tls = new CTlsConfig('{{$HTTP.TLS.VERIFY:"GCP"}.regsub("^(none|peer|full)$", "\1")}');
function getField(data, path) {
var steps = path.split('.');
for (var i = 0; i < steps.length; i++) {
var step = steps[i];
if (typeof data !== 'object' || typeof data[step] === 'undefined') {
throw 'Required field "' + path + '" is not present in data received.';
}
data = data[step];
}
return data;
}
function getFieldBool(data, path) {
var steps = path.split('.');
for (var i = 0; i < steps.length; i++) {
var step = steps[i];
if (typeof data !== 'object' || typeof data[step] === 'undefined') {
return false;
}
data = data[step];
}
return true;
}
function getHttpData(url, token) {
var request = new HttpRequest(tls.options),
proxy = '{$GCP.PROXY}';
if (proxy !== '{' + '$GCP.PROXY}' && proxy !== '') {
request.setProxy(proxy);
};
request.addHeader('Authorization: Bearer ' + token);
request.addHeader('Content-Type: application/json');
var response = request.get(url);
Zabbix.log(4, '[ GCP API ] [ ' + url + ' ] Received response with status code ' + request.getStatus() + ': ' + response);
if (response !== null) {
try {
response = JSON.parse(response);
}
catch (error) {
throw 'Failed to parse response received from GCP API. Check debug log for more information.';
}
}
if (typeof response !== 'object' || response === null) {
throw 'Cannot process response data: received data is not an object. Check debug log for more information.';
}
if (request.getStatus() !== 200) {
if (typeof (response.error && response.error.message) !== 'undefined') {
throw response.error.message;
}
else {
throw 'Failed to receive data: invalid response status code. Check debug log for more information.';
}
}
return response;
};
var project = '{$GCP.PROJECT.ID}';
if (!project || project === '{' + '$GCP.PROJECT.ID}') {
throw 'Error. Set the \{$GCP.PROJECT.ID\} macro value.';
}
var inst_raw = getHttpData('https://sqladmin.googleapis.com/sql/v1beta4/projects/' + project + '/instances', token);
if (Object.keys(inst_raw).length === 0) {
return '[]';
}
return JSON.stringify(getField(inst_raw, 'items').map(function (sql_inst) {
obj = {
name: getField(sql_inst, 'name'),
token: value,
zone: getField(sql_inst, 'settings.locationPreference.zone'),
inst_type: getField(sql_inst, 'instanceType'),
tier: getField(sql_inst, 'settings.tier'),
project_id: getField(sql_inst, 'project'),
db_type: getField(sql_inst, 'databaseInstalledVersion')
};
obj.high_availability = (sql_inst.failoverReplica) ? true : false;
if (obj.db_type.match(/SQLSERVER*/)) {
obj.audited = getFieldBool(sql_inst, 'settings.sqlServerAuditConfig.bucket');
}
if (obj.inst_type === 'READ_REPLICA_INSTANCE') {
obj.master = getField(sql_inst, 'masterInstanceName');
}
if (Array.isArray(sql_inst.ipAddresses)) {
var int_addresses = sql_inst.ipAddresses.filter(function (addr) {
return addr.type === 'PRIVATE';
});
var ext_addresses = sql_inst.ipAddresses.filter(function (addr) {
return addr.type === 'PRIMARY';
});
obj.ip = getFieldBool(int_addresses, '0.ipAddress') ? int_addresses[0].ipAddress : '0.0.0.0';
obj.ext_ip = getFieldBool(ext_addresses, '0.ipAddress') ? ext_addresses[0].ipAddress : '0.0.0.0';
}
else {
obj.ip = '0.0.0.0';
obj.ext_ip = '0.0.0.0';
}
return obj;
}));
master_item:
key: gcp.authorization
tags:
- tag: component
value: raw
- uuid: 80687b35246b45ffa1be9d171f686e94
name: 'MSSQL instances count'
type: DEPENDENT
key: gcp.cloudsql.instances.mssql_count
delay: '0'
description: 'GCP Cloud SQL MSSQL instances count.'
preprocessing:
- type: JSONPATH
parameters:
- '$[?(@.db_type =~ ''SQLSERVER'')].length()'
error_handler: DISCARD_VALUE
master_item:
key: gcp.cloudsql.instances.get
tags:
- tag: component
value: environment
- uuid: 8ec94dff7a3b47998242d97a18cf0821
name: 'MySQL instances count'
type: DEPENDENT
key: gcp.cloudsql.instances.mysql_count
delay: '0'
description: 'GCP Cloud SQL MySQL instances count.'
preprocessing:
- type: JSONPATH
parameters:
- '$[?(@.db_type =~ ''MYSQL'')].length()'
error_handler: DISCARD_VALUE
master_item:
key: gcp.cloudsql.instances.get
tags:
- tag: component
value: environment
- uuid: de284dd30b2d4ecb9f7d0cf3ca80a094
name: 'PostgreSQL instances count'
type: DEPENDENT
key: gcp.cloudsql.instances.pgsql_count
delay: '0'
description: 'GCP Cloud SQL PostgreSQL instances count.'
preprocessing:
- type: JSONPATH
parameters:
- '$[?(@.db_type =~ ''POSTGRES'')].length()'
error_handler: DISCARD_VALUE
master_item:
key: gcp.cloudsql.instances.get
tags:
- tag: component
value: environment
- uuid: b926ba1901c5413396c1c071e6e76072
name: 'Cloud SQL instances total'
type: DEPENDENT
key: gcp.cloudsql.instances.total
delay: '0'
description: 'GCP Cloud SQL instances total count.'
preprocessing:
- type: JSONPATH
parameters:
- '$.[*].length()'
master_item:
key: gcp.cloudsql.instances.get
tags:
- tag: component
value: environment
- uuid: 58329c9a5b124b1990c94f15266e6edf
name: 'Container-optimized GCE instances count'
type: DEPENDENT
key: gcp.gce.instances.cos_count
delay: '0'
description: 'GCP Compute Engine: count of instances with Container-Optimized OS used.'
preprocessing:
- type: JSONPATH
parameters:
- '$[?(@.i_type == ''container-optimized'')].length()'
error_handler: DISCARD_VALUE
master_item:
key: gcp.gce.instances.get
tags:
- tag: component
value: environment
- uuid: 461e72fb7e104261831455ae3cc87358
name: 'GCE instances get'
type: DEPENDENT
key: gcp.gce.instances.get
delay: '0'
history: '0'
value_type: TEXT
trends: '0'
description: 'Get GCP Compute Engine instances.'
preprocessing:
- type: JAVASCRIPT
parameters:
- |
const CTlsConfig = function (raw_value) {
raw_value = String(raw_value).trim().toLowerCase();
if (['none', 'peer', 'full'].indexOf(raw_value) === -1) {
raw_value = 'full';
}
this.options = {
SSLVerifyPeer: (raw_value === 'peer' || raw_value === 'full'),
SSLVerifyHost: (raw_value === 'full')
};
this.enabled = (raw_value !== 'none');
this.checkURL = function (url) {
if (this.enabled && !/^https:\/\//i.test(url)) {
throw 'TLS certificate verification is enabled by {$' + 'HTTP.TLS.VERIFY}, but the URL uses plain HTTP: ' + url +
'. Use an "https://" URL, or set {$' + 'HTTP.TLS.VERIFY} to `none` to disable verification.';
}
return url;
};
}
var token = value,
tls = new CTlsConfig('{{$HTTP.TLS.VERIFY:"GCP"}.regsub("^(none|peer|full)$", "\1")}');
function checkMacro(macro) {
if (!macro || macro.match(/^\{\$.*\}$/)) {
throw 'The GCP project id is not defined. Please, set the value for the \{$GCP.PROJECT.ID\} macro.';
}
return macro;
}
function getField(data, path) {
var steps = path.split('.');
for (var i = 0; i < steps.length; i++) {
var step = steps[i];
if (typeof data !== 'object' || typeof data[step] === 'undefined') {
throw 'Required field "' + path + '" is not present in data received.';
}
data = data[step];
}
return data;
}
function getFieldBool(data, path) {
var steps = path.split('.');
for (var i = 0; i < steps.length; i++) {
var step = steps[i];
if (typeof data !== 'object' || typeof data[step] === 'undefined') {
return false;
}
data = data[step];
}
return true;
}
function getHttpData(url, token) {
var request = new HttpRequest(tls.options),
proxy = '{$GCP.PROXY}';
if (proxy !== '{' + '$GCP.PROXY}' && proxy !== '') {
request.setProxy(proxy);
};
request.addHeader('Authorization: Bearer ' + token);
request.addHeader('Content-Type: application/json');
var response = request.get(url);
Zabbix.log(4, '[ GCP API ] [ ' + url + ' ] Received response with status code ' + request.getStatus() + ': ' + response);
if (response !== null) {
try {
response = JSON.parse(response);
}
catch (error) {
throw 'Failed to parse response received from GCP API. Check debug log for more information.';
}
}
if (typeof response !== 'object' || response === null) {
throw 'Cannot process response data: received data is not an object. Check debug log for more information.';
}
if (request.getStatus() !== 200) {
if (typeof (response.error && response.error.message) !== 'undefined') {
throw response.error.message;
}
else {
throw 'Failed to receive data: invalid response status code. Check debug log for more information.';
}
}
return response;
};
var project = '{$GCP.PROJECT.ID}';
if (!project || project === '{' + '$GCP.PROJECT.ID}') {
throw 'Error. Set the \{$GCP.PROJECT.ID\} macro value.';
}
var result = getHttpData('https://compute.googleapis.com/compute/v1/projects/' + project + '/aggregated/instances', token),
vms_raw = getField(result, 'items'),
keys = Object.keys(vms_raw),
arr = [];
for (var i in keys) {
if (typeof vms_raw[keys[i]].instances !== 'undefined') {
var vm_prop = vms_raw[keys[i]].instances.map(function setProp(inst) {
obj = {
id: getField(inst, 'id'),
name: getField(inst, 'name'),
token: value,
zone: keys[i].replace(/zones\//, ''),
m_type: getField(inst, 'machineType').replace(/.*machineTypes\//g, ''),
state: getField(inst, 'status'),
project_id: '{$GCP.PROJECT.ID}',
ip: getField(inst, 'networkInterfaces.0.networkIP'),
integrity: getFieldBool(inst, 'shieldedInstanceConfig.enableIntegrityMonitoring') ? inst.shieldedInstanceConfig.enableIntegrityMonitoring : false
};
obj.ext_ip = getFieldBool(inst, 'networkInterfaces.0.accessConfigs.0.natIP') ? inst.networkInterfaces[0].accessConfigs[0].natIP : '0.0.0.0';
obj.i_type = getFieldBool(inst, 'labels.container-vm') ? 'container-optimized' : 'regular';
return obj;
});
arr = arr.concat(vm_prop);
}
}
return JSON.stringify(arr);
master_item:
key: gcp.authorization
tags:
- tag: component
value: raw
- uuid: a936207f9d914955b2e2140e953f22f2
name: 'Regular GCE instances count'
type: DEPENDENT
key: gcp.gce.instances.regular_count
delay: '0'
description: 'GCP Compute Engine: Regular instances count.'
preprocessing:
- type: JSONPATH
parameters:
- '$[?(@.i_type == ''regular'')].length()'
error_handler: DISCARD_VALUE
master_item:
key: gcp.gce.instances.get
tags:
- tag: component
value: environment
- uuid: 46eaeccd1f43466caadd44440da88568
name: 'GCE instances total'
type: DEPENDENT
key: gcp.gce.instances.total
delay: '0'
description: 'GCP Compute Engine instances total count.'
preprocessing:
- type: JSONPATH
parameters:
- '$.[*].length()'
error_handler: DISCARD_VALUE
master_item:
key: gcp.gce.instances.get
tags:
- tag: component
value: environment
- uuid: c4f17331815345bcb0ac6ea98413b2b5
name: 'Project quotas get'
type: DEPENDENT
key: gcp.gce.quotas.get
delay: '0'
history: '0'
value_type: TEXT
trends: '0'
description: 'GCP Compute Engine resource quotas available for the particular project.'
preprocessing:
- type: JAVASCRIPT
parameters:
- |
const CTlsConfig = function (raw_value) {
raw_value = String(raw_value).trim().toLowerCase();
if (['none', 'peer', 'full'].indexOf(raw_value) === -1) {
raw_value = 'full';
}
this.options = {
SSLVerifyPeer: (raw_value === 'peer' || raw_value === 'full'),
SSLVerifyHost: (raw_value === 'full')
};
this.enabled = (raw_value !== 'none');
this.checkURL = function (url) {
if (this.enabled && !/^https:\/\//i.test(url)) {
throw 'TLS certificate verification is enabled by {$' + 'HTTP.TLS.VERIFY}, but the URL uses plain HTTP: ' + url +
'. Use an "https://" URL, or set {$' + 'HTTP.TLS.VERIFY} to `none` to disable verification.';
}
return url;
};
}
var token = value,
tls = new CTlsConfig('{{$HTTP.TLS.VERIFY:"GCP"}.regsub("^(none|peer|full)$", "\1")}');
function checkMacro(macro) {
if (!macro || macro.match(/^\{\$.*\}$/)) {
throw 'The GCP project id is not defined. Please, set the value for the \{$GCP.PROJECT.ID\} macro.';
}
return macro;
}
function getField(data, path) {
var steps = path.split('.');
for (var i = 0; i < steps.length; i++) {
var step = steps[i];
if (typeof data !== 'object' || typeof data[step] === 'undefined') {
throw 'Required field "' + path + '" is not present in data received.'
}
data = data[step];
}
return data;
}
function getHttpData(url, token) {
var request = new HttpRequest(tls.options),
proxy = '{$GCP.PROXY}';
if (proxy !== '{' + '$GCP.PROXY}' && proxy !== '') {
request.setProxy(proxy);
};
request.addHeader('Authorization: Bearer ' + token);
request.addHeader('Content-Type: application/json');
var response = request.get(url);
Zabbix.log(4, '[ GCP API ] [ ' + url + ' ] Received response with status code ' + request.getStatus() + ': ' + response);
if (response !== null) {
try {
response = JSON.parse(response);
}
catch (error) {
throw 'Failed to parse response received from GCP API. Check debug log for more information.';
}
}
if (typeof response !== 'object' || response === null) {
throw 'Cannot process response data: received data is not an object. Check debug log for more information.';
}
if (request.getStatus() !== 200) {
if (typeof (response.error && response.error.message) !== 'undefined') {
throw response.error.message;
}
else {
throw 'Failed to receive data: invalid response status code. Check debug log for more information.';
}
}
if (typeof response.quotas !== 'undefined') {
return response;
} else {
throw 'No quotas array in API response';
}
};
var project = checkMacro('{$GCP.PROJECT.ID}'),
qts_raw = getHttpData('https://www.googleapis.com/compute/v1/projects/' + project, token),
qts_lst = getField(qts_raw, 'quotas').map(function (qt) {
obj = {
metric: getField(qt, 'metric'),
limit: getField(qt, 'limit'),
usage: getField(qt, 'usage'),
p_used: (qt.usage / qt.limit) * 100
};
return obj;
});
return JSON.stringify(qts_lst);
master_item:
key: gcp.authorization
tags:
- tag: component
value: raw
discovery_rules:
- uuid: f210e8e38c194c65b30e74610ec2b86f
name: 'GCP Cloud SQL: MSSQL instances discovery'
type: DEPENDENT
key: gcp.cloudsql.mssql.inst.discovery
delay: '0'
filter:
evaltype: AND
conditions:
- macro: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
value: 'SQLSERVER.*'
formulaid: A
- macro: '{#CLOUD_SQL.INSTANCE.NAME}'
value: '{$GCP.MSSQL.INST.NAME.MATCHES}'
formulaid: B
- macro: '{#CLOUD_SQL.INSTANCE.NAME}'
value: '{$GCP.MSSQL.INST.NAME.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: C
- macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
value: '{$GCP.MSSQL.INST.TYPE.MATCHES}'
formulaid: D
- macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
value: '{$GCP.MSSQL.INST.TYPE.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: E
- macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
value: '{$GCP.MSSQL.ZONE.MATCHES}'
formulaid: F
- macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
value: '{$GCP.MSSQL.ZONE.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: G
description: 'GCP Cloud SQL: MSSQL instances discovery.'
host_prototypes:
- uuid: edc6ab9314ed410b8a3cf6bfedff51ab
host: '{#GCP.PROJECT.ID}-{#CLOUD_SQL.INSTANCE.NAME}'
name: '{#CLOUD_SQL.INSTANCE.NAME}'
group_links:
- group:
name: Databases
templates:
- name: 'GCP Cloud SQL MSSQL by HTTP'
macros:
- macro: '{$CLOUD_SQL.HIGH.AVAILABILITY}'
value: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
description: 'GCP Cloud SQL instance high availability definition. Required for metrics filtration.'
- macro: '{$CLOUD_SQL.MSSQL.AUDITED}'
value: '{#MSSQL.AUDITED}'
description: 'GCP Cloud SQL MSSQL audit enabled definition. Required for metrics filtration.'
- macro: '{$GCP.AUTH.TOKEN}'
value: '{#GCP.AUTH.TOKEN}'
description: 'Google Cloud Platform authorization token.'
- macro: '{$GCP.PROJECT.ID}'
value: '{#GCP.PROJECT.ID}'
description: 'GCP Project Id.'
tags:
- tag: audit
value: '{#MSSQL.AUDITED}'
- tag: db-version
value: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
- tag: high-availability
value: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
- tag: instance-type
value: '{#CLOUD_SQL.INSTANCE.TYPE}'
- tag: project
value: '{#GCP.PROJECT.ID}'
- tag: service
value: cloudsql
- tag: service
value: gcp
- tag: service
value: mssql
- tag: tier
value: '{#CLOUD_SQL.INSTANCE.TIER}'
- tag: zone
value: '{#CLOUD_SQL.INSTANCE.ZONE}'
custom_interfaces: 'YES'
interfaces:
- default: 'NO'
ip: '{#CLOUD_SQL.INSTANCE.EXT.IP}'
dns: external.ip
- ip: '{#CLOUD_SQL.INSTANCE.IP}'
dns: internal.ip
master_item:
key: gcp.cloudsql.instances.get
lld_macro_paths:
- lld_macro: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
path: $.db_type
- lld_macro: '{#CLOUD_SQL.INSTANCE.EXT.IP}'
path: $.ext_ip
- lld_macro: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
path: $.high_availability
- lld_macro: '{#CLOUD_SQL.INSTANCE.IP}'
path: $.ip
- lld_macro: '{#CLOUD_SQL.INSTANCE.NAME}'
path: $.name
- lld_macro: '{#CLOUD_SQL.INSTANCE.TIER}'
path: $.tier
- lld_macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
path: $.inst_type
- lld_macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
path: $.zone
- lld_macro: '{#CLOUD_SQL.MASTER}'
path: $.master
- lld_macro: '{#GCP.AUTH.TOKEN}'
path: $.token
- lld_macro: '{#GCP.PROJECT.ID}'
path: $.project_id
- lld_macro: '{#MSSQL.AUDITED}'
path: $.audited
preprocessing:
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 3h
overrides:
- name: 'MSSQL replica'
step: '1'
filter:
conditions:
- macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
value: READ_REPLICA_INSTANCE
formulaid: A
- macro: '{#CLOUD_SQL.MASTER}'
operator: EXISTS
formulaid: B
operations:
- operationobject: HOST_PROTOTYPE
operator: REGEXP
tags:
- tag: master_instance
value: '{#CLOUD_SQL.MASTER}'
templates:
- name: 'GCP Cloud SQL MSSQL Replica by HTTP'
- uuid: 3fdd2543936a4587b1bfb5dabb30c1f6
name: 'GCP Cloud SQL: MySQL instances discovery'
type: DEPENDENT
key: gcp.cloudsql.mysql.inst.discovery
delay: '0'
filter:
evaltype: AND
conditions:
- macro: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
value: 'MYSQL.*'
formulaid: A
- macro: '{#CLOUD_SQL.INSTANCE.NAME}'
value: '{$GCP.MYSQL.INST.NAME.MATCHES}'
formulaid: B
- macro: '{#CLOUD_SQL.INSTANCE.NAME}'
value: '{$GCP.MYSQL.INST.NAME.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: C
- macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
value: '{$GCP.MYSQL.INST.TYPE.MATCHES}'
formulaid: D
- macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
value: '{$GCP.MYSQL.INST.TYPE.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: E
- macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
value: '{$GCP.MYSQL.ZONE.MATCHES}'
formulaid: F
- macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
value: '{$GCP.MYSQL.ZONE.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: G
description: 'GCP Cloud SQL: MySQL instances discovery.'
host_prototypes:
- uuid: 8b2556b881b14b86a98f90a447ae9734
host: '{#GCP.PROJECT.ID}-{#CLOUD_SQL.INSTANCE.NAME}'
name: '{#CLOUD_SQL.INSTANCE.NAME}'
group_links:
- group:
name: Databases
templates:
- name: 'GCP Cloud SQL MySQL by HTTP'
macros:
- macro: '{$CLOUD_SQL.HIGH.AVAILABILITY}'
value: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
description: 'GCP Cloud SQL instance high availability definition.'
- macro: '{$GCP.AUTH.TOKEN}'
value: '{#GCP.AUTH.TOKEN}'
description: 'Google Cloud Platform authorization token.'
- macro: '{$GCP.PROJECT.ID}'
value: '{#GCP.PROJECT.ID}'
description: 'GCP Project Id.'
tags:
- tag: db-version
value: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
- tag: high-availability
value: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
- tag: instance-type
value: '{#CLOUD_SQL.INSTANCE.TYPE}'
- tag: project
value: '{#GCP.PROJECT.ID}'
- tag: service
value: cloudsql
- tag: service
value: gcp
- tag: service
value: mysql
- tag: tier
value: '{#CLOUD_SQL.INSTANCE.TIER}'
- tag: zone
value: '{#CLOUD_SQL.INSTANCE.ZONE}'
custom_interfaces: 'YES'
interfaces:
- default: 'NO'
ip: '{#CLOUD_SQL.INSTANCE.EXT.IP}'
dns: external.ip
- ip: '{#CLOUD_SQL.INSTANCE.IP}'
dns: internal.ip
master_item:
key: gcp.cloudsql.instances.get
lld_macro_paths:
- lld_macro: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
path: $.db_type
- lld_macro: '{#CLOUD_SQL.INSTANCE.EXT.IP}'
path: $.ext_ip
- lld_macro: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
path: $.high_availability
- lld_macro: '{#CLOUD_SQL.INSTANCE.IP}'
path: $.ip
- lld_macro: '{#CLOUD_SQL.INSTANCE.NAME}'
path: $.name
- lld_macro: '{#CLOUD_SQL.INSTANCE.TIER}'
path: $.tier
- lld_macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
path: $.inst_type
- lld_macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
path: $.zone
- lld_macro: '{#CLOUD_SQL.MASTER}'
path: $.master
- lld_macro: '{#GCP.AUTH.TOKEN}'
path: $.token
- lld_macro: '{#GCP.PROJECT.ID}'
path: $.project_id
preprocessing:
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 3h
overrides:
- name: 'MySQL replica'
step: '1'
filter:
conditions:
- macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
value: READ_REPLICA_INSTANCE
formulaid: A
- macro: '{#CLOUD_SQL.MASTER}'
operator: EXISTS
formulaid: B
operations:
- operationobject: HOST_PROTOTYPE
operator: REGEXP
tags:
- tag: master_instance
value: '{#CLOUD_SQL.MASTER}'
templates:
- name: 'GCP Cloud SQL MySQL Replica by HTTP'
- uuid: 606ba15087894f268f4b626590b7a9d0
name: 'GCP Cloud SQL: PostgreSQL instances discovery'
type: DEPENDENT
key: gcp.cloudsql.pgsql.inst.discovery
delay: '0'
filter:
evaltype: AND
conditions:
- macro: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
value: 'POSTGRES.*'
formulaid: A
- macro: '{#CLOUD_SQL.INSTANCE.NAME}'
value: '{$GCP.PGSQL.INST.NAME.MATCHES}'
formulaid: B
- macro: '{#CLOUD_SQL.INSTANCE.NAME}'
value: '{$GCP.PGSQL.INST.NAME.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: C
- macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
value: '{$GCP.PGSQL.INST.TYPE.MATCHES}'
formulaid: D
- macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
value: '{$GCP.PGSQL.TYPE.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: E
- macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
value: '{$GCP.PGSQL.ZONE.MATCHES}'
formulaid: F
- macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
value: '{$GCP.PGSQL.ZONE.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: G
description: 'GCP Cloud SQL: PostgreSQL instances discovery.'
host_prototypes:
- uuid: 0fbbc550fda448d39aad6d0710f28b6a
host: '{#GCP.PROJECT.ID}-{#CLOUD_SQL.INSTANCE.NAME}'
name: '{#CLOUD_SQL.INSTANCE.NAME}'
group_links:
- group:
name: Databases
templates:
- name: 'GCP Cloud SQL PostgreSQL by HTTP'
macros:
- macro: '{$CLOUD_SQL.HIGH.AVAILABILITY}'
value: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
description: 'GCP Cloud SQL instance high availability definition.'
- macro: '{$GCP.AUTH.TOKEN}'
value: '{#GCP.AUTH.TOKEN}'
description: 'Google Cloud Platform authorization token.'
- macro: '{$GCP.PROJECT.ID}'
value: '{#GCP.PROJECT.ID}'
description: 'GCP project id.'
tags:
- tag: db-version
value: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
- tag: high-availability
value: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
- tag: instance-type
value: '{#CLOUD_SQL.INSTANCE.TYPE}'
- tag: project
value: '{#GCP.PROJECT.ID}'
- tag: service
value: cloudsql
- tag: service
value: gcp
- tag: service
value: pgsql
- tag: tier
value: '{#CLOUD_SQL.INSTANCE.TIER}'
- tag: zone
value: '{#CLOUD_SQL.INSTANCE.ZONE}'
custom_interfaces: 'YES'
interfaces:
- default: 'NO'
ip: '{#CLOUD_SQL.INSTANCE.EXT.IP}'
dns: external.ip
- ip: '{#CLOUD_SQL.INSTANCE.IP}'
dns: internal.ip
master_item:
key: gcp.cloudsql.instances.get
lld_macro_paths:
- lld_macro: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
path: $.db_type
- lld_macro: '{#CLOUD_SQL.INSTANCE.EXT.IP}'
path: $.ext_ip
- lld_macro: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
path: $.high_availability
- lld_macro: '{#CLOUD_SQL.INSTANCE.IP}'
path: $.ip
- lld_macro: '{#CLOUD_SQL.INSTANCE.NAME}'
path: $.name
- lld_macro: '{#CLOUD_SQL.INSTANCE.TIER}'
path: $.tier
- lld_macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
path: $.inst_type
- lld_macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
path: $.zone
- lld_macro: '{#CLOUD_SQL.MASTER}'
path: $.master
- lld_macro: '{#GCP.AUTH.TOKEN}'
path: $.token
- lld_macro: '{#GCP.PROJECT.ID}'
path: $.project_id
preprocessing:
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 3h
overrides:
- name: 'PostgreSQL replica'
step: '1'
filter:
conditions:
- macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
value: READ_REPLICA_INSTANCE
formulaid: A
- macro: '{#CLOUD_SQL.MASTER}'
operator: EXISTS
formulaid: B
operations:
- operationobject: HOST_PROTOTYPE
operator: REGEXP
tags:
- tag: master_instance
value: '{#CLOUD_SQL.MASTER}'
templates:
- name: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
- uuid: 7d0226eccc5644c89fff10f7ece1c8b4
name: 'GCP Compute Engine: Instances discovery'
type: DEPENDENT
key: gcp.gce.inst.discovery
delay: '0'
filter:
evaltype: AND
conditions:
- macro: '{#GCE.INSTANCE.NAME}'
value: '{$GCP.GCE.INST.NAME.MATCHES}'
formulaid: A
- macro: '{#GCE.INSTANCE.NAME}'
value: '{$GCP.GCE.INST.NAME.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: B
- macro: '{#GCE.INSTANCE.ZONE}'
value: '{$GCP.GCE.ZONE.MATCHES}'
formulaid: C
- macro: '{#GCE.INSTANCE.ZONE}'
value: '{$GCP.GCE.ZONE.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: D
description: 'GCP Compute Engine: Instances discovery.'
host_prototypes:
- uuid: cb22d82a12814afb8ba833c649d575c4
host: '{#GCE.INSTANCE.ID}'
name: '{#GCE.INSTANCE.NAME}'
group_links:
- group:
name: 'Virtual machines'
templates:
- name: 'GCP Compute Engine Instance by HTTP'
macros:
- macro: '{$GCE.INSTANCE.ZONE}'
value: '{#GCE.INSTANCE.ZONE}'
description: 'Instance zone (location).'
- macro: '{$GCE.INTEGRITY.STATE}'
value: '{#GCE.INTEGRITY.STATE}'
description: 'Instance integrity metrics status.'
- macro: '{$GCE.MACHINE.TYPE}'
value: '{#GCE.MACHINE.TYPE}'
description: 'Instance machine type.'
- macro: '{$GCP.AUTH.TOKEN}'
value: '{#GCP.AUTH.TOKEN}'
description: 'Google Cloud Platform authorization token.'
- macro: '{$GCP.PROJECT.ID}'
value: '{#GCP.PROJECT.ID}'
description: 'GCP project id.'
tags:
- tag: instance-type
value: '{#GCE.INSTANCE.TYPE}'
- tag: machine-type
value: '{#GCE.MACHINE.TYPE}'
- tag: project
value: '{#GCP.PROJECT.ID}'
- tag: service
value: gce
- tag: service
value: gcp
- tag: zone
value: '{#GCE.INSTANCE.ZONE}'
custom_interfaces: 'YES'
interfaces:
- default: 'NO'
ip: '{#GCE.INSTANCE.EXT.IP}'
dns: external.ip
- ip: '{#GCE.INSTANCE.IP}'
dns: internal.ip
master_item:
key: gcp.gce.instances.get
lld_macro_paths:
- lld_macro: '{#GCE.INSTANCE.EXT.IP}'
path: $.ext_ip
- lld_macro: '{#GCE.INSTANCE.ID}'
path: $.id
- lld_macro: '{#GCE.INSTANCE.IP}'
path: $.ip
- lld_macro: '{#GCE.INSTANCE.NAME}'
path: $.name
- lld_macro: '{#GCE.INSTANCE.TYPE}'
path: $.i_type
- lld_macro: '{#GCE.INSTANCE.ZONE}'
path: $.zone
- lld_macro: '{#GCE.INTEGRITY.STATE}'
path: $.integrity
- lld_macro: '{#GCE.MACHINE.TYPE}'
path: $.m_type
- lld_macro: '{#GCP.AUTH.TOKEN}'
path: $.token
- lld_macro: '{#GCP.PROJECT.ID}'
path: $.project_id
preprocessing:
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 3h
- uuid: 1a0dc88bc40d45af90ca761dcb611bf0
name: 'GCP Compute Engine: Project quotas discovery'
type: DEPENDENT
key: gcp.gce.quotas.discovery
delay: '0'
filter:
evaltype: AND
conditions:
- macro: '{#GCE.QUOTA.NAME}'
value: '{$GCP.GCE.QUOTA.MATCHES}'
formulaid: A
- macro: '{#GCE.QUOTA.NAME}'
value: '{$GCP.GCE.QUOTA.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: B
description: 'GCP Compute Engine: Quotas discovery.'
item_prototypes:
- uuid: 1e9a772b9a89497ba695079fc480bd0a
name: 'Quota [{#GCE.QUOTA.NAME}]: Limit'
type: DEPENDENT
key: 'gcp.gce.quota.limit[{#GCE.QUOTA.NAME}]'
delay: '0'
description: 'GCP Compute Engine: The current limit value for [{#GCE.QUOTA.NAME}] quota.'
preprocessing:
- type: JSONPATH
parameters:
- $.limit
master_item:
key: 'gcp.gce.quota.single.raw[{#GCE.QUOTA.NAME}]'
tags:
- tag: component
value: quota
- tag: quota
value: '{#GCE.QUOTA.NAME}'
trigger_prototypes:
- uuid: ac0d8842f0934dcead56d41f328c10d2
expression: 'change(/GCP by HTTP/gcp.gce.quota.limit[{#GCE.QUOTA.NAME}]) <> 0'
name: 'GCP: Quota [{#GCE.QUOTA.NAME}] limit has been changed'
opdata: 'Current limit: {ITEM.VALUE}'
priority: INFO
description: 'GCP Compute Engine: The limit for the `{#GCE.QUOTA.NAME}` quota has been changed.'
manual_close: 'YES'
tags:
- tag: scope
value: capacity
- uuid: 6bb3700f7c5c4c51b6a435f5c7d0e315
name: 'Quota [{#GCE.QUOTA.NAME}]: Percentage used'
type: DEPENDENT
key: 'gcp.gce.quota.pused[{#GCE.QUOTA.NAME}]'
delay: '0'
value_type: FLOAT
units: '%'
description: 'GCP Compute Engine: Percentage usage for [{#GCE.QUOTA.NAME}] quota.'
preprocessing:
- type: CHECK_NOT_SUPPORTED
parameters:
- '-1'
- type: JSONPATH
parameters:
- $.p_used
master_item:
key: 'gcp.gce.quota.single.raw[{#GCE.QUOTA.NAME}]'
tags:
- tag: component
value: quota
- tag: quota
value: '{#GCE.QUOTA.NAME}'
trigger_prototypes:
- uuid: ecce0204198d4edda88f84d4f25ba75c
expression: 'last(/GCP by HTTP/gcp.gce.quota.pused[{#GCE.QUOTA.NAME}]) >= {$GCP.GCE.QUOTA.PUSED.MIN.WARN:"{#GCE.QUOTA.NAME}"}'
name: 'GCP: Quota [{#GCE.QUOTA.NAME}] usage is close to reaching the limit'
opdata: 'Usage: {#GCE.QUOTA.USAGE} | Limit: {#GCE.QUOTA.LIMIT} | Percentage {ITEM.VALUE}%'
priority: WARNING
description: 'GCP Compute Engine: The usage percentage for the `{#GCE.QUOTA.NAME}` quota is close to reaching the limit.'
manual_close: 'YES'
dependencies:
- name: 'GCP: Quota [{#GCE.QUOTA.NAME}] usage is critically close to reaching the limit'
expression: 'last(/GCP by HTTP/gcp.gce.quota.pused[{#GCE.QUOTA.NAME}]) >= {$GCP.GCE.QUOTA.PUSED.MIN.CRIT:"{#GCE.QUOTA.NAME}"}'
tags:
- tag: scope
value: capacity
- uuid: bc894d5e4f694e428fcb32babe87c204
expression: 'last(/GCP by HTTP/gcp.gce.quota.pused[{#GCE.QUOTA.NAME}]) >= {$GCP.GCE.QUOTA.PUSED.MIN.CRIT:"{#GCE.QUOTA.NAME}"}'
name: 'GCP: Quota [{#GCE.QUOTA.NAME}] usage is critically close to reaching the limit'
opdata: 'Usage: {#GCE.QUOTA.USAGE} | Limit: {#GCE.QUOTA.LIMIT} | Percentage {ITEM.VALUE}%'
priority: AVERAGE
description: 'GCP Compute Engine: The usage percentage for the `{#GCE.QUOTA.NAME}` quota is critically close to reaching the limit.'
manual_close: 'YES'
tags:
- tag: scope
value: capacity
- tag: scope
value: notice
- uuid: a439501636fd49f0aaf3902300d943b8
name: 'Quota [{#GCE.QUOTA.NAME}]: Raw data'
type: DEPENDENT
key: 'gcp.gce.quota.single.raw[{#GCE.QUOTA.NAME}]'
delay: '0'
history: '0'
value_type: TEXT
trends: '0'
description: 'GCP Compute Engine: Get metrics for [{#GCE.QUOTA.NAME}] quota.'
preprocessing:
- type: JSONPATH
parameters:
- '$[?(@.metric == "{#GCE.QUOTA.NAME}")].first()'
master_item:
key: gcp.gce.quotas.get
tags:
- tag: component
value: raw
- tag: quota
value: '{#GCE.QUOTA.NAME}'
- uuid: 936c66cc59a240858f67922dcba2cbec
name: 'Quota [{#GCE.QUOTA.NAME}]: Usage'
type: DEPENDENT
key: 'gcp.gce.quota.usage[{#GCE.QUOTA.NAME}]'
delay: '0'
description: 'GCP Compute Engine: The current usage value for [{#GCE.QUOTA.NAME}] quota.'
preprocessing:
- type: JSONPATH
parameters:
- $.usage
master_item:
key: 'gcp.gce.quota.single.raw[{#GCE.QUOTA.NAME}]'
tags:
- tag: component
value: quota
- tag: quota
value: '{#GCE.QUOTA.NAME}'
graph_prototypes:
- uuid: 45de6eacbed84c82bfe9175fcf84e0c3
name: 'GCP Compute Engine: Quota [{#GCE.QUOTA.NAME}]: Usage'
graph_items:
- drawtype: GRADIENT_LINE
color: 199C0D
item:
host: 'GCP by HTTP'
key: 'gcp.gce.quota.usage[{#GCE.QUOTA.NAME}]'
- sortorder: '1'
drawtype: BOLD_LINE
color: F63100
calc_fnc: MIN
item:
host: 'GCP by HTTP'
key: 'gcp.gce.quota.limit[{#GCE.QUOTA.NAME}]'
master_item:
key: gcp.gce.quotas.get
lld_macro_paths:
- lld_macro: '{#GCE.QUOTA.LIMIT}'
path: $.limit
- lld_macro: '{#GCE.QUOTA.NAME}'
path: $.metric
- lld_macro: '{#GCE.QUOTA.USAGE}'
path: $.usage
preprocessing:
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 3h
tags:
- tag: class
value: cloud
- tag: target
value: gcp
- tag: target
value: google-cloud-platform
macros:
- macro: '{$GCP.AUTH.FREQUENCY}'
value: 45m
description: |
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.
- macro: '{$GCP.CLIENT.EMAIL}'
description: 'Service account client e-mail.'
- macro: '{$GCP.DATA.TIMEOUT}'
value: 15s
description: 'A response timeout for an API.'
- macro: '{$GCP.GCE.INST.NAME.MATCHES}'
value: '.*'
description: 'The filter to include GCP Compute Engine instances by namespace.'
- macro: '{$GCP.GCE.INST.NAME.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: 'The filter to exclude GCP Compute Engine instances by namespace.'
- macro: '{$GCP.GCE.QUOTA.MATCHES}'
value: '.*'
description: 'The filter to include GCP Compute Engine project quotas by namespace.'
- macro: '{$GCP.GCE.QUOTA.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: 'The filter to exclude GCP Compute Engine project quotas by namespace.'
- macro: '{$GCP.GCE.QUOTA.PUSED.MIN.CRIT}'
value: '95'
description: 'GCP Compute Engine project quota critical quota utilization threshold.'
- macro: '{$GCP.GCE.QUOTA.PUSED.MIN.WARN}'
value: '80'
description: 'GCP Compute Engine project quota warning utilization threshold.'
- macro: '{$GCP.GCE.ZONE.MATCHES}'
value: '.*'
description: 'The filter to include GCP Compute Engine instances by zone.'
- macro: '{$GCP.GCE.ZONE.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: 'The filter to exclude GCP Compute Engine instances by zone.'
- macro: '{$GCP.MSSQL.INST.NAME.MATCHES}'
value: '.*'
description: 'The filter to include GCP Cloud SQL MSSQL instances by namespace.'
- macro: '{$GCP.MSSQL.INST.NAME.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: 'The filter to exclude GCP Cloud SQL MSSQL instances by namespace.'
- macro: '{$GCP.MSSQL.INST.TYPE.MATCHES}'
value: '.*'
description: 'The filter to include GCP Cloud SQL MSSQL instances by type (standalone/replica).'
- macro: '{$GCP.MSSQL.INST.TYPE.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: |
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.
- macro: '{$GCP.MSSQL.ZONE.MATCHES}'
value: '.*'
description: 'The filter to include GCP Cloud SQL MSSQL instances by zone.'
- macro: '{$GCP.MSSQL.ZONE.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: 'The filter to exclude GCP Cloud SQL MSSQL instances by zone.'
- macro: '{$GCP.MYSQL.INST.NAME.MATCHES}'
value: '.*'
description: 'The filter to include GCP Cloud SQL MySQL instances by namespace.'
- macro: '{$GCP.MYSQL.INST.NAME.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: 'The filter to exclude GCP Cloud SQL MySQL instances by namespace.'
- macro: '{$GCP.MYSQL.INST.TYPE.MATCHES}'
value: '.*'
description: 'The filter to include GCP Cloud SQL MySQL instances by type (standalone/replica).'
- macro: '{$GCP.MYSQL.INST.TYPE.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: |
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.
- macro: '{$GCP.MYSQL.ZONE.MATCHES}'
value: '.*'
description: 'The filter to include GCP Cloud SQL MySQL instances by zone.'
- macro: '{$GCP.MYSQL.ZONE.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: 'The filter to exclude GCP Cloud SQL MySQL instances by zone.'
- macro: '{$GCP.PGSQL.INST.NAME.MATCHES}'
value: '.*'
description: 'The filter to include GCP Cloud SQL PostgreSQL instances by namespace.'
- macro: '{$GCP.PGSQL.INST.NAME.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: 'The filter to exclude GCP Cloud SQL PostgreSQL instances by namespace.'
- macro: '{$GCP.PGSQL.INST.TYPE.MATCHES}'
value: '.*'
description: 'The filter to include GCP Cloud SQL PostgreSQL instances by type (standalone/replica).'
- macro: '{$GCP.PGSQL.INST.TYPE.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: |
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.
- macro: '{$GCP.PGSQL.ZONE.MATCHES}'
value: '.*'
description: 'The filter to include GCP Cloud SQL PostgreSQL instances by zone.'
- macro: '{$GCP.PGSQL.ZONE.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: 'The filter to exclude GCP Cloud SQL PostgreSQL instances by zone.'
- macro: '{$GCP.PRIVATE.KEY}'
type: SECRET_TEXT
description: 'Service account private key data.'
- macro: '{$GCP.PRIVATE.KEY.ID}'
type: SECRET_TEXT
description: 'Service account private key id.'
- macro: '{$GCP.PROJECT.ID}'
description: 'GCP project ID.'
- macro: '{$GCP.PROXY}'
description: 'Sets HTTP proxy value. If this macro is empty then no proxy is used.'
- macro: '{$HTTP.TLS.VERIFY}'
value: full
description: '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"}.'
dashboards:
- uuid: 71df4601171e471ea74a291242028394
name: 'Project resources'
pages:
- name: 'Project resources'
widgets:
- type: item
name: 'GCE instances total'
width: '24'
height: '5'
fields:
- type: INTEGER
name: decimal_places
value: '0'
- type: ITEM
name: itemid.0
value:
host: 'GCP by HTTP'
key: gcp.gce.instances.total
- type: INTEGER
name: show.0
value: '2'
- type: INTEGER
name: show.1
value: '4'
- type: item
name: 'Cloud SQL total'
'y': '5'
width: '18'
height: '5'
fields:
- type: INTEGER
name: decimal_places
value: '0'
- type: ITEM
name: itemid.0
value:
host: 'GCP by HTTP'
key: gcp.cloudsql.instances.total
- type: INTEGER
name: show.0
value: '2'
- type: INTEGER
name: show.1
value: '4'
- type: graphprototype
'y': '10'
width: '36'
height: '5'
fields:
- type: INTEGER
name: columns
value: '1'
- type: GRAPH_PROTOTYPE
name: graphid.0
value:
host: 'GCP by HTTP'
name: 'GCP Compute Engine: Quota [{#GCE.QUOTA.NAME}]: Usage'
- type: STRING
name: reference
value: AAAAA
- type: item
name: 'Cloud SQL MySQL'
x: '18'
'y': '5'
width: '18'
height: '5'
fields:
- type: INTEGER
name: decimal_places
value: '0'
- type: ITEM
name: itemid.0
value:
host: 'GCP by HTTP'
key: gcp.cloudsql.instances.mysql_count
- type: INTEGER
name: show.0
value: '2'
- type: INTEGER
name: show.1
value: '4'
- type: item
name: 'GCE regular instances'
x: '24'
width: '24'
height: '5'
fields:
- type: INTEGER
name: decimal_places
value: '0'
- type: ITEM
name: itemid.0
value:
host: 'GCP by HTTP'
key: gcp.gce.instances.regular_count
- type: INTEGER
name: show.0
value: '2'
- type: INTEGER
name: show.1
value: '4'
- type: item
name: 'Cloud SQL PostgreSQL'
x: '36'
'y': '5'
width: '18'
height: '5'
fields:
- type: INTEGER
name: decimal_places
value: '0'
- type: ITEM
name: itemid.0
value:
host: 'GCP by HTTP'
key: gcp.cloudsql.instances.pgsql_count
- type: INTEGER
name: show.0
value: '2'
- type: INTEGER
name: show.1
value: '4'
- type: graphprototype
x: '36'
'y': '10'
width: '36'
height: '5'
fields:
- type: INTEGER
name: columns
value: '1'
- type: ITEM_PROTOTYPE
name: itemid.0
value:
host: 'GCP by HTTP'
key: 'gcp.gce.quota.pused[{#GCE.QUOTA.NAME}]'
- type: STRING
name: reference
value: AAAAB
- type: INTEGER
name: source_type
value: '3'
- type: item
name: 'GCE COS instances'
x: '48'
width: '24'
height: '5'
fields:
- type: INTEGER
name: decimal_places
value: '0'
- type: ITEM
name: itemid.0
value:
host: 'GCP by HTTP'
key: gcp.gce.instances.cos_count
- type: INTEGER
name: show.0
value: '2'
- type: INTEGER
name: show.1
value: '4'
- type: item
name: 'Cloud SQL MSSQL'
x: '54'
'y': '5'
width: '18'
height: '5'
fields:
- type: INTEGER
name: decimal_places
value: '0'
- type: ITEM
name: itemid.0
value:
host: 'GCP by HTTP'
key: gcp.cloudsql.instances.mssql_count
- type: INTEGER
name: show.0
value: '2'
- type: INTEGER
name: show.1
value: '4'