You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9444 lines
372 KiB
9444 lines
372 KiB
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" 2.0.0
|
|
vendor:
|
|
name: Zabbix
|
|
version: 7.0-0
|
|
groups:
|
|
- name: Templates/Cloud
|
|
items:
|
|
- uuid: b003e61fbede488a957b6c866ffaa9ba
|
|
name: 'GCP: Authorization errors check'
|
|
type: DEPENDENT
|
|
key: gcp.auth.err.check
|
|
delay: '0'
|
|
history: 7d
|
|
trends: '0'
|
|
value_type: TEXT
|
|
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: 'GCP: Authorization'
|
|
type: SCRIPT
|
|
key: gcp.authorization
|
|
delay: '{$GCP.AUTH.FREQUENCY}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
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 request = new HttpRequest(),
|
|
params = {
|
|
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',
|
|
assertion: signed_jwt
|
|
},
|
|
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: pkey_id
|
|
value: '{$GCP.PRIVATE.KEY.ID}'
|
|
- name: email
|
|
value: '{$GCP.CLIENT.EMAIL}'
|
|
- name: private_key
|
|
value: '{$GCP.PRIVATE.KEY}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: 3ac5c859692140c0b686e772efa05032
|
|
name: 'GCP Cloud SQL: Instances get'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.instances.get
|
|
delay: '0'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
description: 'GCP Cloud SQL: Instances get.'
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
var token = value;
|
|
|
|
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();
|
|
|
|
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*/)) {
|
|
var mssql_audit = getField(sql_inst, 'settings.sqlServerAuditConfig');
|
|
|
|
obj.audited = (mssql_audit.bucket) ? true : false;
|
|
}
|
|
|
|
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: b926ba1901c5413396c1c071e6e76072
|
|
name: 'GCP Cloud SQL: Instances total'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.instances.total
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
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: 'GCP Compute Engine: Container-Optimized instances count'
|
|
type: DEPENDENT
|
|
key: gcp.gce.instances.cos_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
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: 'GCP Compute Engine: Instances get'
|
|
type: DEPENDENT
|
|
key: gcp.gce.instances.get
|
|
delay: '0'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
description: 'Get GCP Compute Engine instances.'
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
var token = value;
|
|
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();
|
|
|
|
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: getField(inst, 'shieldedInstanceConfig.enableIntegrityMonitoring')
|
|
};
|
|
|
|
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: 80687b35246b45ffa1be9d171f686e94
|
|
name: 'GCP Cloud SQL MSSQL: Instances count'
|
|
type: DEPENDENT
|
|
key: gcp.gce.instances.mssql_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
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: 'GCP Cloud SQL MySQL: Instances count'
|
|
type: DEPENDENT
|
|
key: gcp.gce.instances.mysql_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
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: 'GCP Cloud SQL PostgreSQL: Instances count'
|
|
type: DEPENDENT
|
|
key: gcp.gce.instances.pgsql_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
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: a936207f9d914955b2e2140e953f22f2
|
|
name: 'GCP Compute Engine: Regular instances count'
|
|
type: DEPENDENT
|
|
key: gcp.gce.instances.regular_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
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: 'GCP Compute Engine: Instances total'
|
|
type: DEPENDENT
|
|
key: gcp.gce.instances.total
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
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: 'GCP Compute Engine: Project quotas get'
|
|
type: DEPENDENT
|
|
key: gcp.gce.quotas.get
|
|
delay: '0'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
description: 'GCP Compute Engine resource quotas available for the particular project.'
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
var token = value;
|
|
|
|
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();
|
|
|
|
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.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
|
|
- 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
|
|
lifetime: 7d
|
|
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: '{#MSSQL.AUDITED}'
|
|
path: $.audited
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.NAME}'
|
|
path: $.name
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
|
|
path: $.zone
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.IP}'
|
|
path: $.ip
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.EXT.IP}'
|
|
path: $.ext_ip
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
|
|
path: $.inst_type
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
|
|
path: $.db_type
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.TIER}'
|
|
path: $.tier
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
|
|
path: $.high_availability
|
|
- 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: '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.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
|
|
- 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
|
|
lifetime: 7d
|
|
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.NAME}'
|
|
path: $.name
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
|
|
path: $.zone
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.IP}'
|
|
path: $.ip
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.EXT.IP}'
|
|
path: $.ext_ip
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
|
|
path: $.inst_type
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
|
|
path: $.db_type
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.TIER}'
|
|
path: $.tier
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
|
|
path: $.high_availability
|
|
- 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.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
|
|
- 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
|
|
lifetime: 7d
|
|
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.NAME}'
|
|
path: $.name
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.ZONE}'
|
|
path: $.zone
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.IP}'
|
|
path: $.ip
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.EXT.IP}'
|
|
path: $.ext_ip
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.TYPE}'
|
|
path: $.inst_type
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.DB.TYPE}'
|
|
path: $.db_type
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.TIER}'
|
|
path: $.tier
|
|
- lld_macro: '{#CLOUD_SQL.INSTANCE.HIGH.AVAIL}'
|
|
path: $.high_availability
|
|
- 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
|
|
lifetime: 7d
|
|
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.ID}'
|
|
path: $.id
|
|
- lld_macro: '{#GCE.INSTANCE.NAME}'
|
|
path: $.name
|
|
- lld_macro: '{#GCE.INSTANCE.ZONE}'
|
|
path: $.zone
|
|
- lld_macro: '{#GCE.MACHINE.TYPE}'
|
|
path: $.m_type
|
|
- lld_macro: '{#GCE.INSTANCE.TYPE}'
|
|
path: $.i_type
|
|
- lld_macro: '{#GCE.INTEGRITY.STATE}'
|
|
path: $.integrity
|
|
- lld_macro: '{#GCE.INSTANCE.IP}'
|
|
path: $.ip
|
|
- lld_macro: '{#GCE.INSTANCE.EXT.IP}'
|
|
path: $.ext_ip
|
|
- 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
|
|
lifetime: 7d
|
|
description: 'GCP Compute Engine: Quotas discovery.'
|
|
item_prototypes:
|
|
- uuid: 1e9a772b9a89497ba695079fc480bd0a
|
|
name: 'GCP Compute Engine: Quota [{#GCE.QUOTA.NAME}]: Limit'
|
|
type: DEPENDENT
|
|
key: 'gcp.gce.quota.limit[{#GCE.QUOTA.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
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 Compute Engine: 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: 'GCP Compute Engine: Quota [{#GCE.QUOTA.NAME}]: Percentage used'
|
|
type: DEPENDENT
|
|
key: 'gcp.gce.quota.pused[{#GCE.QUOTA.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: 'GCP Compute Engine: Percentage usage for [{#GCE.QUOTA.NAME}] quota.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
- 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 Compute Engine: 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 Compute Engine: 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 Compute Engine: 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: 'GCP Compute Engine: Quota [{#GCE.QUOTA.NAME}]: Raw data'
|
|
type: DEPENDENT
|
|
key: 'gcp.gce.quota.single.raw[{#GCE.QUOTA.NAME}]'
|
|
delay: '0'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
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: 'GCP Compute Engine: Quota [{#GCE.QUOTA.NAME}]: Usage'
|
|
type: DEPENDENT
|
|
key: 'gcp.gce.quota.usage[{#GCE.QUOTA.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
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.NAME}'
|
|
path: $.metric
|
|
- lld_macro: '{#GCE.QUOTA.USAGE}'
|
|
path: $.usage
|
|
- lld_macro: '{#GCE.QUOTA.LIMIT}'
|
|
path: $.limit
|
|
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.'
|
|
dashboards:
|
|
- uuid: 71df4601171e471ea74a291242028394
|
|
name: 'Project resources'
|
|
pages:
|
|
- name: 'Project resources'
|
|
widgets:
|
|
- type: graphprototype
|
|
'y': '10'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: columns
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: rows
|
|
value: '1'
|
|
- type: GRAPH_PROTOTYPE
|
|
name: graphid
|
|
value:
|
|
host: 'GCP by HTTP'
|
|
name: 'GCP Compute Engine: Quota [{#GCE.QUOTA.NAME}]: Usage'
|
|
- type: graphprototype
|
|
x: '12'
|
|
'y': '10'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: columns
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: rows
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '3'
|
|
- type: ITEM_PROTOTYPE
|
|
name: itemid
|
|
value:
|
|
host: 'GCP by HTTP'
|
|
key: 'gcp.gce.quota.pused[{#GCE.QUOTA.NAME}]'
|
|
- type: item
|
|
name: 'Cloud SQL MSSQL'
|
|
x: '18'
|
|
'y': '5'
|
|
width: '6'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: show
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: show
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: adv_conf
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP by HTTP'
|
|
key: gcp.gce.instances.mssql_count
|
|
- type: item
|
|
name: 'Cloud SQL MySQL'
|
|
x: '6'
|
|
'y': '5'
|
|
width: '6'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: show
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: show
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: adv_conf
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP by HTTP'
|
|
key: gcp.gce.instances.mysql_count
|
|
- type: item
|
|
name: 'Cloud SQL PostgreSQL'
|
|
x: '12'
|
|
'y': '5'
|
|
width: '6'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: show
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: show
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: adv_conf
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP by HTTP'
|
|
key: gcp.gce.instances.pgsql_count
|
|
- type: item
|
|
name: 'Cloud SQL total'
|
|
'y': '5'
|
|
width: '6'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: show
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: show
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: adv_conf
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP by HTTP'
|
|
key: gcp.cloudsql.instances.total
|
|
- type: item
|
|
name: 'GCE COS instances'
|
|
x: '16'
|
|
width: '8'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: show
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: show
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: adv_conf
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP by HTTP'
|
|
key: gcp.gce.instances.cos_count
|
|
- type: item
|
|
name: 'GCE instances total'
|
|
width: '8'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: show
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: show
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: adv_conf
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP by HTTP'
|
|
key: gcp.gce.instances.total
|
|
- type: item
|
|
name: 'GCE regular instances'
|
|
x: '8'
|
|
width: '8'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: show
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: show
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: adv_conf
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP by HTTP'
|
|
key: gcp.gce.instances.regular_count
|
|
- uuid: 507d70db18554a4e9ee5e09bb29bc85f
|
|
template: 'GCP Cloud SQL MSSQL by HTTP'
|
|
name: 'GCP Cloud SQL MSSQL by HTTP'
|
|
description: |
|
|
Get GCP Cloud SQL MSSQL instances monitoring with script item usage to perform HTTP requests to Google Cloud Platform Monitoring API.
|
|
This template will be automatically connected to discovered entities with all their required parameters pre-defined.
|
|
|
|
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" 2.0.0
|
|
vendor:
|
|
name: Zabbix
|
|
version: 7.0-0
|
|
groups:
|
|
- name: Templates/Cloud
|
|
items:
|
|
- uuid: a8d79cab89864c03a7614bd59f734942
|
|
name: 'GCP Cloud SQL MSSQL: Audits size'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.audits_size
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
Tracks the size in bytes of stored SQLServer audit files on an instance.
|
|
Empty value if there are no audits enabled.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_audits_size
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: security
|
|
- uuid: 3026bc61670c496a942a94ab50b614df
|
|
name: 'GCP Cloud SQL MSSQL: Audits successfully uploaded'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.audits_upload_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Tracks the size in bytes of stored SQLServer audit files on an instance.
|
|
Empty value if there are no audits enabled.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_success
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: security
|
|
- uuid: d512c542f5514681acbb11431a0a6f5a
|
|
name: 'GCP Cloud SQL MSSQL: Connection resets'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.conn.connection_reset_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of login operations started from the connection pool since the last restart of SQL Server service.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_connection_reset_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- tag: component
|
|
value: network
|
|
- uuid: 300a6cb53fb44176bdf99eba86a976bd
|
|
name: 'GCP Cloud SQL MSSQL: Login attempts'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.conn.login_attempt_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Total number of login attempts since the last restart of SQL Server service.
|
|
This does not include pooled connections.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_login_attempt_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- tag: component
|
|
value: network
|
|
- uuid: 622c237ed12e44c7b2415676ec23bd2d
|
|
name: 'GCP Cloud SQL MSSQL: Logouts'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.conn.logout_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of logout operations since the last restart of SQL Server service.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_logout_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- tag: component
|
|
value: network
|
|
- uuid: 6ba672cbf4c242eb8e6fb80eba4c90d8
|
|
name: 'GCP Cloud SQL MSSQL: Processes blocked'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.conn.processes_blocked
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Current number of blocked processes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_processes_blocked
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- tag: component
|
|
value: network
|
|
- uuid: 38de8ae591854d5fbc4ee4946a2e189a
|
|
name: 'GCP Cloud SQL MSSQL: Reserved CPU cores'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.cpu.reserved_cores
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
description: 'Number of cores reserved for the database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_reserved_cores
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
- uuid: cd1f9ab326ac4694b3aeea6cb4ec56ab
|
|
name: 'GCP Cloud SQL MSSQL: CPU usage time'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.cpu.usage_time
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: s
|
|
description: 'Cumulative CPU usage time in seconds.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_usage_time
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
- uuid: 42d51e38b96f472996eff1e0f9d7b931
|
|
name: 'GCP Cloud SQL MSSQL: CPU utilization'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.cpu.utilization
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: 'Current CPU utilization represented as a percentage of the reserved CPU that is currently in use.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_utilization
|
|
- type: MULTIPLIER
|
|
parameters:
|
|
- '100'
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
triggers:
|
|
- uuid: b8280e45fea8470e9f36f7f08e4a77e1
|
|
expression: 'min(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.cpu.utilization,5m) >= {$CLOUD_SQL.MSSQL.CPU.UTIL.MAX}'
|
|
name: 'GCP Cloud SQL MSSQL: High CPU utilization'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: AVERAGE
|
|
description: 'The CPU utilization is too high. The system might be slow to respond.'
|
|
tags:
|
|
- tag: scope
|
|
value: performance
|
|
- uuid: ecdd1774ef744bcb93e8e4094e29772f
|
|
name: 'GCP Cloud SQL MSSQL: Databases get'
|
|
type: SCRIPT
|
|
key: gcp.cloudsql.mssql.db.get
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'cloudsql.googleapis.com/database/sqlserver/transactions/',
|
|
arr = [],
|
|
base_paths = [
|
|
'log_bytes_flushed_count',
|
|
'transaction_count'
|
|
];
|
|
|
|
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 checkParams(params) {
|
|
['project_id', 'time_window', 'database_id', 'token'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
function getHttpData(url, token, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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 params = checkParams(JSON.parse(value)),
|
|
time_window = params.time_window,
|
|
project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter database_id = '" + params.database_id + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query';
|
|
|
|
var raw = getHttpData(url, params.token, { query: '{' + base_paths.map(function (path) { return base_path + path; }).join(';') + '}' + j_filter }),
|
|
metrics = getField(raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
time_series = getField(raw, 'timeSeriesData');
|
|
|
|
for (t in time_series) {
|
|
data = {
|
|
database: getField(time_series[t], 'labelValues.3.stringValue'),
|
|
metrics: {}
|
|
};
|
|
|
|
for (i in metrics) {
|
|
re = /(^t_\d+\.value(_|\.))/g;
|
|
data['metrics'][getField(metrics[i], 'key').replace(re, '')] = getField(time_series[t], 'pointData.0.values.' + i + '.int64Value');
|
|
}
|
|
arr.push(data);
|
|
}
|
|
return JSON.stringify(arr);
|
|
description: 'MSSQL databases data in raw format.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: database_id
|
|
value: '{$GCP.PROJECT.ID}:{HOST.NAME}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: 9806c645a10a4e1d8fbb39eb1d3ac993
|
|
name: 'GCP Cloud SQL MSSQL: DB engine state'
|
|
type: HTTP_AGENT
|
|
key: gcp.cloudsql.mssql.db.state
|
|
history: 7d
|
|
description: 'GCP Cloud SQL MSSQL DB Engine State.'
|
|
valuemap:
|
|
name: 'Database availability'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.timeSeriesData[0].pointData[0].values[0].int64Value'
|
|
error_handler: DISCARD_VALUE
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 10m
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
url: 'https://monitoring.googleapis.com/v3/projects/{$GCP.PROJECT.ID}/timeSeries:query'
|
|
posts: '{"query":"cloudsql.googleapis.com/database/up | within 5m | filter database_id = ''{$GCP.PROJECT.ID}:{HOST.NAME}''"}'
|
|
status_codes: ''
|
|
headers:
|
|
- name: Content-Type
|
|
value: application/json
|
|
- name: Authorization
|
|
value: 'Bearer {$GCP.AUTH.TOKEN}'
|
|
request_method: POST
|
|
tags:
|
|
- tag: component
|
|
value: status
|
|
triggers:
|
|
- uuid: b3c7b8e2e38a42fe9d2ae3c84b637e53
|
|
expression: |
|
|
last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.db.state)=0
|
|
|
|
name: 'GCP Cloud SQL MSSQL: Database engine is down'
|
|
priority: AVERAGE
|
|
description: |
|
|
Database engine is down.
|
|
If an instance experiences unplanned (non-maintenance) downtime, the instance state will still be RUNNING, but the database engine state metric will report 0.
|
|
|
|
dependencies:
|
|
- name: 'GCP Cloud SQL MSSQL: Failed to get the instance state'
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 10'
|
|
- name: 'GCP Cloud SQL MSSQL: Instance is in failed state'
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 5'
|
|
- name: 'GCP Cloud SQL MSSQL: Instance is in maintenance'
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 4'
|
|
- name: 'GCP Cloud SQL MSSQL: Instance is in suspended state'
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 1'
|
|
- name: 'GCP Cloud SQL MSSQL: Instance is in unknown state'
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 6'
|
|
- name: 'GCP Cloud SQL MSSQL: Instance is stopped by the owner'
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 2'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: cd6cf3870a514ff59bd1f40987764642
|
|
name: 'GCP Cloud SQL MSSQL: Disk bytes used'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.disk.bytes_used
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Data utilization in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_bytes_used
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: 86bdbf20c9b4466c9ea00e26cb0f0652
|
|
name: 'GCP Cloud SQL MSSQL: Disk size'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.disk.quota
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Maximum data disk size in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_quota
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: 400a7318203f40928ebf0b023da65848
|
|
name: 'GCP Cloud SQL MSSQL: Disk read I/O'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.disk.read_ops_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of data disk read I/O operations.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_read_ops_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: 1d0c09441d9d4333b7be32c3d69bad47
|
|
name: 'GCP Cloud SQL MSSQL: Disk utilization'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.disk.utilization
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: |
|
|
The fraction of the disk quota that is currently in use.
|
|
Shown as percentage.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_utilization
|
|
- type: MULTIPLIER
|
|
parameters:
|
|
- '100'
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
triggers:
|
|
- uuid: 2cbc7e3008f24197963df4ea920ab5a8
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.disk.utilization) >= {$CLOUD_SQL.MSSQL.DISK.UTIL.CRIT}'
|
|
name: 'GCP Cloud SQL MSSQL: Disk space is critically low'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: AVERAGE
|
|
description: 'Critical utilization of the disk space.'
|
|
tags:
|
|
- tag: scope
|
|
value: capacity
|
|
- uuid: 2569abbb94ca4df38cdd4f9d5a5df9fc
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.disk.utilization) >= {$CLOUD_SQL.MSSQL.DISK.UTIL.WARN}'
|
|
name: 'GCP Cloud SQL MSSQL: Disk space is low'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: WARNING
|
|
description: 'High utilization of the storage space.'
|
|
dependencies:
|
|
- name: 'GCP Cloud SQL MSSQL: Disk space is critically low'
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.disk.utilization) >= {$CLOUD_SQL.MSSQL.DISK.UTIL.CRIT}'
|
|
tags:
|
|
- tag: scope
|
|
value: capacity
|
|
- uuid: 819078cd99af46368eb33d76dadf4861
|
|
name: 'GCP Cloud SQL MSSQL: Disk write I/O'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.disk.write_ops_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of data disk write I/O operations.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_write_ops_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: 556c96cf1bf342f99c69dc47813f221e
|
|
name: 'GCP Cloud SQL MSSQL: Instance state'
|
|
type: HTTP_AGENT
|
|
key: gcp.cloudsql.mssql.inst.state
|
|
history: 7d
|
|
description: 'GCP Cloud SQL MSSQL Current instance state.'
|
|
valuemap:
|
|
name: 'Instance state'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.timeSeriesData[0].pointData[0].values[0].stringValue'
|
|
error_handler: CUSTOM_VALUE
|
|
error_handler_params: '10'
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const idx = [
|
|
'RUNNING',
|
|
'SUSPENDED',
|
|
'RUNNABLE',
|
|
'PENDING_CREATE',
|
|
'MAINTENANCE',
|
|
'FAILED',
|
|
'UNKNOWN_STATE'
|
|
].indexOf(value);
|
|
return idx !== -1 ? idx : 10;
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 10m
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
url: 'https://monitoring.googleapis.com/v3/projects/{$GCP.PROJECT.ID}/timeSeries:query'
|
|
posts: '{"query":"cloudsql.googleapis.com/database/state | within 5m | filter database_id = ''{$GCP.PROJECT.ID}:{HOST.NAME}''"}'
|
|
status_codes: ''
|
|
headers:
|
|
- name: Content-Type
|
|
value: application/json
|
|
- name: Authorization
|
|
value: 'Bearer {$GCP.AUTH.TOKEN}'
|
|
request_method: POST
|
|
tags:
|
|
- tag: component
|
|
value: status
|
|
triggers:
|
|
- uuid: dff9067ad7de4ab1a4f83c9d482e6b71
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 10'
|
|
name: 'GCP Cloud SQL MSSQL: Failed to get the instance state'
|
|
priority: AVERAGE
|
|
description: |
|
|
Failed to get the instance state.
|
|
Check access permissions to GCP API or service account.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 3d7e054340e94b09b085e508b9b76841
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 5'
|
|
name: 'GCP Cloud SQL MSSQL: Instance is in failed state'
|
|
priority: AVERAGE
|
|
description: |
|
|
The instance creation failed, or an operation left the instance in an own bad state.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: dd395fd3003f4fce847cd72309cdf7ec
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 4'
|
|
name: 'GCP Cloud SQL MSSQL: Instance is in maintenance'
|
|
priority: INFO
|
|
description: 'The instance is down for maintenance.'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 3c080bba511e44aab1139b66f00451ee
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 1'
|
|
name: 'GCP Cloud SQL MSSQL: Instance is in suspended state'
|
|
priority: WARNING
|
|
description: |
|
|
The instance is in suspended state.
|
|
It is not available, for example, due to problems with billing.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 378b4d62582d416db7cb7fd6ed099ac9
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 6'
|
|
name: 'GCP Cloud SQL MSSQL: Instance is in unknown state'
|
|
priority: AVERAGE
|
|
description: |
|
|
The state of the instance is unknown.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 72ecba08f6424573a36b816da9695b89
|
|
expression: 'last(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.inst.state) = 2'
|
|
name: 'GCP Cloud SQL MSSQL: Instance is stopped by the owner'
|
|
priority: INFO
|
|
description: |
|
|
The instance has been stopped by the owner.
|
|
It is not currently running, but it's ready to be restarted.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: a29584de7ab142309f0bb6f57b52af85
|
|
name: 'GCP Cloud SQL MSSQL: Buffer cache hit ratio'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.buffer_cache_hit_ratio
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: |
|
|
Current percentage of pages found in the buffer cache without having to read from disk.
|
|
The ratio is the total number of cache hits divided by the total number of cache lookups.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_buffer_cache_hit_ratio
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: f8460bbac21c44a98a31a49daf7f692f
|
|
name: 'GCP Cloud SQL MSSQL: Checkpoint pages'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.checkpoint_page_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of pages flushed to disk by a checkpoint or other operation that requires all dirty pages to be flushed.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_checkpoint_page_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: cc6a5230c7a2447e8038cdbe52105da4
|
|
name: 'GCP Cloud SQL MSSQL: Free list stalls'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.free_list_stall_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of requests that had to wait for a free page.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_free_list_stall_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: d86e328fc5fa4c3d938a4959075299b5
|
|
name: 'GCP Cloud SQL MSSQL: Lazy writes'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.lazy_write_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Total number of buffers written by the buffer manager's lazy writer.
|
|
The lazy writer is a system process that flushes out batches of dirty, aged buffers
|
|
(buffers that contain changes that must be written back to disk before the buffer can be reused for a different page)
|
|
and makes them available to user processes.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_lazy_write_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 2fa0744221884109951ce62d3bb9aaaf
|
|
name: 'GCP Cloud SQL MSSQL: Memory grants pending'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.memory_grants_pending
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Current number of processes waiting for a workspace memory grant.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_memory_grants_pending
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 3dcad151d0c04f8eb0e8e81c00de23c8
|
|
name: 'GCP Cloud SQL MSSQL: Page life expectancy'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.page_life_expectancy
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: s
|
|
description: 'Current number of seconds a page will stay in the buffer pool without references.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_page_life_expectancy
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 4d87a50d490348afbaf751857beb5b61
|
|
name: 'GCP Cloud SQL MSSQL: Read page operations'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.page_ops.read
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Total number of physical database page reads.
|
|
This metric counts physical page reads across all databases.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_read
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 41654bd730b744acbc0ea6de07c992f3
|
|
name: 'GCP Cloud SQL MSSQL: Write age operations'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.page_ops.write
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Total number of physical database page writes.
|
|
This metric counts physical page writes across all databases.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_write
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: db943300803847718c52d0d33988d81e
|
|
name: 'GCP Cloud SQL MSSQL: Memory size'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.quota
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Maximum RAM size in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_quota
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 21b075a5f95d4c93888b7a0766fdcea5
|
|
name: 'GCP Cloud SQL MSSQL: Memory used by DB engine'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.total_usage
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
Total RAM usage in bytes.
|
|
This metric reports the RAM usage of the database process, including the buffer/cache.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_total_usage
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 05d1ff573371416dad9ee028247b1cf3
|
|
name: 'GCP Cloud SQL MSSQL: Memory usage'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.usage
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
The RAM usage in bytes.
|
|
This metric reports the RAM usage of the server, excluding the buffer/cache.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_usage
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 4e11944fb7624ffdb02b5d1bb5bedf7a
|
|
name: 'GCP Cloud SQL MSSQL: Memory utilization'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.memory.utilization
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: |
|
|
The fraction of the memory quota that is currently in use.
|
|
Shown as percentage.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_ram_pused
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
triggers:
|
|
- uuid: c5003533f3524b8b868a0c2f86b1fa9b
|
|
expression: 'min(/GCP Cloud SQL MSSQL by HTTP/gcp.cloudsql.mssql.memory.utilization,5m) >= {$CLOUD_SQL.MSSQL.RAM.UTIL.MAX}'
|
|
name: 'GCP Cloud SQL MSSQL: High memory utilization'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: HIGH
|
|
description: 'RAM utilization is too high. The system might be slow to respond.'
|
|
tags:
|
|
- tag: scope
|
|
value: performance
|
|
- uuid: 6de08b07cecc47a88bde22de5d1b4e5a
|
|
name: 'GCP Cloud SQL MSSQL: Metrics get'
|
|
type: SCRIPT
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'cloudsql.googleapis.com/database/',
|
|
mssql_path = 'cloudsql.googleapis.com/database/sqlserver/',
|
|
obj = {},
|
|
base_paths = [
|
|
'cpu/reserved_cores',
|
|
'cpu/usage_time',
|
|
'cpu/utilization',
|
|
'disk/read_ops_count',
|
|
'disk/write_ops_count',
|
|
'memory/quota',
|
|
'memory/total_usage',
|
|
'memory/usage',
|
|
'network/connections',
|
|
'network/received_bytes_count',
|
|
'network/sent_bytes_count | map ignore [destination]'
|
|
].map(function (path) { return base_path + path; }),
|
|
mssql_paths = [
|
|
'connections/connection_reset_count',
|
|
'connections/login_attempt_count',
|
|
'connections/logout_count',
|
|
'connections/processes_blocked',
|
|
'memory/buffer_cache_hit_ratio',
|
|
'memory/checkpoint_page_count',
|
|
'memory/lazy_write_count',
|
|
'memory/memory_grants_pending',
|
|
'memory/page_life_expectancy',
|
|
'memory/free_list_stall_count',
|
|
'transactions/batch_request_count',
|
|
'transactions/forwarded_record_count',
|
|
'transactions/full_scan_count',
|
|
'transactions/page_split_count',
|
|
'transactions/probe_scan_count',
|
|
'transactions/sql_compilation_count',
|
|
'transactions/sql_recompilation_count'
|
|
].map(function (path) { return mssql_path + path; }).concat(
|
|
['disk/bytes_used', 'disk/utilization', 'disk/quota'].map(function (path) { return base_path + path; })),
|
|
value_types = ['int64Value', 'doubleValue', 'stringValue', 'boolValue'];
|
|
|
|
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 checkParams(params) {
|
|
['project_id', 'time_window', 'database_id', 'token', 'audited'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
if (params.audited !== 'true' && params.audited !== 'false') {
|
|
throw 'Incorrect audit definition type. Valid definitions: true/false';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
function getHttpData(url, token, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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;
|
|
};
|
|
|
|
function rawMap(raw, prefix) {
|
|
var keys = getField(raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
values = getField(raw, 'timeSeriesData.0.pointData.0.values'),
|
|
re = /(^t_\d+\.value\.)/g;
|
|
|
|
for (i in keys) {
|
|
var key = getField(keys[i], 'key').replace(re, '');
|
|
|
|
for (v in value_types) {
|
|
if (typeof values[i][value_types[v]] !== 'undefined') {
|
|
if (prefix) {
|
|
obj[prefix + key] = values[i][value_types[v]];
|
|
}
|
|
else {
|
|
obj[key] = values[i][value_types[v]];
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
function singleMetrics(tsd) {
|
|
var result = {};
|
|
|
|
for (t in tsd) {
|
|
for (v in value_types) {
|
|
if (getFieldBool(tsd[t], 'pointData.0.values.0.' + [value_types[v]])) {
|
|
result['mssql_' + getField(tsd[t], 'labelValues.3.stringValue').toLowerCase()] = tsd[t].pointData[0].values[0][value_types[v]];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
var params = checkParams(JSON.parse(value));
|
|
|
|
if (params.audited === 'true') {
|
|
base_paths.push(mssql_path + 'audits_size');
|
|
};
|
|
|
|
var time_window = params.time_window,
|
|
project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter database_id = '" + params.database_id + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query',
|
|
queries = [
|
|
{ name: 'base_', data: { query: '{' + base_paths.join(';') + '}' + j_filter } },
|
|
{ name: 'mssql_', data: { query: '{' + mssql_paths.join(';') + '}' + j_filter } }
|
|
];
|
|
|
|
for (q in queries) {
|
|
raw = getHttpData(url, params.token, queries[q].data);
|
|
obj = Object.assign(obj, rawMap(raw, queries[q].name));
|
|
}
|
|
|
|
obj.base_ram_pused = Math.floor(getField(obj, 'base_usage') / getField(obj, 'base_quota') * 100);
|
|
|
|
var single_queries = [
|
|
{ query: mssql_path + 'memory/page_operation_count' + filter }
|
|
];
|
|
|
|
if (params.audited === 'true') {
|
|
single_queries.push({ query: mssql_path + 'audits_upload_count' + filter });
|
|
}
|
|
|
|
for (q in single_queries) {
|
|
raw = getHttpData(url, params.token, single_queries[q]);
|
|
Object.assign(obj, singleMetrics(getField(raw, 'timeSeriesData')));
|
|
}
|
|
|
|
return JSON.stringify(obj);
|
|
description: 'MSSQL metrics data in raw format.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: database_id
|
|
value: '{$GCP.PROJECT.ID}:{HOST.NAME}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
- name: audited
|
|
value: '{$CLOUD_SQL.MSSQL.AUDITED}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: 393b6117008d4925be9474afc9c7cdf9
|
|
name: 'GCP Cloud SQL MSSQL: Connections'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.network.connections
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of connections to the databases on the Cloud SQL instance.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_connections
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- tag: component
|
|
value: network
|
|
- uuid: 297744bfcdd84565b828e1c6912beb46
|
|
name: 'GCP Cloud SQL MSSQL: Network: Received bytes'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.network.received_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Delta count of bytes received through the network.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_received_bytes_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: b362d14169b34f00ab3fa94b89a1b362
|
|
name: 'GCP Cloud SQL MSSQL: Network: Sent bytes'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.network.sent_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Delta count of bytes sent through the network.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_sent_bytes_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 7ee117702e1f40faadd901faa9d333ff
|
|
name: 'GCP Cloud SQL MSSQL: Resources get'
|
|
type: SCRIPT
|
|
key: gcp.cloudsql.mssql.resources.get
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'cloudsql.googleapis.com/database/sqlserver/transactions/',
|
|
arr = [],
|
|
base_paths = [
|
|
'deadlock_count',
|
|
'lock_wait_count',
|
|
'lock_wait_time'
|
|
];
|
|
|
|
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 checkParams(params) {
|
|
['project_id', 'time_window', 'database_id', 'token'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
function getHttpData(url, token, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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 params = checkParams(JSON.parse(value)),
|
|
time_window = params.time_window,
|
|
project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter database_id = '" + params.database_id + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query';
|
|
|
|
var raw = getHttpData(url, params.token, { query: '{' + base_paths.map(function (path) { return base_path + path; }).join(';') + '}' + j_filter }),
|
|
metrics = getField(raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
time_series = getField(raw, 'timeSeriesData');
|
|
|
|
for (t in time_series) {
|
|
data = {
|
|
resource: getField(time_series[t], 'labelValues.3.stringValue'),
|
|
metrics: {}
|
|
};
|
|
|
|
for (i in metrics) {
|
|
re = /(^t_\d+\.value(_|\.))/g;
|
|
data['metrics'][getField(metrics[i], 'key').replace(re, '')] = getField(time_series[t], 'pointData.0.values.' + i + '.int64Value');
|
|
}
|
|
arr.push(data);
|
|
}
|
|
return JSON.stringify(arr);
|
|
description: 'MSSQL resources data in raw format.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: database_id
|
|
value: '{$GCP.PROJECT.ID}:{HOST.NAME}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: 3c14882329b94b8e88ca5d85e21bb7c8
|
|
name: 'GCP Cloud SQL MSSQL: Schedulers get'
|
|
type: SCRIPT
|
|
key: gcp.cloudsql.mssql.schedulers.get
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'cloudsql.googleapis.com/database/sqlserver/schedulers/',
|
|
arr = [],
|
|
base_paths = ['active_workers', 'current_tasks', 'current_workers', 'pending_disk_io', 'runnable_tasks', 'work_queue'];
|
|
|
|
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 checkParams(params) {
|
|
['project_id', 'time_window', 'database_id', 'token'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
function getHttpData(url, token, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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 params = checkParams(JSON.parse(value)),
|
|
time_window = params.time_window,
|
|
project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter database_id = '" + params.database_id + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query';
|
|
|
|
var raw = getHttpData(url, params.token, { query: '{' + base_paths.map(function (path) { return base_path + path; }).join(';') + '}' + j_filter }),
|
|
metrics = getField(raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
time_series = getField(raw, 'timeSeriesData');
|
|
|
|
for (t in time_series) {
|
|
data = {
|
|
scheduler: getField(time_series[t], 'labelValues.3.stringValue'),
|
|
metrics: {}
|
|
};
|
|
|
|
for (i in metrics) {
|
|
re = /(^t_\d+\.value(_|\.))/g;
|
|
data['metrics'][getField(metrics[i], 'key').replace(re, '')] = getField(time_series[t], 'pointData.0.values.' + i + '.int64Value');
|
|
}
|
|
arr.push(data);
|
|
}
|
|
return JSON.stringify(arr);
|
|
description: 'MSSQL schedulers data in raw format.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: database_id
|
|
value: '{$GCP.PROJECT.ID}:{HOST.NAME}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: 7d2c28a537e44ee284e4b5d186b935d6
|
|
name: 'GCP Cloud SQL MSSQL: Batch requests'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.trans.batch_request_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of Transact-SQL command batches received.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_batch_request_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: 774cffa1a1f24d778f346bea24926690
|
|
name: 'GCP Cloud SQL MSSQL: Forwarded records'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.trans.forwarded_record_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of records fetched through forwarded record pointers.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_forwarded_record_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: f80a924d20c4470496202d3e32261e7d
|
|
name: 'GCP Cloud SQL MSSQL: Full scans'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.trans.full_scan_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Total number of unrestricted full scans.
|
|
These can be either base-table or full-index scans.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_full_scan_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: cd6f91964b7041bb929c6f6f3430cc75
|
|
name: 'GCP Cloud SQL MSSQL: Page splits'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.trans.page_split_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of page splits that occur as the result of overflowing index pages.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_page_split_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: 0b431016ca8245dea8e33c252a9a7c9b
|
|
name: 'GCP Cloud SQL MSSQL: Probe scans'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.trans.probe_scan_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of probe scans that are used to find at least one single qualified row in an index or base table directly.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_probe_scan_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: bf4eb81de038452cb3af16b4efcdb4c5
|
|
name: 'GCP Cloud SQL MSSQL: SQL compilations'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.trans.sql_compilation_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of SQL compilations.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_sql_compilation_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: 39c350f5d1f94726b03c435e9e5e3110
|
|
name: 'GCP Cloud SQL MSSQL: SQL recompilations'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.trans.sql_recompilation_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of SQL recompilations.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mssql_sql_recompilation_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
discovery_rules:
|
|
- uuid: 2dad3e63931942f8937b8720c9477a66
|
|
name: 'Databases discovery'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.db.discovery
|
|
delay: '0'
|
|
filter:
|
|
evaltype: AND
|
|
conditions:
|
|
- macro: '{#DB.NAME}'
|
|
value: '{$CLOUD_SQL.MSSQL.DB.NAME.MATCHES}'
|
|
formulaid: A
|
|
- macro: '{#DB.NAME}'
|
|
value: '{$CLOUD_SQL.MSSQL.DB.NAME.NOT_MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: B
|
|
lifetime: 7d
|
|
description: 'Databases discovery.'
|
|
item_prototypes:
|
|
- uuid: 8f6deafa9efd416797ea58d1fce41c29
|
|
name: 'GCP Cloud SQL MSSQL: Database [{#DB.NAME}]: Log bytes flushed'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.db.log_bytes_flushed_count[{#DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Total number of log bytes flushed for the [{#DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.log_bytes_flushed_count
|
|
master_item:
|
|
key: 'gcp.cloudsql.mssql.db.raw[{#DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: database
|
|
- tag: database
|
|
value: '{#DB.NAME}'
|
|
- uuid: b52f757bc2b341e891f60e15795088ca
|
|
name: 'GCP Cloud SQL MSSQL: Database [{#DB.NAME}]: Raw data'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.db.raw[{#DB.NAME}]'
|
|
delay: '0'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
description: 'Data in raw format for the [{#DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$[?(@.database == "{#DB.NAME}")].metrics.first()'
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.db.get
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- tag: database
|
|
value: '{#DB.NAME}'
|
|
- uuid: 9f8d37a25e1041c087bbea8d670cce46
|
|
name: 'GCP Cloud SQL MSSQL: Database [{#DB.NAME}]: Transactions started'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.db.transaction_count[{#DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of transactions started for the [{#DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.transaction_count
|
|
master_item:
|
|
key: 'gcp.cloudsql.mssql.db.raw[{#DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: database
|
|
- tag: database
|
|
value: '{#DB.NAME}'
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.db.get
|
|
lld_macro_paths:
|
|
- lld_macro: '{#DB.NAME}'
|
|
path: $.database
|
|
preprocessing:
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 3h
|
|
- uuid: d47a9164fdf54309ab96f48f6dc3c037
|
|
name: 'Resources discovery'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.resources.discovery
|
|
delay: '0'
|
|
filter:
|
|
evaltype: AND
|
|
conditions:
|
|
- macro: '{#RESOURCE.NAME}'
|
|
value: '{$CLOUD_SQL.MSSQL.RES.NAME.MATCHES}'
|
|
formulaid: A
|
|
- macro: '{#RESOURCE.NAME}'
|
|
value: '{$CLOUD_SQL.MSSQL.RES.NAME.NOT_MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: B
|
|
lifetime: 7d
|
|
description: 'Resources discovery.'
|
|
item_prototypes:
|
|
- uuid: 55bb12000dca46e096045da83a46edea
|
|
name: 'GCP Cloud SQL MSSQL: Resource [{#RESOURCE.NAME}]: Deadlocks'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.resource.deadlock_count[{#RESOURCE.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of lock requests that resulted in a deadlock for the [{#RESOURCE.NAME}] resource.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.deadlock_count
|
|
master_item:
|
|
key: 'gcp.cloudsql.mssql.resource.raw[{#RESOURCE.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: resource
|
|
- tag: resource
|
|
value: '{#RESOURCE.NAME}'
|
|
- uuid: 0117dba440f34461959490efaff059e2
|
|
name: 'GCP Cloud SQL MSSQL: Resource [{#RESOURCE.NAME}]: Lock waits'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.resource.lock_wait_count[{#RESOURCE.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of lock requests that required the caller to wait for the [{#RESOURCE.NAME}] resource.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.lock_wait_count
|
|
master_item:
|
|
key: 'gcp.cloudsql.mssql.resource.raw[{#RESOURCE.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: resource
|
|
- tag: resource
|
|
value: '{#RESOURCE.NAME}'
|
|
- uuid: 6e8b5646d70b470fa18960c7b43a9aff
|
|
name: 'GCP Cloud SQL MSSQL: Resource [{#RESOURCE.NAME}]: Lock wait time'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.resource.lock_wait_time[{#RESOURCE.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: s
|
|
description: 'Total time lock requests were waiting for locks for the [{#RESOURCE.NAME}] resource.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.lock_wait_time
|
|
master_item:
|
|
key: 'gcp.cloudsql.mssql.resource.raw[{#RESOURCE.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: resource
|
|
- tag: resource
|
|
value: '{#RESOURCE.NAME}'
|
|
- uuid: 0cc16595d1e044db947084a44786aaaa
|
|
name: 'GCP Cloud SQL MSSQL: Resource [{#RESOURCE.NAME}]: Raw data'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.resource.raw[{#RESOURCE.NAME}]'
|
|
delay: '0'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
description: 'Data in raw format for the [{#RESOURCE.NAME}] resource.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$[?(@.resource == "{#RESOURCE.NAME}")].metrics.first()'
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.resources.get
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- tag: resource
|
|
value: '{#RESOURCE.NAME}'
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.resources.get
|
|
lld_macro_paths:
|
|
- lld_macro: '{#RESOURCE.NAME}'
|
|
path: $.resource
|
|
preprocessing:
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 3h
|
|
- uuid: 31667d0e9c32458d9c895367b3ca7042
|
|
name: 'Schedulers discovery'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.schedulers.discovery
|
|
delay: '0'
|
|
filter:
|
|
evaltype: AND
|
|
conditions:
|
|
- macro: '{#SCHEDULER.ID}'
|
|
value: '{$CLOUD_SQL.MSSQL.SCHEDULER.ID.MATCHES}'
|
|
formulaid: A
|
|
- macro: '{#SCHEDULER.ID}'
|
|
value: '{$CLOUD_SQL.MSSQL.SCHEDULER.ID.NOT_MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: B
|
|
lifetime: 7d
|
|
description: 'Schedulers discovery.'
|
|
item_prototypes:
|
|
- uuid: 67bde61c128e4dfe9e47d8a3a6e3ceec
|
|
name: 'GCP Cloud SQL MSSQL: Scheduler [{#SCHEDULER.ID}]: Active workers'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.scheduler.active_workers[{#SCHEDULER.ID}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Current number of active workers associated with the scheduler that goes by its ID [{#SCHEDULER.ID}].
|
|
An active worker is never preemptive, must have an associated task, and is either running, runnable, or suspended.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.active_workers
|
|
master_item:
|
|
key: 'gcp.cloudsql.mssql.scheduler.raw[{#SCHEDULER.ID}]'
|
|
tags:
|
|
- tag: component
|
|
value: scheduler
|
|
- tag: scheduler
|
|
value: '{#SCHEDULER.ID}'
|
|
- uuid: fc5113b2b5f64205ad9d100bd480adea
|
|
name: 'GCP Cloud SQL MSSQL: Scheduler [{#SCHEDULER.ID}]: Current tasks'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.scheduler.current_tasks[{#SCHEDULER.ID}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Current number of present tasks associated with the scheduler that goes by its ID [{#SCHEDULER.ID}].
|
|
This count includes tasks that are waiting for a worker to execute them and tasks that are currently waiting or running (in SUSPENDED or RUNNABLE state).
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.current_tasks
|
|
master_item:
|
|
key: 'gcp.cloudsql.mssql.scheduler.raw[{#SCHEDULER.ID}]'
|
|
tags:
|
|
- tag: component
|
|
value: scheduler
|
|
- tag: scheduler
|
|
value: '{#SCHEDULER.ID}'
|
|
- uuid: 6602f8d26a9a46fb8ed74a40d10f36e4
|
|
name: 'GCP Cloud SQL MSSQL: Scheduler [{#SCHEDULER.ID}]: Current workers'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.scheduler.current_workers[{#SCHEDULER.ID}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Current number of workers associated with the scheduler that goes by its ID [{#SCHEDULER.ID}].
|
|
It includes workers that are not assigned any task.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.current_workers
|
|
master_item:
|
|
key: 'gcp.cloudsql.mssql.scheduler.raw[{#SCHEDULER.ID}]'
|
|
tags:
|
|
- tag: component
|
|
value: scheduler
|
|
- tag: scheduler
|
|
value: '{#SCHEDULER.ID}'
|
|
- uuid: 2022a85bb7c04e73a75136e55162084a
|
|
name: 'GCP Cloud SQL MSSQL: Scheduler [{#SCHEDULER.ID}]: Pending I/O operations'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.scheduler.pending_disk_io[{#SCHEDULER.ID}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Current number of pending I/Os waiting to be completed that are associated with the scheduler that goes by its ID [{#SCHEDULER.ID}].
|
|
Each scheduler has a list of pending I/Os that are checked to determine whether they have been completed every time there is a context switch.
|
|
The count is incremented when the request is inserted.
|
|
This count is decremented when the request is completed.
|
|
This number does not indicate the state of the I/Os.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pending_disk_io
|
|
master_item:
|
|
key: 'gcp.cloudsql.mssql.scheduler.raw[{#SCHEDULER.ID}]'
|
|
tags:
|
|
- tag: component
|
|
value: scheduler
|
|
- tag: scheduler
|
|
value: '{#SCHEDULER.ID}'
|
|
- uuid: c3e337845c344f4cb0d14a5e7d22cbb7
|
|
name: 'GCP Cloud SQL MSSQL: Scheduler [{#SCHEDULER.ID}]: Raw data'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.scheduler.raw[{#SCHEDULER.ID}]'
|
|
delay: '0'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
description: 'Data in raw format associated with the scheduler that goes by its ID [{#SCHEDULER.ID}].'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$[?(@.scheduler == "{#SCHEDULER.ID}")].metrics.first()'
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.schedulers.get
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- tag: scheduler
|
|
value: '{#SCHEDULER.ID}'
|
|
- uuid: a9852ac0cdcc423fad6b305eb57eedf1
|
|
name: 'GCP Cloud SQL MSSQL: Scheduler [{#SCHEDULER.ID}]: Runnable tasks'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.scheduler.runnable_tasks[{#SCHEDULER.ID}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Current number of workers that are associated with the scheduler that goes by its ID [{#SCHEDULER.ID}] and have assigned tasks waiting to be scheduled on the runnable queue.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.runnable_tasks
|
|
master_item:
|
|
key: 'gcp.cloudsql.mssql.scheduler.raw[{#SCHEDULER.ID}]'
|
|
tags:
|
|
- tag: component
|
|
value: scheduler
|
|
- tag: scheduler
|
|
value: '{#SCHEDULER.ID}'
|
|
- uuid: eaae59fb97124471b1c7c30c601dba1f
|
|
name: 'GCP Cloud SQL MSSQL: Scheduler [{#SCHEDULER.ID}]: Work queue'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.mssql.scheduler.work_queue[{#SCHEDULER.ID}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Current number of tasks in the pending queue associated with the scheduler that goes by its ID [{#SCHEDULER.ID}].
|
|
These tasks are waiting for a worker to pick them up.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.work_queue
|
|
master_item:
|
|
key: 'gcp.cloudsql.mssql.scheduler.raw[{#SCHEDULER.ID}]'
|
|
tags:
|
|
- tag: component
|
|
value: scheduler
|
|
- tag: scheduler
|
|
value: '{#SCHEDULER.ID}'
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.schedulers.get
|
|
lld_macro_paths:
|
|
- lld_macro: '{#SCHEDULER.ID}'
|
|
path: $.scheduler
|
|
preprocessing:
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 3h
|
|
tags:
|
|
- tag: class
|
|
value: cloud
|
|
- tag: target
|
|
value: cloudsql
|
|
- tag: target
|
|
value: gcp
|
|
- tag: target
|
|
value: google-cloud-platform
|
|
- tag: target
|
|
value: mssql
|
|
macros:
|
|
- macro: '{$CLOUD_SQL.MSSQL.CPU.UTIL.MAX}'
|
|
value: '95'
|
|
description: 'GCP Cloud SQL MSSQL instance CPU usage threshold.'
|
|
- macro: '{$CLOUD_SQL.MSSQL.DB.NAME.MATCHES}'
|
|
value: '.*'
|
|
description: 'The filter to include GCP Cloud SQL MSSQL databases by namespace.'
|
|
- macro: '{$CLOUD_SQL.MSSQL.DB.NAME.NOT_MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'The filter to exclude GCP Cloud SQL MSSQL databases by namespace.'
|
|
- macro: '{$CLOUD_SQL.MSSQL.DISK.UTIL.CRIT}'
|
|
value: '90'
|
|
description: 'GCP Cloud SQL MSSQL instance critical disk usage threshold.'
|
|
- macro: '{$CLOUD_SQL.MSSQL.DISK.UTIL.WARN}'
|
|
value: '80'
|
|
description: 'GCP Cloud SQL MSSQL instance warning disk usage threshold.'
|
|
- macro: '{$CLOUD_SQL.MSSQL.RAM.UTIL.MAX}'
|
|
value: '90'
|
|
description: 'GCP Cloud SQL MSSQL instance RAM usage threshold.'
|
|
- macro: '{$CLOUD_SQL.MSSQL.RES.NAME.MATCHES}'
|
|
value: '.*'
|
|
description: 'The filter to include GCP Cloud SQL MSSQL resources by namespace.'
|
|
- macro: '{$CLOUD_SQL.MSSQL.RES.NAME.NOT_MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'The filter to exclude GCP Cloud SQL MSSQL resources by namespace.'
|
|
- macro: '{$CLOUD_SQL.MSSQL.SCHEDULER.ID.MATCHES}'
|
|
value: '.*'
|
|
description: 'The filter to include GCP Cloud SQL MSSQL schedulers by namespace.'
|
|
- macro: '{$CLOUD_SQL.MSSQL.SCHEDULER.ID.NOT_MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'The filter to exclude GCP Cloud SQL MSSQL schedulers by namespace.'
|
|
- macro: '{$GCP.DATA.TIMEOUT}'
|
|
value: 15s
|
|
description: 'A response timeout for an API.'
|
|
- macro: '{$GCP.TIME.WINDOW}'
|
|
value: 5m
|
|
description: |
|
|
Time interval for the data requests.
|
|
Supported usage type:
|
|
1. The default update interval for most of the items.
|
|
2. The minimal time window for the data requested in the Monitoring Query Language REST API request.
|
|
|
|
dashboards:
|
|
- uuid: 4233430037fc4570b3a5eb3f23ef02e6
|
|
name: 'MSSQL instance'
|
|
pages:
|
|
- name: 'MSSQL instance'
|
|
widgets:
|
|
- type: graph
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.cpu.usage_time
|
|
- type: graph
|
|
x: '12'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.cpu.utilization
|
|
- type: graph
|
|
'y': '5'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
name: 'GCP Cloud SQL MSSQL: Memory usage'
|
|
- type: graph
|
|
x: '12'
|
|
'y': '5'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.memory.utilization
|
|
- type: graph
|
|
'y': '10'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.disk.utilization
|
|
- type: graph
|
|
x: '12'
|
|
'y': '10'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
name: 'GCP Cloud SQL MSSQL: Disk read/write operations'
|
|
- type: graph
|
|
'y': '15'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
name: 'GCP Cloud SQL MSSQL: Network traffic'
|
|
- type: graph
|
|
x: '12'
|
|
'y': '15'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.network.connections
|
|
- type: graph
|
|
'y': '20'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
name: 'GCP Cloud SQL MSSQL: Transactions'
|
|
- type: graph
|
|
x: '12'
|
|
'y': '20'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.memory.buffer_cache_hit_ratio
|
|
- type: graph
|
|
'y': '25'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
name: 'GCP Cloud SQL MSSQL: Memory workflow'
|
|
- type: graph
|
|
x: '12'
|
|
'y': '25'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
name: 'GCP Cloud SQL MSSQL: Memory Read/Writes'
|
|
valuemaps:
|
|
- uuid: d2aa57a09cbb43e8b53b11316193f013
|
|
name: 'Database availability'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Down
|
|
- value: '1'
|
|
newvalue: Up
|
|
- uuid: 1c26d58d111b4689a2e7acd23a38f1ca
|
|
name: 'Instance state'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Running
|
|
- value: '1'
|
|
newvalue: Suspended
|
|
- value: '2'
|
|
newvalue: Runnable
|
|
- value: '3'
|
|
newvalue: 'Pending create'
|
|
- value: '4'
|
|
newvalue: Maintenance
|
|
- value: '5'
|
|
newvalue: Failed
|
|
- value: '6'
|
|
newvalue: 'Unknown state'
|
|
- value: '10'
|
|
newvalue: 'Data retrievement error'
|
|
- uuid: 54f0ffb538d94a9bb8062df3e63c4cb6
|
|
template: 'GCP Cloud SQL MSSQL Replica by HTTP'
|
|
name: 'GCP Cloud SQL MSSQL Replica by HTTP'
|
|
description: |
|
|
Get GCP Cloud SQL MSSQL monitoring for read-only replicas with script item usage to perform HTTP requests to Google Cloud Platform Monitoring API.
|
|
This template will be automatically connected to discovered entities with all their required parameters pre-defined.
|
|
|
|
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" 2.0.0
|
|
vendor:
|
|
name: Zabbix
|
|
version: 7.0-0
|
|
groups:
|
|
- name: Templates/Cloud
|
|
items:
|
|
- uuid: e66fe8bb6f924cb088ec57b215fe21d7
|
|
name: 'GCP Cloud SQL MSSQL: Bytes sent to replica'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.repl.bytes_sent_to_replica_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
Total number of bytes sent to the remote availability replica.
|
|
For an async replica, returns the number of bytes before compression.
|
|
For a sync replica without compression, returns the actual number of bytes.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.bytes_sent_to_replica_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 4100432768354e1ca7349a901bccbe85
|
|
name: 'GCP Cloud SQL MSSQL: Log apply pending queue'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.repl.log_apply_pending_queue
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Current number of log blocks that are waiting to be applied to replica.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.log_apply_pending_queue
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: d060637548af434e926ed833083d9fa0
|
|
name: 'GCP Cloud SQL MSSQL: Log bytes received'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.repl.log_bytes_received_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Total size of log records received by the replica.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.log_bytes_received_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: f0d4c711863f4ca9ad76b0099a66a86d
|
|
name: 'GCP Cloud SQL MSSQL: Replica metrics get'
|
|
type: SCRIPT
|
|
key: gcp.cloudsql.mssql.repl.metrics.get
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'cloudsql.googleapis.com/database/sqlserver/replication/',
|
|
obj = {},
|
|
base_paths = [
|
|
'bytes_sent_to_replica_count | map ignore [replica_name]',
|
|
'resent_message_count | map ignore [replica_name]',
|
|
'log_apply_pending_queue',
|
|
'log_bytes_received_count',
|
|
'recovery_queue',
|
|
'redone_bytes_count'
|
|
];
|
|
|
|
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 checkParams(params) {
|
|
['project_id', 'time_window', 'database_id', 'token'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
function getHttpData(url, token, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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 params = checkParams(JSON.parse(value)),
|
|
time_window = params.time_window,
|
|
project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter database_id = '" + params.database_id + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query';
|
|
|
|
var base_raw = getHttpData(url, params.token, { query: '{' + base_paths.map(function (path) { return base_path + path; }).join(';') + '}' + j_filter }),
|
|
keys = getField(base_raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
values = getField(base_raw, 'timeSeriesData.0.pointData.0.values'),
|
|
re = /(^t_\d+\.value\.)/g;
|
|
|
|
for (i in keys) {
|
|
var value_types = ['int64Value', 'doubleValue', 'stringValue', 'boolValue'];
|
|
|
|
for (v in value_types) {
|
|
if (typeof values[i][value_types[v]] !== 'undefined') {
|
|
obj[getField(keys[i], 'key').replace(re, '')] = values[i][value_types[v]];
|
|
}
|
|
}
|
|
}
|
|
|
|
return JSON.stringify(obj);
|
|
description: 'MSSQL replica metrics data in raw format.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: database_id
|
|
value: '{$GCP.PROJECT.ID}:{HOST.NAME}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: 4ec364fea7894df29813b65c2d170367
|
|
name: 'GCP Cloud SQL MSSQL: Recovery queue'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.repl.recovery_queue
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Current size of log records in bytes in the replica''s log files that have not been redone.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.recovery_queue
|
|
- type: MULTIPLIER
|
|
parameters:
|
|
- '1024'
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 37c145777926471482ecffd1b6cca792
|
|
name: 'GCP Cloud SQL MSSQL: Redone bytes'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.repl.redone_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Total size in bytes of redone log records.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.redone_bytes_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 23911902d27e4fa68435935aeeec28e1
|
|
name: 'GCP Cloud SQL MSSQL: Resent messages'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mssql.repl.resent_message_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Total count of Always On messages to resend.
|
|
This includes messages that were attempted to be sent but failed and require resending.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.resent_message_count
|
|
master_item:
|
|
key: gcp.cloudsql.mssql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
tags:
|
|
- tag: class
|
|
value: cloud
|
|
- tag: target
|
|
value: cloudsql
|
|
- tag: target
|
|
value: gcp
|
|
- tag: target
|
|
value: google-cloud-platform
|
|
- tag: target
|
|
value: mssql
|
|
- tag: target
|
|
value: replica
|
|
macros:
|
|
- macro: '{$GCP.DATA.TIMEOUT}'
|
|
value: 15s
|
|
description: 'A response timeout for an API.'
|
|
- macro: '{$GCP.TIME.WINDOW}'
|
|
value: 5m
|
|
description: |
|
|
Time interval for the data requests.
|
|
Supported usage type:
|
|
1. The default update interval for most of the items.
|
|
2. The minimal time window for the data requested in the Monitoring Query Language REST API request.
|
|
|
|
dashboards:
|
|
- uuid: f50d9889ca3c4f6b91dd9e40902e37fb
|
|
name: 'MSSQL replica'
|
|
pages:
|
|
- name: 'MSSQL replica'
|
|
widgets:
|
|
- type: graph
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL Replica by HTTP'
|
|
name: 'GCP Cloud SQL MSSQL: Replication data'
|
|
- type: graph
|
|
x: '12'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MSSQL Replica by HTTP'
|
|
key: gcp.cloudsql.mssql.repl.log_apply_pending_queue
|
|
- uuid: 38456af4aedd4b168ec3fa4ad2acb256
|
|
template: 'GCP Cloud SQL MySQL by HTTP'
|
|
name: 'GCP Cloud SQL MySQL by HTTP'
|
|
description: |
|
|
Get GCP Cloud SQL MySQL instances monitoring with script item usage to perform HTTP requests to Google Cloud Platform Monitoring API.
|
|
This template will be automatically connected to discovered entities with all their required parameters pre-defined.
|
|
|
|
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" 2.0.0
|
|
vendor:
|
|
name: Zabbix
|
|
version: 7.0-0
|
|
groups:
|
|
- name: Templates/Cloud
|
|
items:
|
|
- uuid: 83e36c61e8ce4d06a395ea7b06c5877b
|
|
name: 'GCP Cloud SQL MySQL: Reserved CPU cores'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.cpu.reserved_cores
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
description: 'Number of cores reserved for the database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_reserved_cores
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
- uuid: a39ba253dbf24110af48fd49572976fd
|
|
name: 'GCP Cloud SQL MySQL: CPU usage time'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.cpu.usage_time
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: s
|
|
description: 'Cumulative CPU usage time in seconds.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_usage_time
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
- uuid: df7469e3c76c4286846c27003c9785cc
|
|
name: 'GCP Cloud SQL MySQL: CPU utilization'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.cpu.utilization
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: 'Current CPU utilization represented as a percentage of the reserved CPU that is currently in use.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_utilization
|
|
- type: MULTIPLIER
|
|
parameters:
|
|
- '100'
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
triggers:
|
|
- uuid: 5bf54c01665549c8a05f49db34c86191
|
|
expression: 'min(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.cpu.utilization,5m) >= {$CLOUD_SQL.MYSQL.CPU.UTIL.MAX}'
|
|
name: 'GCP Cloud SQL MySQL: High CPU utilization'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: AVERAGE
|
|
description: 'The CPU utilization is too high. The system might be slow to respond.'
|
|
tags:
|
|
- tag: scope
|
|
value: performance
|
|
- uuid: 948dac37023c4efcaf5f830ba5d4fafe
|
|
name: 'GCP Cloud SQL MySQL: DB engine state'
|
|
type: HTTP_AGENT
|
|
key: gcp.cloudsql.mysql.db.state
|
|
history: 7d
|
|
description: 'GCP Cloud SQL MySQL DB Engine State.'
|
|
valuemap:
|
|
name: 'Database availability'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.timeSeriesData[0].pointData[0].values[0].int64Value'
|
|
error_handler: DISCARD_VALUE
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 10m
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
url: 'https://monitoring.googleapis.com/v3/projects/{$GCP.PROJECT.ID}/timeSeries:query'
|
|
posts: '{"query":"cloudsql.googleapis.com/database/up | within 5m | filter database_id = ''{$GCP.PROJECT.ID}:{HOST.NAME}''"}'
|
|
status_codes: ''
|
|
headers:
|
|
- name: Content-Type
|
|
value: application/json
|
|
- name: Authorization
|
|
value: 'Bearer {$GCP.AUTH.TOKEN}'
|
|
request_method: POST
|
|
tags:
|
|
- tag: component
|
|
value: status
|
|
triggers:
|
|
- uuid: a3eff8c422f5427e9b1c6abb9854f73c
|
|
expression: |
|
|
last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.db.state)=0
|
|
|
|
name: 'GCP Cloud SQL MySQL: Database engine is down'
|
|
priority: AVERAGE
|
|
description: |
|
|
Database engine is down.
|
|
If an instance experiences unplanned (non-maintenance) downtime, the instance state will still be RUNNING, but the database engine state metric will report 0.
|
|
|
|
dependencies:
|
|
- name: 'GCP Cloud SQL MySQL: Failed to get the instance state'
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 10'
|
|
- name: 'GCP Cloud SQL MySQL: Instance is in failed state'
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 5'
|
|
- name: 'GCP Cloud SQL MySQL: Instance is in maintenance'
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 4'
|
|
- name: 'GCP Cloud SQL MySQL: Instance is in suspended state'
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 1'
|
|
- name: 'GCP Cloud SQL MySQL: Instance is in unknown state'
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 6'
|
|
- name: 'GCP Cloud SQL MySQL: Instance is stopped by the owner'
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 2'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 76c37760145d43f3927f1a9548dea8a5
|
|
name: 'GCP Cloud SQL MySQL: Disk bytes used'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.disk.bytes_used
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Data utilization in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_bytes_used
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: 464fecbbedd64e988739c93736d2b824
|
|
name: 'GCP Cloud SQL MySQL: Disk size'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.disk.quota
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Maximum data disk size in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_quota
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: d426d282d2ee43fe9c9b64dcb6d0c4c9
|
|
name: 'GCP Cloud SQL MySQL: Disk read I/O'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.disk.read_ops_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of data disk read I/O operations.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_read_ops_count
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: b2274d47be5041b493b00fd55172c0e9
|
|
name: 'GCP Cloud SQL MySQL: Disk utilization'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.disk.utilization
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: |
|
|
The fraction of the disk quota that is currently in use.
|
|
Shown as percentage.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_utilization
|
|
- type: MULTIPLIER
|
|
parameters:
|
|
- '100'
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
triggers:
|
|
- uuid: d5ade16fb0494ca6af61100a2e643702
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.disk.utilization) >= {$CLOUD_SQL.MYSQL.DISK.UTIL.CRIT}'
|
|
name: 'GCP Cloud SQL MySQL: Disk space is critically low'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: AVERAGE
|
|
description: 'Critical utilization of the disk space.'
|
|
tags:
|
|
- tag: scope
|
|
value: capacity
|
|
- uuid: 3b5c84fee47f4376b19d0738b261c01b
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.disk.utilization) >= {$CLOUD_SQL.MYSQL.DISK.UTIL.WARN}'
|
|
name: 'GCP Cloud SQL MySQL: Disk space is low'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: WARNING
|
|
description: 'High utilization of the storage space.'
|
|
dependencies:
|
|
- name: 'GCP Cloud SQL MySQL: Disk space is critically low'
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.disk.utilization) >= {$CLOUD_SQL.MYSQL.DISK.UTIL.CRIT}'
|
|
tags:
|
|
- tag: scope
|
|
value: capacity
|
|
- uuid: 7a44187c6a404defb0dc83fa22f89d96
|
|
name: 'GCP Cloud SQL MySQL: Disk write I/O'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.disk.write_ops_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of data disk write I/O operations.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_write_ops_count
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: 5e5b9cdfa7f2455b881cceface136e65
|
|
name: 'GCP Cloud SQL MySQL: InnoDB dirty pages'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.innodb_buffer_pool_pages_dirty
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of unflushed pages in the InnoDB buffer pool.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_innodb_buffer_pool_pages_dirty
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: innodb
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 75835c8326e6461d8f25fb7d55271f16
|
|
name: 'GCP Cloud SQL MySQL: InnoDB free pages'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.innodb_buffer_pool_pages_free
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of unused pages in the InnoDB buffer pool.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_innodb_buffer_pool_pages_free
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: innodb
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 080d5304c0e346808bd70b125a27be4b
|
|
name: 'GCP Cloud SQL MySQL: InnoDB total pages'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.innodb_buffer_pool_pages_total
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of pages in the InnoDB buffer pool.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_innodb_buffer_pool_pages_total
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: innodb
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 19e259f61fc24e29a189c35121878eb3
|
|
name: 'GCP Cloud SQL MySQL: InnoDB fsync calls'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.innodb_data_fsyncs
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of InnoDB fsync() calls.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_innodb_data_fsyncs
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: innodb
|
|
- tag: component
|
|
value: storage
|
|
- uuid: c4a4ffa274974041bccbd25643ff9f70
|
|
name: 'GCP Cloud SQL MySQL: InnoDB log fsync calls'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.innodb_os_log_fsyncs
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of InnoDB fsync() calls to the log file.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_innodb_os_log_fsyncs
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: innodb
|
|
- tag: component
|
|
value: storage
|
|
- uuid: 4a9154e235e84c0d9dbf0abf44479f49
|
|
name: 'GCP Cloud SQL MySQL: InnoDB pages read'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.innodb_pages_read
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of InnoDB pages read.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_innodb_pages_read
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: innodb
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 584714b219034bbebbc24edad36704c9
|
|
name: 'GCP Cloud SQL MySQL: InnoDB pages written'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.innodb_pages_written
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of InnoDB pages written.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_innodb_pages_written
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: innodb
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 71559008ad444772b0b1212f715980ed
|
|
name: 'GCP Cloud SQL MySQL: Instance state'
|
|
type: HTTP_AGENT
|
|
key: gcp.cloudsql.mysql.inst.state
|
|
history: 7d
|
|
description: 'GCP Cloud SQL MySQL Current instance state.'
|
|
valuemap:
|
|
name: 'Instance state'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.timeSeriesData[0].pointData[0].values[0].stringValue'
|
|
error_handler: CUSTOM_VALUE
|
|
error_handler_params: '10'
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const idx = [
|
|
'RUNNING',
|
|
'SUSPENDED',
|
|
'RUNNABLE',
|
|
'PENDING_CREATE',
|
|
'MAINTENANCE',
|
|
'FAILED',
|
|
'UNKNOWN_STATE'
|
|
].indexOf(value);
|
|
return idx !== -1 ? idx : 10;
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 10m
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
url: 'https://monitoring.googleapis.com/v3/projects/{$GCP.PROJECT.ID}/timeSeries:query'
|
|
posts: '{"query":"cloudsql.googleapis.com/database/state | within 5m | filter database_id = ''{$GCP.PROJECT.ID}:{HOST.NAME}''"}'
|
|
status_codes: ''
|
|
headers:
|
|
- name: Content-Type
|
|
value: application/json
|
|
- name: Authorization
|
|
value: 'Bearer {$GCP.AUTH.TOKEN}'
|
|
request_method: POST
|
|
tags:
|
|
- tag: component
|
|
value: status
|
|
triggers:
|
|
- uuid: 3b3adc89e0bb45a79a824121f49d2d02
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 10'
|
|
name: 'GCP Cloud SQL MySQL: Failed to get the instance state'
|
|
priority: AVERAGE
|
|
description: |
|
|
Failed to get the instance state.
|
|
Check access permissions to GCP API or service account.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 65831fed3d19425c86933db4034ed565
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 5'
|
|
name: 'GCP Cloud SQL MySQL: Instance is in failed state'
|
|
priority: AVERAGE
|
|
description: |
|
|
The instance creation failed, or an operation left the instance in an own bad state.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: fae15d1ab46c418ebfdfdd73fb698b51
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 4'
|
|
name: 'GCP Cloud SQL MySQL: Instance is in maintenance'
|
|
priority: INFO
|
|
description: 'The instance is down for maintenance.'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 347215d307c8465cad41198f12b5ff68
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 1'
|
|
name: 'GCP Cloud SQL MySQL: Instance is in suspended state'
|
|
priority: WARNING
|
|
description: |
|
|
The instance is in suspended state.
|
|
It is not available, for example, due to problems with billing.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 1387f9a2ef194d5bb5d1e548fc4eb8d3
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 6'
|
|
name: 'GCP Cloud SQL MySQL: Instance is in unknown state'
|
|
priority: AVERAGE
|
|
description: |
|
|
The state of the instance is unknown.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 9c66317433a24be985559fdb11907c70
|
|
expression: 'last(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.inst.state) = 2'
|
|
name: 'GCP Cloud SQL MySQL: Instance is stopped by the owner'
|
|
priority: INFO
|
|
description: |
|
|
The instance has been stopped by the owner.
|
|
It is not currently running, but it's ready to be restarted.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: cc09f5591b0242b3b99199b267a1c527
|
|
name: 'GCP Cloud SQL MySQL: Memory size'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.memory.quota
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Maximum RAM size in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_quota
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 13868b9408c9489296531bf1fd927084
|
|
name: 'GCP Cloud SQL MySQL: Memory used by DB engine'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.memory.total_usage
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
Total RAM usage in bytes.
|
|
This metric reports the RAM usage of the database process, including the buffer/cache.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_total_usage
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 995d07fc814f4d12a9c9bdc6bb52481d
|
|
name: 'GCP Cloud SQL MySQL: Memory usage'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.memory.usage
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
The RAM usage in bytes.
|
|
This metric reports the RAM usage of the server, excluding the buffer/cache.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_usage
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: efe4357a63ec43f799b2303a952c1378
|
|
name: 'GCP Cloud SQL MySQL: Memory utilization'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.memory.utilization
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: |
|
|
The fraction of the memory quota that is currently in use.
|
|
Shown as percentage.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_ram_pused
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
triggers:
|
|
- uuid: 82e3af43d3104b4ba641e0be56d11662
|
|
expression: 'min(/GCP Cloud SQL MySQL by HTTP/gcp.cloudsql.mysql.memory.utilization,5m) >= {$CLOUD_SQL.MYSQL.RAM.UTIL.MAX}'
|
|
name: 'GCP Cloud SQL MySQL: High memory utilization'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: HIGH
|
|
description: 'RAM utilization is too high. The system might be slow to respond.'
|
|
tags:
|
|
- tag: scope
|
|
value: performance
|
|
- uuid: 682484eaf1db4a239c69566a5cd492e2
|
|
name: 'GCP Cloud SQL MySQL: Metrics get'
|
|
type: SCRIPT
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'cloudsql.googleapis.com/database/',
|
|
mysql_path = 'cloudsql.googleapis.com/database/mysql/',
|
|
obj = {},
|
|
base_paths = [
|
|
'cpu/reserved_cores',
|
|
'cpu/usage_time',
|
|
'cpu/utilization',
|
|
'disk/read_ops_count',
|
|
'disk/write_ops_count',
|
|
'memory/quota',
|
|
'memory/total_usage',
|
|
'memory/usage',
|
|
'network/connections',
|
|
'network/received_bytes_count',
|
|
'network/sent_bytes_count | map ignore [destination]'
|
|
].map(function (path) { return base_path + path; }),
|
|
mysql_paths = [
|
|
'innodb_buffer_pool_pages_dirty',
|
|
'innodb_buffer_pool_pages_free',
|
|
'innodb_buffer_pool_pages_total',
|
|
'innodb_data_fsyncs',
|
|
'innodb_os_log_fsyncs',
|
|
'innodb_pages_read',
|
|
'innodb_pages_written',
|
|
'queries',
|
|
'questions',
|
|
'received_bytes_count',
|
|
'sent_bytes_count',
|
|
'open_tables',
|
|
'open_table_definitions'
|
|
].map(function (path) { return mysql_path + path; }).concat(
|
|
['disk/bytes_used', 'disk/utilization', 'disk/quota'].map(function (path) { return base_path + path; }));
|
|
|
|
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 checkParams(params) {
|
|
['project_id', 'time_window', 'database_id', 'token'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
function getHttpData(url, token, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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;
|
|
};
|
|
|
|
function rawMap(raw, prefix) {
|
|
var keys = getField(raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
values = getField(raw, 'timeSeriesData.0.pointData.0.values'),
|
|
re = /(^t_\d+\.value\.)/g;
|
|
|
|
for (i in keys) {
|
|
var key = getField(keys[i], 'key').replace(re, ''),
|
|
value_types = ['int64Value', 'doubleValue', 'stringValue', 'boolValue'];
|
|
|
|
for (v in value_types) {
|
|
if (typeof values[i][value_types[v]] !== 'undefined') {
|
|
if (prefix) {
|
|
obj[prefix + key] = values[i][value_types[v]];
|
|
}
|
|
else {
|
|
obj[key] = values[i][value_types[v]];
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
var params = checkParams(JSON.parse(value)),
|
|
time_window = params.time_window,
|
|
project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter database_id = '" + params.database_id + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query',
|
|
queries = [
|
|
{ name: 'base_', data: { query: '{' + base_paths.join(';') + '}' + j_filter } },
|
|
{ name: 'mysql_', data: { query: '{' + mysql_paths.join(';') + '}' + j_filter } }
|
|
];
|
|
|
|
for (q in queries) {
|
|
raw = getHttpData(url, params.token, queries[q].data);
|
|
obj = Object.assign(obj, rawMap(raw, queries[q].name));
|
|
}
|
|
|
|
obj.base_ram_pused = Math.floor(getField(obj, 'base_usage') / getField(obj, 'base_quota') * 100);
|
|
|
|
return JSON.stringify(obj);
|
|
description: 'MySQL metrics in raw format.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: database_id
|
|
value: '{$GCP.PROJECT.ID}:{HOST.NAME}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: 9ddae405a9b343759d03b5b29c469d18
|
|
name: 'GCP Cloud SQL MySQL: Connections'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.network.connections
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of connections to the databases on the Cloud SQL instance.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_connections
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- tag: component
|
|
value: network
|
|
- uuid: d970d8e209df4b2a810c2e59f39fa429
|
|
name: 'GCP Cloud SQL MySQL: Network: Received bytes'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.network.received_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Delta count of bytes received through the network.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_received_bytes_count
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 977e4e22ebfc4a19a228a8935d9a342c
|
|
name: 'GCP Cloud SQL MySQL: Network: Sent bytes'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.network.sent_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Delta count of bytes sent through the network.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_sent_bytes_count
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 1d651976f70944acb31cd0430e70d422
|
|
name: 'GCP Cloud SQL MySQL: Open tables'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.open_tables
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'The number of tables that are currently open.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_open_tables
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: tables
|
|
- uuid: 1606766c63bf4aa1ade24a34650eef05
|
|
name: 'GCP Cloud SQL MySQL: Open table definitions'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.open_table_definitions
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'The number of table definitions that are currently cached.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_open_table_definitions
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: tables
|
|
- uuid: 3d3ec2e37bf94fb68c40967b56dfd95c
|
|
name: 'GCP Cloud SQL MySQL: Network: Bytes received by MySQL'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql_received_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Delta count of bytes received by MySQL process.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_received_bytes_count
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: f926beb31be44dc0bfb30c571fac280a
|
|
name: 'GCP Cloud SQL MySQL: Network: Bytes sent by MySQL'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql_sent_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Delta count of bytes sent by MySQL process.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_sent_bytes_count
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: bbdeb595ab1b44d7a332fbf0c2637403
|
|
name: 'GCP Cloud SQL MySQL: Queries'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.queries
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta of statements executed by the server.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_queries
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: queries
|
|
- uuid: 114fb26dcdc1441c84c150c7809b3400
|
|
name: 'GCP Cloud SQL MySQL: Questions'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.questions
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta of statements executed by the server sent by the client.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mysql_questions
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: queries
|
|
tags:
|
|
- tag: class
|
|
value: cloud
|
|
- tag: target
|
|
value: cloudsql
|
|
- tag: target
|
|
value: gcp
|
|
- tag: target
|
|
value: google-cloud-platform
|
|
- tag: target
|
|
value: mysql
|
|
macros:
|
|
- macro: '{$CLOUD_SQL.MYSQL.CPU.UTIL.MAX}'
|
|
value: '95'
|
|
description: 'GCP Cloud SQL MySQL instance CPU usage threshold.'
|
|
- macro: '{$CLOUD_SQL.MYSQL.DISK.UTIL.CRIT}'
|
|
value: '90'
|
|
description: 'GCP Cloud SQL MySQL instance critical disk usage threshold.'
|
|
- macro: '{$CLOUD_SQL.MYSQL.DISK.UTIL.WARN}'
|
|
value: '80'
|
|
description: 'GCP Cloud SQL MySQL instance warning disk usage threshold.'
|
|
- macro: '{$CLOUD_SQL.MYSQL.RAM.UTIL.MAX}'
|
|
value: '90'
|
|
description: 'GCP Cloud SQL MySQL instance RAM usage threshold.'
|
|
- macro: '{$GCP.DATA.TIMEOUT}'
|
|
value: 15s
|
|
description: 'A response timeout for an API.'
|
|
- macro: '{$GCP.TIME.WINDOW}'
|
|
value: 5m
|
|
description: |
|
|
Time interval for the data requests.
|
|
Supported usage type:
|
|
1. The default update interval for most of the items.
|
|
2. The minimal time window for the data requested in the Monitoring Query Language REST API request.
|
|
|
|
dashboards:
|
|
- uuid: 5932cc56f6f146db8fac121b3817a407
|
|
name: 'MySQL instance'
|
|
pages:
|
|
- name: 'MySQL instance'
|
|
widgets:
|
|
- type: graph
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.cpu.usage_time
|
|
- type: graph
|
|
x: '12'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.cpu.utilization
|
|
- type: graph
|
|
'y': '5'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
name: 'GCP Cloud SQL MySQL: Memory usage'
|
|
- type: graph
|
|
x: '12'
|
|
'y': '5'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.memory.utilization
|
|
- type: graph
|
|
'y': '10'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.disk.utilization
|
|
- type: graph
|
|
x: '12'
|
|
'y': '10'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
name: 'GCP Cloud SQL MySQL: Disk read/write operations'
|
|
- type: graph
|
|
'y': '15'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
name: 'GCP Cloud SQL MySQL: Network traffic'
|
|
- type: graph
|
|
x: '12'
|
|
'y': '15'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.network.connections
|
|
- type: graph
|
|
'y': '20'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
name: 'GCP Cloud SQL MySQL: pages'
|
|
- type: graph
|
|
x: '12'
|
|
'y': '20'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
name: 'GCP Cloud SQL MySQL: Queries'
|
|
valuemaps:
|
|
- uuid: 8aa36f0f6a0b42a3b5e0eabfb700e8db
|
|
name: 'Database availability'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Down
|
|
- value: '1'
|
|
newvalue: Up
|
|
- uuid: 9adad9dad34646d79bcc6c414ddf8afe
|
|
name: 'Instance state'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Running
|
|
- value: '1'
|
|
newvalue: Suspended
|
|
- value: '2'
|
|
newvalue: Runnable
|
|
- value: '3'
|
|
newvalue: 'Pending create'
|
|
- value: '4'
|
|
newvalue: Maintenance
|
|
- value: '5'
|
|
newvalue: Failed
|
|
- value: '6'
|
|
newvalue: 'Unknown state'
|
|
- value: '10'
|
|
newvalue: 'Data retrievement error'
|
|
- uuid: 9d7871c093f9489293421396b9fea668
|
|
template: 'GCP Cloud SQL MySQL Replica by HTTP'
|
|
name: 'GCP Cloud SQL MySQL Replica by HTTP'
|
|
description: |
|
|
Get GCP Cloud SQL MySQL monitoring for read-only replicas with script item usage to perform HTTP requests to Google Cloud Platform Monitoring API.
|
|
This template will be automatically connected to discovered entities with all their required parameters pre-defined.
|
|
|
|
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" 2.0.0
|
|
vendor:
|
|
name: Zabbix
|
|
version: 7.0-0
|
|
groups:
|
|
- name: Templates/Cloud
|
|
items:
|
|
- uuid: 17aa9eb4749e46be9b0b0f93ef011fca
|
|
name: 'GCP Cloud SQL MySQL: Last I/O thread error number'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.repl.last_io_errno
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'The error number of the most recent error that caused the I/O thread to stop.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.last_io_errno
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 52c11965a2fc4d37a97ebccc04ee7b80
|
|
name: 'GCP Cloud SQL MySQL: Last SQL thread error number'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.repl.last_sql_errno
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'The error number of the most recent error that caused the SQL thread to stop.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.last_sql_errno
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 470200d2cca348bb8a670a2be3a270e3
|
|
name: 'GCP Cloud SQL MySQL: Replica metrics get'
|
|
type: SCRIPT
|
|
key: gcp.cloudsql.mysql.repl.metrics.get
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'cloudsql.googleapis.com/database/replication/',
|
|
mysql_path = 'cloudsql.googleapis.com/database/mysql/replication/',
|
|
raw_metrics,
|
|
obj = {},
|
|
base_paths = ['network_lag', 'replica_lag'].map(function (path) { return base_path + path; }),
|
|
mysql_paths = [
|
|
'last_io_errno',
|
|
'last_sql_errno',
|
|
'slave_io_running',
|
|
'slave_sql_running'].map(function (path) { return mysql_path + path; }).concat(
|
|
['network_lag', 'replica_lag'].map(function (path) { return base_path + path; }));
|
|
|
|
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 checkParams(params) {
|
|
['project_id', 'time_window', 'database_id', 'token'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
function getHttpData(url, token, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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 params = checkParams(JSON.parse(value)),
|
|
time_window = params.time_window,
|
|
project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter database_id = '" + params.database_id + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query';
|
|
|
|
var metric_raw = getHttpData(url, params.token, { query: '{' + mysql_paths.join(';') + '}' + j_filter });
|
|
|
|
var metric_keys = getField(metric_raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
metric_values = getField(metric_raw, 'timeSeriesData.0.pointData.0.values'),
|
|
re = /(^t_\d+\.value\.)/g;
|
|
|
|
for (i in metric_keys) {
|
|
var value_types = ['int64Value', 'doubleValue', 'stringValue', 'boolValue'];
|
|
|
|
for (v in value_types) {
|
|
if (typeof metric_values[i][value_types[v]] !== 'undefined') {
|
|
obj[getField(metric_keys[i], 'key').replace(re, "")] = metric_values[i][value_types[v]];
|
|
}
|
|
}
|
|
}
|
|
|
|
var state_raw = getHttpData(url, params.token, { query: base_path + 'state' + filter }),
|
|
state_keys = getField(state_raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
state_tsd = getField(state_raw, 'timeSeriesData');
|
|
|
|
for (i in state_keys) {
|
|
var state_key = getField(state_keys[i], 'key').replace(/value\./g, '');
|
|
|
|
obj[state_key] = 'undefined';
|
|
for (t in state_tsd) {
|
|
if (getField(state_tsd[t], 'pointData.0.values.' + i + '.boolValue') == true) {
|
|
obj[state_key] = getField(state_tsd[t], 'labelValues.3.stringValue');
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
return JSON.stringify(obj);
|
|
description: 'MySQL replication metrics data in raw format.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: database_id
|
|
value: '{$GCP.PROJECT.ID}:{HOST.NAME}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: e84ac3a2537848b29024659ab5e3a0e9
|
|
name: 'GCP Cloud SQL MySQL: Network lag'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.repl.network_lag
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: s
|
|
description: 'Indicates time taken from primary binary log to IO thread on replica.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.network_lag
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: b5f9960de9414975ac48357844a15860
|
|
name: 'GCP Cloud SQL MySQL: Replication lag'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.repl.replica_lag
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: s
|
|
description: 'Number of seconds the read replica is behind its primary (approximation).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.replica_lag
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 0c093a0416f24afb96fc28a7abb283d4
|
|
name: 'GCP Cloud SQL MySQL: Slave I/O thread running'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.repl.slave_io_running
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Indicates whether the I/O thread for reading the primary's binary log is running.
|
|
Possible values are Yes, No and Connecting.
|
|
|
|
valuemap:
|
|
name: 'Thread state'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.slave_io_running
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const idx = [
|
|
'No',
|
|
'Yes',
|
|
'Connecting',
|
|
].indexOf(value);
|
|
return idx !== -1 ? idx : 10;
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 994d92340dd146a381f2e6bbebd1c3f2
|
|
name: 'GCP Cloud SQL MySQL: Slave SQL thread running'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.repl.slave_sql_running
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Indicates whether the SQL thread for executing events in the relay log is running.'
|
|
valuemap:
|
|
name: 'Thread state'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.slave_sql_running
|
|
- type: BOOL_TO_DECIMAL
|
|
parameters:
|
|
- ''
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 90a9154072164b5c89d715fa77e7e2b0
|
|
name: 'GCP Cloud SQL MySQL: Replication state'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.mysql.repl.state
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
The current serving state of replication.
|
|
This metric is only available for the MySQL/PostgreSQL instances.
|
|
|
|
valuemap:
|
|
name: 'Replication state'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.state
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const idx = [
|
|
'Running',
|
|
'Syncing',
|
|
'Unsynced',
|
|
'Stopped',
|
|
'Error',
|
|
].indexOf(value);
|
|
return idx !== -1 ? idx : 10;
|
|
master_item:
|
|
key: gcp.cloudsql.mysql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- tag: component
|
|
value: status
|
|
tags:
|
|
- tag: class
|
|
value: cloud
|
|
- tag: target
|
|
value: cloudsql
|
|
- tag: target
|
|
value: gcp
|
|
- tag: target
|
|
value: google-cloud-platform
|
|
- tag: target
|
|
value: mysql
|
|
- tag: target
|
|
value: replica
|
|
macros:
|
|
- macro: '{$GCP.DATA.TIMEOUT}'
|
|
value: 15s
|
|
description: 'A response timeout for an API.'
|
|
- macro: '{$GCP.TIME.WINDOW}'
|
|
value: 5m
|
|
description: |
|
|
Time interval for the data requests.
|
|
Supported usage type:
|
|
1. The default update interval for most of the items.
|
|
2. The minimal time window for the data requested in the Monitoring Query Language REST API request.
|
|
|
|
dashboards:
|
|
- uuid: 76eda12212f045388bef22cb382eff6b
|
|
name: 'MySQL replica'
|
|
pages:
|
|
- name: 'MySQL replica'
|
|
widgets:
|
|
- type: graph
|
|
width: '24'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL Replica by HTTP'
|
|
name: 'GCP Cloud SQL MySQL: Lags'
|
|
- type: item
|
|
name: 'I/O Thread Error'
|
|
x: '6'
|
|
'y': '5'
|
|
width: '6'
|
|
height: '3'
|
|
fields:
|
|
- type: INTEGER
|
|
name: show
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: adv_conf
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: decimal_size
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL Replica by HTTP'
|
|
key: gcp.cloudsql.mysql.repl.last_io_errno
|
|
- type: item
|
|
name: 'I/O Thread State'
|
|
'y': '5'
|
|
width: '6'
|
|
height: '3'
|
|
fields:
|
|
- type: INTEGER
|
|
name: show
|
|
value: '2'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL Replica by HTTP'
|
|
key: gcp.cloudsql.mysql.repl.slave_io_running
|
|
- type: item
|
|
name: 'SQL Thread Error'
|
|
x: '18'
|
|
'y': '5'
|
|
width: '6'
|
|
height: '3'
|
|
fields:
|
|
- type: INTEGER
|
|
name: show
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: adv_conf
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: decimal_size
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL Replica by HTTP'
|
|
key: gcp.cloudsql.mysql.repl.last_sql_errno
|
|
- type: item
|
|
name: 'SQL Thread State'
|
|
x: '12'
|
|
'y': '5'
|
|
width: '6'
|
|
height: '3'
|
|
fields:
|
|
- type: INTEGER
|
|
name: show
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: adv_conf
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: decimal_size
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL MySQL Replica by HTTP'
|
|
key: gcp.cloudsql.mysql.repl.slave_sql_running
|
|
valuemaps:
|
|
- uuid: ea83090a16d94eb3bb643009c784d820
|
|
name: 'Replication state'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Running
|
|
- value: '1'
|
|
newvalue: Syncing
|
|
- value: '2'
|
|
newvalue: Unsynced
|
|
- value: '3'
|
|
newvalue: Stopped
|
|
- value: '4'
|
|
newvalue: Error
|
|
- value: '10'
|
|
newvalue: Unknown
|
|
- uuid: b1acfa66a401499cae56777db6c7750b
|
|
name: 'Thread state'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: 'No'
|
|
- value: '1'
|
|
newvalue: 'Yes'
|
|
- value: '2'
|
|
newvalue: Connecting
|
|
- value: '10'
|
|
newvalue: Unknown
|
|
- uuid: e74c1e12f82e4d9880a368b53f5e65a4
|
|
template: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
name: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
description: |
|
|
Get GCP Cloud SQL PostgreSQL instances monitoring with script item usage to perform HTTP requests to Google Cloud Platform Monitoring API.
|
|
This template will be automatically connected to discovered entities with all their required parameters pre-defined.
|
|
|
|
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" 2.0.0
|
|
vendor:
|
|
name: Zabbix
|
|
version: 7.0-0
|
|
groups:
|
|
- name: Templates/Cloud
|
|
items:
|
|
- uuid: 396a555958514890af339f4504a96cc6
|
|
name: 'GCP Cloud SQL PostgreSQL: Reserved CPU cores'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.cpu.reserved_cores
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
description: 'Number of cores reserved for the database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_reserved_cores
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
- uuid: aa2e6d9118ed4b198ed9a28932ea8539
|
|
name: 'GCP Cloud SQL PostgreSQL: CPU usage time'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.cpu.usage_time
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: s
|
|
description: 'Cumulative CPU usage time in seconds.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_usage_time
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
- uuid: cb7cd1b74e4944d88334f22d25b985fa
|
|
name: 'GCP Cloud SQL PostgreSQL: CPU utilization'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.cpu.utilization
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: 'Current CPU utilization represented as a percentage of the reserved CPU that is currently in use.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_utilization
|
|
- type: MULTIPLIER
|
|
parameters:
|
|
- '100'
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
triggers:
|
|
- uuid: 3ca3942121bd41029645a19fd3947416
|
|
expression: 'min(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.cpu.utilization,5m) >= {$CLOUD_SQL.PGSQL.CPU.UTIL.MAX}'
|
|
name: 'GCP Cloud SQL PostgreSQL: High CPU utilization'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: AVERAGE
|
|
description: 'The CPU utilization is too high. The system might be slow to respond.'
|
|
tags:
|
|
- tag: scope
|
|
value: performance
|
|
- uuid: 27ad9640bf734dd49548c19241cc4838
|
|
name: 'GCP Cloud SQL PostgreSQL: DB engine state'
|
|
type: HTTP_AGENT
|
|
key: gcp.cloudsql.pgsql.db.state
|
|
history: 7d
|
|
description: 'GCP Cloud SQL PostgreSQL DB Engine State.'
|
|
valuemap:
|
|
name: 'Database availability'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.timeSeriesData[0].pointData[0].values[0].int64Value'
|
|
error_handler: DISCARD_VALUE
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 10m
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
url: 'https://monitoring.googleapis.com/v3/projects/{$GCP.PROJECT.ID}/timeSeries:query'
|
|
posts: '{"query":"cloudsql.googleapis.com/database/up | within 5m | filter database_id = ''{$GCP.PROJECT.ID}:{HOST.NAME}''"}'
|
|
status_codes: ''
|
|
headers:
|
|
- name: Content-Type
|
|
value: application/json
|
|
- name: Authorization
|
|
value: 'Bearer {$GCP.AUTH.TOKEN}'
|
|
request_method: POST
|
|
tags:
|
|
- tag: component
|
|
value: status
|
|
triggers:
|
|
- uuid: f7b0fc21edcf489ab174eb06dee4fabe
|
|
expression: |
|
|
last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.db.state)=0
|
|
|
|
name: 'GCP Cloud SQL PostgreSQL: Database engine is down'
|
|
priority: AVERAGE
|
|
description: |
|
|
Database engine is down.
|
|
If an instance experiences unplanned (non-maintenance) downtime, the instance state will still be RUNNING, but the database engine state metric will report 0.
|
|
|
|
dependencies:
|
|
- name: 'GCP Cloud SQL PostgreSQL: Failed to get the instance state'
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 10'
|
|
- name: 'GCP Cloud SQL PostgreSQL: Instance is in failed state'
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 5'
|
|
- name: 'GCP Cloud SQL PostgreSQL: Instance is in maintenance'
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 4'
|
|
- name: 'GCP Cloud SQL PostgreSQL: Instance is in suspended state'
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 1'
|
|
- name: 'GCP Cloud SQL PostgreSQL: Instance is in unknown state'
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 6'
|
|
- name: 'GCP Cloud SQL PostgreSQL: Instance is stopped by the owner'
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 2'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 799cad827e8b44d98b8285b08153842d
|
|
name: 'GCP Cloud SQL PostgreSQL: Disk bytes used'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.disk.bytes_used
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Data utilization in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_bytes_used
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: 470510bf76fb47fbbddfc8c4a711a335
|
|
name: 'GCP Cloud SQL PostgreSQL: Disk size'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.disk.quota
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Maximum data disk size in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_quota
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: f12ba5129c2d435389f4fb6964294381
|
|
name: 'GCP Cloud SQL PostgreSQL: Disk read I/O'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.disk.read_ops_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of data disk read I/O operations.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_read_ops_count
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: e2d6702514b941cb9586cb98786c6a01
|
|
name: 'GCP Cloud SQL PostgreSQL: Disk utilization'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.disk.utilization
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: |
|
|
The fraction of the disk quota that is currently in use.
|
|
Shown as percentage.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_utilization
|
|
- type: MULTIPLIER
|
|
parameters:
|
|
- '100'
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
triggers:
|
|
- uuid: c4fa1d580ffd4546b82605f94da5d2ba
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.disk.utilization) >= {$CLOUD_SQL.PGSQL.DISK.UTIL.CRIT}'
|
|
name: 'GCP Cloud SQL PostgreSQL: Disk space is critically low'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: AVERAGE
|
|
description: 'Critical utilization of the disk space.'
|
|
tags:
|
|
- tag: scope
|
|
value: capacity
|
|
- uuid: 186a707ca3194c32a894ae809177a7e2
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.disk.utilization) >= {$CLOUD_SQL.PGSQL.DISK.UTIL.WARN}'
|
|
name: 'GCP Cloud SQL PostgreSQL: Disk space is low'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: WARNING
|
|
description: 'High utilization of the storage space.'
|
|
dependencies:
|
|
- name: 'GCP Cloud SQL PostgreSQL: Disk space is critically low'
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.disk.utilization) >= {$CLOUD_SQL.PGSQL.DISK.UTIL.CRIT}'
|
|
tags:
|
|
- tag: scope
|
|
value: capacity
|
|
- uuid: 8d8d6c13cdb244cb80c03226b7c14a90
|
|
name: 'GCP Cloud SQL PostgreSQL: Disk write I/O'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.disk.write_ops_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of data disk write I/O operations.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_write_ops_count
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: 88fd41960538460ebfd2ed9194677cd1
|
|
name: 'GCP Cloud SQL PostgreSQL: Instance state'
|
|
type: HTTP_AGENT
|
|
key: gcp.cloudsql.pgsql.inst.state
|
|
history: 7d
|
|
description: 'GCP Cloud SQL PostgreSQL Current instance state.'
|
|
valuemap:
|
|
name: 'Instance state'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.timeSeriesData[0].pointData[0].values[0].stringValue'
|
|
error_handler: CUSTOM_VALUE
|
|
error_handler_params: '10'
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const idx = [
|
|
'RUNNING',
|
|
'SUSPENDED',
|
|
'RUNNABLE',
|
|
'PENDING_CREATE',
|
|
'MAINTENANCE',
|
|
'FAILED',
|
|
'UNKNOWN_STATE'
|
|
].indexOf(value);
|
|
return idx !== -1 ? idx : 10;
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 10m
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
url: 'https://monitoring.googleapis.com/v3/projects/{$GCP.PROJECT.ID}/timeSeries:query'
|
|
posts: '{"query":"cloudsql.googleapis.com/database/state | within 5m | filter database_id = ''{$GCP.PROJECT.ID}:{HOST.NAME}''"}'
|
|
status_codes: ''
|
|
headers:
|
|
- name: Content-Type
|
|
value: application/json
|
|
- name: Authorization
|
|
value: 'Bearer {$GCP.AUTH.TOKEN}'
|
|
request_method: POST
|
|
tags:
|
|
- tag: component
|
|
value: status
|
|
triggers:
|
|
- uuid: 596020e32d0c4193a6626c960b4b5be8
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 10'
|
|
name: 'GCP Cloud SQL PostgreSQL: Failed to get the instance state'
|
|
priority: AVERAGE
|
|
description: |
|
|
Failed to get the instance state.
|
|
Check access permissions to GCP API or service account.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 1a2efb6f755444c0bab85d2778018eb1
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 5'
|
|
name: 'GCP Cloud SQL PostgreSQL: Instance is in failed state'
|
|
priority: AVERAGE
|
|
description: |
|
|
The instance creation failed, or an operation left the instance in an own bad state.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: aad6fb2d86c84e33868aacbf160c3d65
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 4'
|
|
name: 'GCP Cloud SQL PostgreSQL: Instance is in maintenance'
|
|
priority: INFO
|
|
description: 'The instance is down for maintenance.'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 959072ed00c4461196bef71618799b82
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 1'
|
|
name: 'GCP Cloud SQL PostgreSQL: Instance is in suspended state'
|
|
priority: WARNING
|
|
description: |
|
|
The instance is in suspended state.
|
|
It is not available, for example, due to problems with billing.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 5f1084f744b444f3b803110baf703973
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 6'
|
|
name: 'GCP Cloud SQL PostgreSQL: Instance is in unknown state'
|
|
priority: AVERAGE
|
|
description: |
|
|
The state of the instance is unknown.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: fb0df2eb001649febb6fc6513e056fcc
|
|
expression: 'last(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.inst.state) = 2'
|
|
name: 'GCP Cloud SQL PostgreSQL: Instance is stopped by the owner'
|
|
priority: INFO
|
|
description: |
|
|
The instance has been stopped by the owner.
|
|
It is not currently running, but it's ready to be restarted.
|
|
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 014d96156a364f2c8eac6a47de3eddfe
|
|
name: 'GCP Cloud SQL PostgreSQL: Memory size'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.memory.quota
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Maximum RAM size in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_quota
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: e73876fa0728402db7688a41938f4a12
|
|
name: 'GCP Cloud SQL PostgreSQL: Memory used by DB engine'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.memory.total_usage
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
Total RAM usage in bytes.
|
|
This metric reports the RAM usage of the database process, including the buffer/cache.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_total_usage
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 2a5daa0300564b97a5e744e576a217cb
|
|
name: 'GCP Cloud SQL PostgreSQL: Memory usage'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.memory.usage
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
The RAM usage in bytes.
|
|
This metric reports the RAM usage of the server, excluding the buffer/cache.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_usage
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 4c524a81bf3b4a6bbc87d23b60c4f74c
|
|
name: 'GCP Cloud SQL PostgreSQL: Memory utilization'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.memory.utilization
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: |
|
|
The fraction of the memory quota that is currently in use.
|
|
Shown as percentage.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_ram_pused
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
triggers:
|
|
- uuid: bbbdbd9c3c5b407491b359f98e4e3fa9
|
|
expression: 'min(/GCP Cloud SQL PostgreSQL by HTTP/gcp.cloudsql.pgsql.memory.utilization,5m) >= {$CLOUD_SQL.PGSQL.RAM.UTIL.MAX}'
|
|
name: 'GCP Cloud SQL PostgreSQL: High memory utilization'
|
|
opdata: 'Current utilization: {ITEM.LASTVALUE}'
|
|
priority: HIGH
|
|
description: 'RAM utilization is too high. The system might be slow to respond.'
|
|
tags:
|
|
- tag: scope
|
|
value: performance
|
|
- uuid: 9bf09a42ddd64f7eabf6bbc011eda689
|
|
name: 'GCP Cloud SQL PostgreSQL: Metrics get'
|
|
type: SCRIPT
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'cloudsql.googleapis.com/database/',
|
|
pgsql_path = 'cloudsql.googleapis.com/database/postgresql/',
|
|
obj = {},
|
|
value_types = ['int64Value', 'doubleValue', 'stringValue', 'boolValue'];
|
|
|
|
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 checkParams(params) {
|
|
['project_id', 'time_window', 'database_id', 'token'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
function getHttpData(url, token, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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;
|
|
};
|
|
|
|
function rawMap(raw, prefix) {
|
|
var keys = getField(raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
values = getField(raw, 'timeSeriesData.0.pointData.0.values'),
|
|
re = /(^t_\d+\.value(_|\.)|_sum$)/g;
|
|
|
|
for (i in keys) {
|
|
var key = getField(keys[i], 'key').replace(re, '');
|
|
|
|
for (v in value_types) {
|
|
if (typeof values[i][value_types[v]] !== 'undefined') {
|
|
if (prefix) {
|
|
obj[prefix + key] = values[i][value_types[v]];
|
|
} else {
|
|
obj[key] = values[i][value_types[v]];
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
function singleMetrics(tsd) {
|
|
result = {};
|
|
for (t in tsd) {
|
|
for (v in value_types) {
|
|
if (typeof tsd[t].pointData[0].values[0][value_types[v]] !== 'undefined') {
|
|
result['pgsql_' + getField(tsd[t], 'labelValues.3.stringValue').toLowerCase()] = tsd[t].pointData[0].values[0][value_types[v]];
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
var params = checkParams(JSON.parse(value)),
|
|
time_window = params.time_window,
|
|
project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter database_id = '" + params.database_id + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query',
|
|
base_paths = [
|
|
'cpu/reserved_cores',
|
|
'cpu/usage_time',
|
|
'cpu/utilization',
|
|
'disk/read_ops_count',
|
|
'disk/write_ops_count',
|
|
'memory/quota',
|
|
'memory/total_usage',
|
|
'memory/usage',
|
|
'network/received_bytes_count',
|
|
'network/sent_bytes_count | map ignore [destination]'
|
|
].map(function (path) { return base_path + path; }),
|
|
pgsql_paths = [
|
|
'transaction_id_utilization ' + filter,
|
|
'temp_bytes_written_count' + filter + ' | sum',
|
|
'temp_files_written_count' + filter + ' | sum',
|
|
'num_backends' + filter + ' | sum'
|
|
].map(function (path) { return pgsql_path + path; }).concat(
|
|
['disk/bytes_used', 'disk/utilization', 'disk/quota'].map(function (path) { return base_path + path; })),
|
|
queries = [
|
|
{ name: 'base_', data: { query: '{' + base_paths.join(';') + '}' + j_filter } },
|
|
{ name: 'pgsql_', data: { query: '{' + pgsql_paths.join(';') + '}' + '| within ' + time_window + '| join' } }
|
|
];
|
|
|
|
for (q in queries) {
|
|
raw = getHttpData(url, params.token, queries[q].data);
|
|
obj = Object.assign(obj, rawMap(raw, queries[q].name));
|
|
}
|
|
|
|
obj.base_ram_pused = Math.floor((getField(obj, 'base_usage') / getField(obj, 'base_quota')) * 100);
|
|
|
|
var single_paths = ['transaction_id_count', 'vacuum/oldest_transaction_age'],
|
|
single_queries = single_paths.map(function (path) { return { query: pgsql_path + path + filter }; });
|
|
|
|
for (q in single_queries) {
|
|
raw = getHttpData(url, params.token, single_queries[q]);
|
|
Object.assign(obj, singleMetrics(getField(raw, 'timeSeriesData')));
|
|
}
|
|
|
|
return JSON.stringify(obj);
|
|
description: 'PostgreSQL metrics data in raw format.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: database_id
|
|
value: '{$GCP.PROJECT.ID}:{HOST.NAME}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: f2d00c86eedd4a1e8efce7661c3da18d
|
|
name: 'GCP Cloud SQL PostgreSQL: Network: Received bytes'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.network.received_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Delta count of bytes received through the network.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_received_bytes_count
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: dc67deac1a2f4cc993406028d6cc8c3b
|
|
name: 'GCP Cloud SQL PostgreSQL: Network: Sent bytes'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.network.sent_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Delta count of bytes sent through the network.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.base_sent_bytes_count
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 512c5d8156fb4d5299284f708e64dffc
|
|
name: 'GCP Cloud SQL PostgreSQL: Connections'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.num_backends
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
The number of the connections to the Cloud SQL PostgreSQL instance.
|
|
Includes connections to the system databases, which aren't visible by default.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_num_backends
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: connections
|
|
- tag: component
|
|
value: network
|
|
- uuid: 88603b1881114551ba23e8f12d5ab47f
|
|
name: 'GCP Cloud SQL PostgreSQL: Oldest prepared transaction age'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.oldest_transaction.prepared
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Age of the oldest prepared transaction yet to be vacuumed in the Cloud SQL PostgreSQL instance, measured in number of transactions that have happened since the oldest transaction.
|
|
Empty value when there is no such transaction type.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_prepared
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: 50df8067afcb42a9ac44fe963ee635d2
|
|
name: 'GCP Cloud SQL PostgreSQL: Oldest replica transaction age'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.oldest_transaction.replica
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Age of the oldest replica transaction yet to be vacuumed in the Cloud SQL PostgreSQL instance, measured in number of transactions that have happened since the oldest transaction.
|
|
Empty value when there is no such transaction type.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_replica
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: fee3d72f615c479389c5fdb46f32229f
|
|
name: 'GCP Cloud SQL PostgreSQL: Oldest replication slot transaction age'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.oldest_transaction.replication_slot
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Age of the oldest replication slot transaction yet to be vacuumed in the Cloud SQL PostgreSQL instance, measured in number of transactions that have happened since the oldest transaction.
|
|
Empty value when there is no such transaction type.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_replication_slot
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: 6d51c4865cd04607986ef4e02bc43fb6
|
|
name: 'GCP Cloud SQL PostgreSQL: Oldest running transaction age'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.oldest_transaction.running
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Age of the oldest running transaction yet to be vacuumed in the Cloud SQL PostgreSQL instance, measured in number of transactions that have happened since the oldest transaction.
|
|
Empty value when there is no such transaction type.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_running
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: 75bc8d76a59a465fb66a434e13de107d
|
|
name: 'GCP Cloud SQL PostgreSQL: Data written to temporary'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.temp_bytes_written_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Total data size (in bytes) written to temporary files by the queries.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_temp_bytes_written_count
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: bd10ec6251c444a79878e82e3ebe9ac0
|
|
name: 'GCP Cloud SQL PostgreSQL: Temporary files used for writing data'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.temp_files_written_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of temporary files used for writing data while performing algorithms such as join and sort.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_temp_files_written_count
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- uuid: 2498b066f4964aa7be03f4cc43eab95e
|
|
name: 'GCP Cloud SQL PostgreSQL: Assigned transactions'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.transaction_id_count_assigned
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of assigned transaction IDs.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_assigned
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: 23d1b88571d347db9672596ec13580cc
|
|
name: 'GCP Cloud SQL PostgreSQL: Frozen transactions'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.transaction_id_count_frozen
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of frozen transaction IDs.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_frozen
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- uuid: 004042d342d0478ea8f826466353454d
|
|
name: 'GCP Cloud SQL PostgreSQL: Transaction ID utilization'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.transaction_id_utilization
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: 'Current utilization represented as a percentage of transaction IDs consumed by the Cloud SQL PostgreSQL instance.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.pgsql_transaction_id_utilization
|
|
- type: MULTIPLIER
|
|
parameters:
|
|
- '100'
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
discovery_rules:
|
|
- uuid: 090d05a647384858a8b9efe5502c0a76
|
|
name: 'GCP Cloud SQL PostgreSQL: Databases discovery'
|
|
type: HTTP_AGENT
|
|
key: gcp.cloudsql.pgsql.db.discovery
|
|
delay: 1h
|
|
filter:
|
|
evaltype: AND
|
|
conditions:
|
|
- macro: '{#PGSQL.DB.NAME}'
|
|
value: '{$GCP.CLOUD_SQL.DB.NAME.MATCHES}'
|
|
formulaid: A
|
|
- macro: '{#PGSQL.DB.NAME}'
|
|
value: '{$GCP.CLOUD_SQL.DB.NAME.NOT_MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: B
|
|
lifetime: 7d
|
|
description: 'Databases discovery for the particular PostgreSQL instance.'
|
|
item_prototypes:
|
|
- uuid: 997bdb03ba0b437ca2705f28dcc651ed
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Buffer cache blocks read.'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.blocks_read_count_buffer_cache[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of buffer cache blocks read by the [{#PGSQL.DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.buffer_cache
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: b35c4a888743448688a8c5233ed165e7
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Disk blocks read.'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.blocks_read_count_disk[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of disk blocks read by the [{#PGSQL.DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.disk
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: 7a1df30ae0c443839fe625142aea61b2
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Metrics raw'
|
|
type: SCRIPT
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'cloudsql.googleapis.com/database/postgresql/',
|
|
obj = {};
|
|
|
|
function checkParams(params) {
|
|
['project_id', 'time_window', 'database_id', 'token'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
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, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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;
|
|
};
|
|
|
|
function singleMetrics(tsd) {
|
|
var result = {};
|
|
|
|
for (i in tsd) {
|
|
result[getField(tsd[i], 'labelValues.4.stringValue')] = getField(tsd[i], 'pointData.0.values.0.int64Value');
|
|
}
|
|
return result;
|
|
}
|
|
|
|
var params = checkParams(JSON.parse(value)),
|
|
time_window = params.time_window,
|
|
project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter database_id ='" + params.database_id + "'" + " | filter database ='" + params.database_name + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query',
|
|
common_paths = ['deadlock_count', 'tuples_returned_count', 'tuples_fetched_count'];
|
|
|
|
var common_raw = getHttpData(url, params.token, { query: '{' + common_paths.map(function (path) { return base_path + path; }).join(';') + '}' + j_filter }),
|
|
keys = getField(common_raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
values = getField(common_raw, 'timeSeriesData.0.pointData.0.values'),
|
|
re = /(^t_\d+\.value\.)/g;
|
|
|
|
for (i in keys) {
|
|
var value_types = ['int64Value', 'doubleValue', 'stringValue', 'boolValue'];
|
|
|
|
for (v in value_types) {
|
|
if (typeof values[i][value_types[v]] !== 'undefined') {
|
|
obj[getField(keys[i], 'key').replace(re, '')] = values[i][value_types[v]];
|
|
}
|
|
}
|
|
}
|
|
|
|
var single_paths = ['transaction_count', 'blocks_read_count', 'tuples_processed_count', 'tuple_size'],
|
|
single_queries = single_paths.map(function (path) { return { query: base_path + path + filter }; });
|
|
|
|
for (q in single_queries) {
|
|
raw = getHttpData(url, params.token, single_queries[q]);
|
|
obj = Object.assign(obj, singleMetrics(getField(raw, 'timeSeriesData')));
|
|
}
|
|
|
|
return JSON.stringify(obj);
|
|
description: 'PostgreSQL metrics in raw format.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: database_id
|
|
value: '{$GCP.PROJECT.ID}:{HOST.NAME}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
- name: database_name
|
|
value: '{#PGSQL.DB.NAME}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: d5632c60593749209a6e681b396f4cc7
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Deadlocks count'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.deadlock_count[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of deadlocks detected in the [{#PGSQL.DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.deadlock_count
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: deadlock
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: 6d846507fbc24cbb9fb4ad59167552db
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Committed transactions'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.transaction_count_commit[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of number of committed transactions to the [{#PGSQL.DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.commit
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: 4751ef5e498e4ce184bd07aadc831d2b
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Rolled-back transactions'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.transaction_count_rollback[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Delta count of number of rolled-back transactions in the [{#PGSQL.DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.rollback
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: transactions
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: a7451a61e0b04be8b1f85b47c44107e2
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Tuples fetched'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.tuples_fetched_count[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of rows fetched as a result of queries to the [{#PGSQL.DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.tuples_fetched_count
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: tuples
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: 7daca0b14f5843669bc5b0823cd4d44f
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Deleted rows processed'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.tuples_processed_count_delete[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of tuples(rows) processed for delete operations for the database with the name [{#PGSQL.DB.NAME}].'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.delete
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: tuples
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: 48a7613fa611410b8353d03d87af0f8d
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Inserted rows processed.'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.tuples_processed_count_insert[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of tuples(rows) processed for insert operations for the database with the name [{#PGSQL.DB.NAME}].'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.insert
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: tuples
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: e159cc28aec6448b9162f780479f5aab
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Updated rows processed'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.tuples_processed_count_update[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of tuples(rows) processed for update operations for the database with the name [{#PGSQL.DB.NAME}].'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.update
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: tuples
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: ee6fad5b2fb44a14a29c7cd662b1f5d2
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Tuples returned'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.tuples_returned_count[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Total number of rows scanned while processing the queries of the [{#PGSQL.DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.tuples_returned_count
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: tuples
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: f7a58601a3384b8ba24c89b3693ddb88
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Dead tuples'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.tuple_size_dead[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of live tuples(rows) in the [{#PGSQL.DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.dead
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: tuples
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
- uuid: 16e88225cd41406285b3237ee1e61bb4
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Live tuples'
|
|
type: DEPENDENT
|
|
key: 'gcp.cloudsql.pgsql.tuple_size_live[{#PGSQL.DB.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of live tuples(rows) in the [{#PGSQL.DB.NAME}] database.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.live
|
|
master_item:
|
|
key: 'gcp.cloudsql.pgsql.db.metrics.get[{#PGSQL.DB.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: tuples
|
|
- tag: database
|
|
value: '{#PGSQL.DB.NAME}'
|
|
graph_prototypes:
|
|
- uuid: 8ba7dd12152243b4a5a438bd649f96c1
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Tuples'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: 'gcp.cloudsql.pgsql.tuple_size_dead[{#PGSQL.DB.NAME}]'
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: 'gcp.cloudsql.pgsql.tuple_size_live[{#PGSQL.DB.NAME}]'
|
|
- sortorder: '2'
|
|
color: 00611C
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: 'gcp.cloudsql.pgsql.tuples_processed_count_insert[{#PGSQL.DB.NAME}]'
|
|
- sortorder: '3'
|
|
color: F7941D
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: 'gcp.cloudsql.pgsql.tuples_processed_count_update[{#PGSQL.DB.NAME}]'
|
|
- sortorder: '4'
|
|
color: FC6EA3
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: 'gcp.cloudsql.pgsql.tuples_processed_count_delete[{#PGSQL.DB.NAME}]'
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
url: 'https://sqladmin.googleapis.com/sql/v1beta4/projects/{$GCP.PROJECT.ID}/instances/{HOST.NAME}/databases'
|
|
headers:
|
|
- name: Content-Type
|
|
value: application/json
|
|
- name: Authorization
|
|
value: 'Bearer {$GCP.AUTH.TOKEN}'
|
|
lld_macro_paths:
|
|
- lld_macro: '{#PGSQL.DB.NAME}'
|
|
path: $.name
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.items
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 3h
|
|
tags:
|
|
- tag: class
|
|
value: cloud
|
|
- tag: target
|
|
value: cloudsql
|
|
- tag: target
|
|
value: gcp
|
|
- tag: target
|
|
value: google-cloud-platform
|
|
- tag: target
|
|
value: postgresql
|
|
macros:
|
|
- macro: '{$CLOUD_SQL.PGSQL.CPU.UTIL.MAX}'
|
|
value: '95'
|
|
description: 'GCP Cloud SQL PostgreSQL instance CPU usage threshold.'
|
|
- macro: '{$CLOUD_SQL.PGSQL.DISK.UTIL.CRIT}'
|
|
value: '90'
|
|
description: 'GCP Cloud SQL PostgreSQL instance critical disk usage threshold.'
|
|
- macro: '{$CLOUD_SQL.PGSQL.DISK.UTIL.WARN}'
|
|
value: '80'
|
|
description: 'GCP Cloud SQL PostgreSQL instance warning disk usage threshold.'
|
|
- macro: '{$CLOUD_SQL.PGSQL.RAM.UTIL.MAX}'
|
|
value: '90'
|
|
description: 'GCP Cloud SQL PostgreSQL instance RAM usage threshold.'
|
|
- macro: '{$GCP.CLOUD_SQL.DB.NAME.MATCHES}'
|
|
value: '.*'
|
|
description: 'The filter to include GCP Cloud SQL PostgreSQL databases by namespace.'
|
|
- macro: '{$GCP.CLOUD_SQL.DB.NAME.NOT_MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'The filter to exclude GCP Cloud SQL PostgreSQL databases by namespace.'
|
|
- macro: '{$GCP.DATA.TIMEOUT}'
|
|
value: 15s
|
|
description: 'A response timeout for an API.'
|
|
- macro: '{$GCP.TIME.WINDOW}'
|
|
value: 5m
|
|
description: |
|
|
Time interval for the data requests.
|
|
Supported usage type:
|
|
1. The default update interval for most of the items.
|
|
2. The minimal time window for the data requested in the Monitoring Query Language REST API request.
|
|
|
|
dashboards:
|
|
- uuid: 21636cfe7d2f4de28d07af09c9812075
|
|
name: 'PostgreSQL instance'
|
|
pages:
|
|
- name: 'PostgreSQL instance'
|
|
widgets:
|
|
- type: graph
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.cpu.usage_time
|
|
- type: graph
|
|
x: '12'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.cpu.utilization
|
|
- type: graph
|
|
'y': '5'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
name: 'GCP Cloud SQL PostgreSQL: Memory usage'
|
|
- type: graph
|
|
x: '12'
|
|
'y': '5'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.memory.utilization
|
|
- type: graph
|
|
'y': '10'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.disk.utilization
|
|
- type: graph
|
|
x: '12'
|
|
'y': '10'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
name: 'GCP Cloud SQL PostgreSQL: Disk read/write operations'
|
|
- type: graph
|
|
'y': '15'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
name: 'GCP Cloud SQL PostgreSQL: Network traffic'
|
|
- type: graph
|
|
x: '12'
|
|
'y': '15'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.transaction_id_utilization
|
|
- type: graph
|
|
'y': '20'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
name: 'GCP Cloud SQL PostgreSQL: Transactions count'
|
|
- type: graph
|
|
x: '12'
|
|
'y': '20'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
name: 'GCP Cloud SQL PostgreSQL: Transaction age'
|
|
- type: graphprototype
|
|
'y': '25'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: columns
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: rows
|
|
value: '1'
|
|
- type: GRAPH_PROTOTYPE
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
name: 'GCP Cloud SQL PostgreSQL: Database [{#PGSQL.DB.NAME}]: Tuples'
|
|
- type: graphprototype
|
|
x: '12'
|
|
'y': '25'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: columns
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: rows
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '3'
|
|
- type: ITEM_PROTOTYPE
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: 'gcp.cloudsql.pgsql.deadlock_count[{#PGSQL.DB.NAME}]'
|
|
valuemaps:
|
|
- uuid: c783556dfa214e73b676ca187648c5df
|
|
name: 'Database availability'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Down
|
|
- value: '1'
|
|
newvalue: Up
|
|
- uuid: bc3b08ca201d438689678a29e3575823
|
|
name: 'Instance state'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Running
|
|
- value: '1'
|
|
newvalue: Suspended
|
|
- value: '2'
|
|
newvalue: Runnable
|
|
- value: '3'
|
|
newvalue: 'Pending create'
|
|
- value: '4'
|
|
newvalue: Maintenance
|
|
- value: '5'
|
|
newvalue: Failed
|
|
- value: '6'
|
|
newvalue: 'Unknown state'
|
|
- value: '10'
|
|
newvalue: 'Data retrievement error'
|
|
- uuid: b43a7c5f1d1d43d28e2eb8f0a9f6f16f
|
|
template: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
name: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
description: |
|
|
Get GCP Cloud SQL PostgreSQL monitoring for read-only replicas with script item usage to perform HTTP requests to Google Cloud Platform Monitoring API.
|
|
This template will be automatically connected to discovered entities with all their required parameters pre-defined.
|
|
|
|
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" 2.0.0
|
|
vendor:
|
|
name: Zabbix
|
|
version: 7.0-0
|
|
groups:
|
|
- name: Templates/Cloud
|
|
items:
|
|
- uuid: c67dd812c7784948bad5dfa0d9a6cc66
|
|
name: 'GCP Cloud SQL PostgreSQL: Flush location lag'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.repl.flush_location
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Flush location replication lag in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.flush_location
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 2b8b51f0266049ffbfb7ece2f944fb68
|
|
name: 'GCP Cloud SQL PostgreSQL: Number of log archival failures'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.repl.log_archive_failure_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of failed attempts for archiving replication log files.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.log_archive_failure_count
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 4657c4bb904b437598b68410e47f7194
|
|
name: 'GCP Cloud SQL PostgreSQL: Number of log archival successes'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.repl.log_archive_success_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Number of failed attempts for archiving replication log files.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.log_archive_success_count
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: cb9c5aff913e4deeb29dfa1a20b5ff04
|
|
name: 'GCP Cloud SQL PostgreSQL: Replica metrics get'
|
|
type: SCRIPT
|
|
key: gcp.cloudsql.pgsql.repl.metrics.get
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'cloudsql.googleapis.com/database/replication/',
|
|
pgsql_path = 'cloudsql.googleapis.com/database/postgresql/replication/',
|
|
obj = {},
|
|
base_paths = ['network_lag', 'replica_lag', 'log_archive_failure_count', 'log_archive_success_count'];
|
|
|
|
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 checkParams(params) {
|
|
['project_id', 'time_window', 'database_id', 'token'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
function getHttpData(url, token, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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 params = checkParams(JSON.parse(value)),
|
|
time_window = params.time_window,
|
|
project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter database_id = '" + params.database_id + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query';
|
|
|
|
var metric_raw = getHttpData(url, params.token, { query: '{' + base_paths.map(function (path) { return base_path + path; }).join(';') + '}' + j_filter });
|
|
|
|
var metric_keys = getField(metric_raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
metric_values = getField(metric_raw, 'timeSeriesData.0.pointData.0.values'),
|
|
re = /(^t_\d+\.value\.)/g;
|
|
|
|
for (i in metric_keys) {
|
|
var value_types = ['int64Value', 'doubleValue', 'stringValue', 'boolValue'];
|
|
|
|
for (v in value_types) {
|
|
if (typeof metric_values[i][value_types[v]] !== 'undefined') {
|
|
obj[getField(metric_keys[i], 'key').replace(re, '')] = metric_values[i][value_types[v]];
|
|
}
|
|
}
|
|
}
|
|
|
|
var state_raw = getHttpData(url, params.token, { query: base_path + 'state' + filter }),
|
|
state_keys = getField(state_raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
state_tsd = getField(state_raw, 'timeSeriesData');
|
|
|
|
for (i in state_keys) {
|
|
var state_key = getField(state_keys[i], 'key').replace(/value\./g, '');
|
|
|
|
obj[state_key] = 'undefined';
|
|
for (t in state_tsd) {
|
|
if (getField(state_tsd[t], 'pointData.0.values.' + i + '.boolValue') == true) {
|
|
obj[state_key] = getField(state_tsd[t], 'labelValues.3.stringValue');
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
var lag_raw = getHttpData(url, params.token, { query: pgsql_path + 'replica_byte_lag' + '| within ' + time_window + " | filter replica_name = '" + params.database_id + "'" }),
|
|
lag_tsd = getField(lag_raw, 'timeSeriesData');
|
|
|
|
for (t in lag_tsd) {
|
|
obj[getField(lag_tsd[t], 'labelValues.3.stringValue')] = getField(lag_tsd[t], 'pointData.0.values.0.int64Value');
|
|
}
|
|
|
|
return JSON.stringify(obj);
|
|
description: 'PostgreSQL replica metrics data in raw format.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: database_id
|
|
value: '{$GCP.PROJECT.ID}:{HOST.NAME}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: e43272210c45425d871d70a5bb91cdd1
|
|
name: 'GCP Cloud SQL PostgreSQL: Network lag'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.repl.network_lag
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: s
|
|
description: 'Indicates time taken from primary binary log to IO thread on replica.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.network_lag
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 7d74736aa2804c899de35634bc072edf
|
|
name: 'GCP Cloud SQL PostgreSQL: Replay location lag'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.repl.replay_location
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Replay location replication lag in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.replay_location
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 192e0bb3ac744f8eb38a760ee3f7c623
|
|
name: 'GCP Cloud SQL PostgreSQL: Replication lag'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.repl.replica_lag
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: s
|
|
description: 'Number of seconds the read replica is behind its primary (approximation).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.replica_lag
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: 379c8bc0cfe847d1819ab96aceee5efe
|
|
name: 'GCP Cloud SQL PostgreSQL: Sent location lag'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.repl.sent_location
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Sent location replication lag in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.sent_location
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- uuid: a7f785dbe4954d77a82e6384620b5d6e
|
|
name: 'GCP Cloud SQL PostgreSQL: Replication state'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.repl.state
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
The current serving state of replication.
|
|
This metric is only available for the MySQL/PostgreSQL instances.
|
|
|
|
valuemap:
|
|
name: 'Replication state'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.state
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const idx = [
|
|
'Running',
|
|
'Syncing',
|
|
'Unsynced',
|
|
'Stopped',
|
|
'Error',
|
|
].indexOf(value);
|
|
return idx !== -1 ? idx : 10;
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
- tag: component
|
|
value: status
|
|
- uuid: 10af15bc71ed446eb4e614c2cb6029d5
|
|
name: 'GCP Cloud SQL PostgreSQL: Write location lag'
|
|
type: DEPENDENT
|
|
key: gcp.cloudsql.pgsql.repl.write_location
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Write location replication lag in bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.write_location
|
|
master_item:
|
|
key: gcp.cloudsql.pgsql.repl.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: replication
|
|
tags:
|
|
- tag: class
|
|
value: cloud
|
|
- tag: target
|
|
value: cloudsql
|
|
- tag: target
|
|
value: gcp
|
|
- tag: target
|
|
value: google-cloud-platform
|
|
- tag: target
|
|
value: postgresql
|
|
- tag: target
|
|
value: replica
|
|
macros:
|
|
- macro: '{$GCP.DATA.TIMEOUT}'
|
|
value: 15s
|
|
description: 'A response timeout for an API.'
|
|
- macro: '{$GCP.TIME.WINDOW}'
|
|
value: 5m
|
|
description: |
|
|
Time interval for the data requests.
|
|
Supported usage type:
|
|
1. The default update interval for most of the items.
|
|
2. The minimal time window for the data requested in the Monitoring Query Language REST API request.
|
|
|
|
dashboards:
|
|
- uuid: acb71f4a818d43e0b045ba87c2daa989
|
|
name: 'PostgreSQL replica'
|
|
pages:
|
|
- name: 'PostgreSQL replica'
|
|
widgets:
|
|
- type: graph
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
name: 'GCP Cloud SQL PostgreSQL: WAL archiving'
|
|
- type: graph
|
|
x: '12'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
name: 'GCP Cloud SQL PostgreSQL: Lags'
|
|
valuemaps:
|
|
- uuid: af111e6b9e5a47cd9c3933b8ce35076c
|
|
name: 'Replication state'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Running
|
|
- value: '1'
|
|
newvalue: Syncing
|
|
- value: '2'
|
|
newvalue: Unsynced
|
|
- value: '3'
|
|
newvalue: Stopped
|
|
- value: '4'
|
|
newvalue: Error
|
|
- value: '10'
|
|
newvalue: Unknown
|
|
- uuid: 6d2443db49e54d59a82b9b525f2424ef
|
|
template: 'GCP Compute Engine Instance by HTTP'
|
|
name: 'GCP Compute Engine Instance by HTTP'
|
|
description: |
|
|
Discover GCP Compute Engine instances by HTTP with script item usage.
|
|
This template will be automatically connected to discovered entities with all their required parameters pre-defined.
|
|
|
|
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" 2.0.0
|
|
vendor:
|
|
name: Zabbix
|
|
version: 7.0-0
|
|
groups:
|
|
- name: Templates/Cloud
|
|
items:
|
|
- uuid: 3de05ba490644a62ba4a700ffe439c98
|
|
name: 'GCP Compute Engine: Guest visible vCPUs'
|
|
type: DEPENDENT
|
|
key: gcp.gce.cpu.guest_visible_vcpus
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
description: |
|
|
Number of vCPUs visible inside the guest.
|
|
For many GCE machine types, the number of vCPUs visible inside the guest is equal to the `compute.googleapis.com/instance/cpu/reserved_cores` metric.
|
|
For shared-core machine types, the number of guest-visible vCPUs differs from the number of reserved cores.
|
|
For example, e2-small instances have two vCPUs visible inside the guest and 0.5 fractional vCPUs reserved.
|
|
Therefore, for an e2-small instance, `compute.googleapis.com/instance/cpu/guest_visible_vcpus` has a value of 2 and `compute.googleapis.com/instance/cpu/reserved_cores` has a value of 0.5.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.guest_visible_vcpus
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
- uuid: 2fa7a2aa15a242cc826248ebe96bb173
|
|
name: 'GCP Compute Engine: Reserved vCPUs'
|
|
type: DEPENDENT
|
|
key: gcp.gce.cpu.reserved_cores
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
description: 'Number of vCPUs reserved on the host of the instance.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.reserved_cores
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
- uuid: f6c9c633f514416189ba85d2015251ba
|
|
name: 'GCP Compute Engine: Scheduler wait time'
|
|
type: DEPENDENT
|
|
key: gcp.gce.cpu.scheduler_wait_time
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: s
|
|
description: |
|
|
Wait time is the time a vCPU is ready to run, but unexpectedly not scheduled to run.
|
|
The wait time returned here is the accumulated value for all vCPUs.
|
|
The time interval for which the value was measured is returned by Monitoring in whole seconds as start_time and end_time.
|
|
This metric is only available for VMs that belong to the e2 family or to overcommitted VMs on sole-tenant nodes.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.scheduler_wait_time
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
- uuid: daf4d0d23ccf4633aad6405bd1f09dc3
|
|
name: 'GCP Compute Engine: CPU usage time'
|
|
type: DEPENDENT
|
|
key: gcp.gce.cpu.usage_time
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: s
|
|
description: |
|
|
Delta vCPU usage for all vCPUs, in vCPU-seconds.
|
|
To compute the per-vCPU utilization fraction, divide this value by (end-start)*N, where end and start define this value's time interval and N is `compute.googleapis.com/instance/cpu/reserved_cores` at the end of the interval.
|
|
This value is reported by the hypervisor for the VM and can differ from `agent.googleapis.com/cpu/usage_time`, which is reported from inside the VM.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.usage_time
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
- uuid: 666cd3e9f21d4ede9d4bcc16bc95347c
|
|
name: 'GCP Compute Engine: CPU utilization'
|
|
type: DEPENDENT
|
|
key: gcp.gce.cpu.utilization
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: |
|
|
Fractional utilization of allocated CPU on this instance.
|
|
This metric is reported by the hypervisor for the VM and can differ from `agent.googleapis.com/cpu/utilization`, which is reported from inside the VM.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.utilization
|
|
- type: MULTIPLIER
|
|
parameters:
|
|
- '100'
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: cpu
|
|
triggers:
|
|
- uuid: fb8e28649b4947e9a11d891e3126a3a1
|
|
expression: 'min(/GCP Compute Engine Instance by HTTP/gcp.gce.cpu.utilization,15m) >= {$GCE.CPU.UTIL.MAX}'
|
|
name: 'GCP Compute Engine: High CPU utilization'
|
|
event_name: 'GCP Compute Engine: High CPU utilization (over {$GCE.CPU.UTIL.MAX}% for 15m)'
|
|
priority: AVERAGE
|
|
description: 'The CPU utilization is too high. The system might be slow to respond.'
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: performance
|
|
- uuid: 4bdd3662247749a69bb59e6643ba7b9a
|
|
name: 'GCP Compute Engine: Disks get'
|
|
type: SCRIPT
|
|
key: gcp.gce.disks.get
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'compute.googleapis.com/instance/disk/',
|
|
base_paths = ['read_ops_count', 'read_bytes_count', 'write_bytes_count', 'write_ops_count'];
|
|
|
|
function checkParams(params) {
|
|
['project_id', 'time_window', 'instance_id', 'token'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
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, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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 params = checkParams(JSON.parse(value)),
|
|
time_window = params.time_window,
|
|
project = project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter instance_id = '" + params.instance_id + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query';
|
|
|
|
var raw = getHttpData(url, params.token, { query: '{' + base_paths.map(function (path) { return base_path + path; }).join(';') + '}' + j_filter }),
|
|
metrics = getField(raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
time_series = getField(raw, 'timeSeriesData'),
|
|
arr = [];
|
|
|
|
for (t in time_series) {
|
|
data = {
|
|
disk_name: getField(time_series[t], 'labelValues.3.stringValue'),
|
|
device_type: getField(time_series[t], 'labelValues.4.stringValue'),
|
|
storage_type: getField(time_series[t], 'labelValues.6.stringValue'),
|
|
metrics: {}
|
|
};
|
|
|
|
for (i in metrics) {
|
|
re = /(^t_\d+\.value(_|\.))/g;
|
|
data['metrics'][getField(metrics[i], 'key').replace(re, '')] = getField(time_series[t], 'pointData.0.values.' + i + '.int64Value');
|
|
}
|
|
arr.push(data);
|
|
}
|
|
return JSON.stringify(arr);
|
|
description: 'Disk entities and metrics related to a particular instance.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: instance_id
|
|
value: '{HOST.HOST}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: e1cd503d86f7487db023e2fd3cea5385
|
|
name: 'GCP Compute Engine: Firewall: Dropped bytes'
|
|
type: DEPENDENT
|
|
key: gcp.gce.firewall.dropped_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Count of incoming bytes dropped by the firewall.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.dropped_bytes_count
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: firewall
|
|
- tag: component
|
|
value: network
|
|
- uuid: 25002706c5164c43a345a8ce594615c7
|
|
name: 'GCP Compute Engine: Firewall: Dropped packets'
|
|
type: DEPENDENT
|
|
key: gcp.gce.firewall.dropped_packets_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Count of incoming packets dropped by the firewall.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.dropped_packets_count
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: firewall
|
|
- tag: component
|
|
value: network
|
|
- uuid: 3f82955d43694b25b1e96c9b8f4f6ffb
|
|
name: 'GCP Compute Engine: Instance state'
|
|
type: HTTP_AGENT
|
|
key: gcp.gce.instance.state
|
|
history: 7d
|
|
description: 'GCP Compute Engine instance state.'
|
|
valuemap:
|
|
name: 'Instance state'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.status
|
|
error_handler: CUSTOM_VALUE
|
|
error_handler_params: '10'
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const idx = [
|
|
'RUNNING',
|
|
'PROVISIONING',
|
|
'STAGING',
|
|
'STOPPING',
|
|
'REPAIRING',
|
|
'TERMINATED',
|
|
'SUSPENDING',
|
|
'SUSPENDED'
|
|
].indexOf(value);
|
|
return idx !== -1 ? idx : 10;
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 10m
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
url: 'https://compute.googleapis.com/compute/v1/projects/{$GCP.PROJECT.ID}/zones/{$GCE.INSTANCE.ZONE}/instances/{HOST.NAME}'
|
|
status_codes: ''
|
|
headers:
|
|
- name: Content-Type
|
|
value: application/json
|
|
- name: Authorization
|
|
value: 'Bearer {$GCP.AUTH.TOKEN}'
|
|
tags:
|
|
- tag: component
|
|
value: status
|
|
triggers:
|
|
- uuid: 96abd48a3e684e1b9b95fdd96d095188
|
|
expression: 'last(/GCP Compute Engine Instance by HTTP/gcp.gce.instance.state) = 10'
|
|
name: 'GCP Compute Engine: Failed to get the instance state'
|
|
priority: AVERAGE
|
|
description: |
|
|
Failed to get the instance state.
|
|
Check access permissions to GCP API or service account.
|
|
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 1223f00a5e4b4bc8aa9e8ec08253c4cc
|
|
expression: 'last(/GCP Compute Engine Instance by HTTP/gcp.gce.instance.state) = 7'
|
|
name: 'GCP Compute Engine: Instance is in suspended state'
|
|
priority: INFO
|
|
description: 'The VM is in a suspended state. You can resume the VM or delete it.'
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- tag: scope
|
|
value: notice
|
|
- uuid: d2144e2277ec458c80d2b948364f1924
|
|
expression: 'last(/GCP Compute Engine Instance by HTTP/gcp.gce.instance.state) = 4'
|
|
name: 'GCP Compute Engine: The instance is in repairing state'
|
|
priority: WARNING
|
|
description: |
|
|
The VM is being repaired.
|
|
Repairing occurs when the VM encounters an internal error or the underlying machine is unavailable due to maintenance.
|
|
During this time, the VM is unusable.
|
|
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 4a010c2b1e6f4ec88dbbe97255b9bac4
|
|
expression: 'last(/GCP Compute Engine Instance by HTTP/gcp.gce.instance.state) = 5'
|
|
name: 'GCP Compute Engine: The instance is in terminated state'
|
|
priority: AVERAGE
|
|
description: 'The VM is stopped. You stopped the VM, or the VM encountered a failure.'
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: f075482578ec475385cdfc57346d1570
|
|
name: 'GCP Compute Engine: Instance uptime'
|
|
type: DEPENDENT
|
|
key: gcp.gce.instance.uptime
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: s
|
|
description: 'Elapsed time since the VM was started, in seconds.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.uptime_total
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: uptime
|
|
- uuid: 744f3f821847473d9cef1236580bda38
|
|
name: 'GCP Compute Engine: Integrity: Early boot validation status'
|
|
type: DEPENDENT
|
|
key: gcp.gce.integrity.early_boot_validation_status
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
The validation status of early boot integrity policy.
|
|
Empty value if integrity monitoring isn't enabled.
|
|
|
|
valuemap:
|
|
name: 'Integrity validation status'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.early_boot_validation_status
|
|
error_handler: DISCARD_VALUE
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const idx = [
|
|
'passed',
|
|
'failed',
|
|
'unknown',
|
|
].indexOf(value);
|
|
return idx !== -1 ? idx : "";
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: security
|
|
- uuid: aa334c3a0faf4f36bcbbf51d87ef9186
|
|
name: 'GCP Compute Engine: Integrity: Late boot validation status'
|
|
type: DEPENDENT
|
|
key: gcp.gce.integrity.late_boot_validation_status
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
The validation status of late boot integrity policy.
|
|
Empty value if integrity monitoring isn't enabled.
|
|
|
|
valuemap:
|
|
name: 'Integrity validation status'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.late_boot_validation_status
|
|
error_handler: DISCARD_VALUE
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const idx = [
|
|
'passed',
|
|
'failed',
|
|
'unknown',
|
|
].indexOf(value);
|
|
return idx !== -1 ? idx : "";
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: security
|
|
- uuid: 1b14fefa6b0f4abc98f6ddf3164074b3
|
|
name: 'GCP Compute Engine: Memory usage percentage'
|
|
type: DEPENDENT
|
|
key: gcp.gce.memory.ram_pused
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
value_type: FLOAT
|
|
units: '%'
|
|
description: |
|
|
Memory usage Percentage.
|
|
This metric is only available for VMs that belong to the e2 family; returns empty value for different instance types.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.ram_pused
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
triggers:
|
|
- uuid: fa918889bcb84d3886254f00f0df288c
|
|
expression: 'min(/GCP Compute Engine Instance by HTTP/gcp.gce.memory.ram_pused,15m) >= {$GCE.RAM.UTIL.MAX}'
|
|
name: 'GCP Compute Engine: High memory utilization'
|
|
event_name: 'GCP Compute Engine: High memory utilization (over {$GCE.RAM.UTIL.MAX}% for 15m)'
|
|
priority: AVERAGE
|
|
description: 'RAM utilization is too high. The system might be slow to respond.'
|
|
tags:
|
|
- tag: scope
|
|
value: performance
|
|
- uuid: 10d63d2c01dc481380bf386af7af7f97
|
|
name: 'GCP Compute Engine: Memory size'
|
|
type: DEPENDENT
|
|
key: gcp.gce.memory.ram_size
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
Total VM memory size.
|
|
This metric is only available for VMs that belong to the e2 family; returns empty value for different instance types.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.ram_size
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 20dc9e49a60d46b4b6d855eb74a60d5e
|
|
name: 'GCP Compute Engine: Memory used'
|
|
type: DEPENDENT
|
|
key: gcp.gce.memory.ram_used
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
Memory currently used in the VM.
|
|
This metric is only available for VMs that belong to the e2 family; returns empty value for different instance types.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.ram_used
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: b043128882254e9492c7436521bf994a
|
|
name: 'GCP Compute Engine: VM swap in'
|
|
type: DEPENDENT
|
|
key: gcp.gce.memory.swap_in_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
The amount of memory read into the guest from its own swap space.
|
|
This metric is only available for VMs that belong to the e2 family; returns empty value for different instance types.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.swap_in_bytes_count
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 7166423bbcf0456ab0fcc7c852d89125
|
|
name: 'GCP Compute Engine: VM swap out'
|
|
type: DEPENDENT
|
|
key: gcp.gce.memory.swap_out_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
The amount of memory written from the guest to its own swap space.
|
|
This metric is only available for VMs that belong to the e2 family; returns empty value for different instance types.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.swap_out_bytes_count
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: memory
|
|
- uuid: 723fbff060ab41a39322bc0d6d8b1f84
|
|
name: 'GCP Compute Engine: Metrics get'
|
|
type: SCRIPT
|
|
key: gcp.gce.metrics.get
|
|
delay: '{$GCP.TIME.WINDOW}'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
params: |
|
|
var base_path = 'compute.googleapis.com/',
|
|
value_types = ['int64Value', 'doubleValue', 'stringValue', 'boolValue'],
|
|
re = /(^t_\d+\.value\.)/g,
|
|
obj = {},
|
|
base_paths = [
|
|
'instance/uptime_total',
|
|
'firewall/dropped_packets_count',
|
|
'firewall/dropped_bytes_count',
|
|
'instance/cpu/guest_visible_vcpus',
|
|
'instance/cpu/reserved_cores',
|
|
'instance/cpu/usage_time',
|
|
'instance/cpu/utilization',
|
|
'mirroring/mirrored_bytes_count',
|
|
'mirroring/mirrored_packets_count'
|
|
],
|
|
e2_paths = [
|
|
'instance/cpu/scheduler_wait_time',
|
|
'instance/memory/balloon/ram_size',
|
|
'instance/memory/balloon/ram_used',
|
|
'instance/memory/balloon/swap_in_bytes_count',
|
|
'instance/memory/balloon/swap_out_bytes_count',
|
|
],
|
|
net_paths = [
|
|
'instance/network/received_packets_count',
|
|
'instance/network/received_bytes_count',
|
|
'instance/network/sent_bytes_count',
|
|
'instance/network/sent_packets_count'
|
|
],
|
|
integrity_paths = [
|
|
'instance/integrity/late_boot_validation_status',
|
|
'instance/integrity/early_boot_validation_status'
|
|
];
|
|
|
|
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 queryMap(array, path, filter) {
|
|
var query_params = '{' + array.map(function (element) { return path + element; }).join(';') + '}';
|
|
return {query: query_params + filter}
|
|
}
|
|
|
|
function checkParams(params) {
|
|
['project_id', 'time_window', 'instance_id', 'token', 'machine_type', 'integrity'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '' || params[field].match(/^\{\$.*\}$/)) {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
if (!params.time_window.match(/^[0-9]+(m|h)$/)) {
|
|
throw 'Incorrect update interval for parameter time_window. Valid ranges 1m-23h.';
|
|
}
|
|
if (params.integrity !== 'true' && params.integrity !== 'false') {
|
|
throw 'Incorrect integrity state definition type. Valid definitions: true/false';
|
|
}
|
|
return params;
|
|
}
|
|
|
|
function getHttpData(url, token, body) {
|
|
var request = new HttpRequest();
|
|
|
|
request.addHeader('Authorization: Bearer ' + token);
|
|
request.addHeader('Content-Type: application/json');
|
|
|
|
var response = request.post(url, JSON.stringify(body));
|
|
|
|
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;
|
|
};
|
|
|
|
function nestedMap(raw) {
|
|
var ids = getField(raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
ltsd = getField(raw, 'timeSeriesData'),
|
|
result = {};
|
|
|
|
for (i in ids) {
|
|
var id = getField(ids[i], 'key').replace(re, '');
|
|
result[id] = {};
|
|
for (t in ltsd) {
|
|
for (v in value_types) {
|
|
if (getFieldBool(ltsd[t], 'pointData.0.values.' + [i] + '.' + [value_types[v]])) {
|
|
['stringValue', 'boolValue'].forEach(function (type) {
|
|
if (getFieldBool(ltsd[t], 'labelValues.4.' + [type])) {
|
|
result[id][ltsd[t].labelValues[4][type]] = ltsd[t].pointData[0].values[i][value_types[v]];
|
|
}
|
|
});
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
var params = checkParams(JSON.parse(value));
|
|
|
|
if (params.machine_type.match(/e2.*/)) {
|
|
base_paths = base_paths.concat(e2_paths);
|
|
}
|
|
|
|
var time_window = params.time_window,
|
|
project = params.project_id,
|
|
filter = ' | within ' + time_window + " | filter instance_id = '" + params.instance_id + "'",
|
|
j_filter = filter + ' | join',
|
|
url = 'https://monitoring.googleapis.com/v3/projects/' + project + '/timeSeries:query';
|
|
|
|
var raw = getHttpData(url, params.token, queryMap(base_paths, base_path, j_filter)),
|
|
keys = getField(raw, 'timeSeriesDescriptor.pointDescriptors'),
|
|
values = getField(raw, 'timeSeriesData.0.pointData.0.values');
|
|
|
|
for (i in keys) {
|
|
for (v in value_types) {
|
|
if (typeof values[i][value_types[v]] !== 'undefined') {
|
|
obj[getField(keys[i], 'key').replace(re, '')] = values[i][value_types[v]];
|
|
}
|
|
}
|
|
}
|
|
|
|
if (params.machine_type.match(/e2.*/)) {
|
|
obj.ram_pused = Math.floor((getField(obj,'ram_used') / getField(obj,'ram_size')) * 100);
|
|
}
|
|
|
|
var mirr_raw = getHttpData(url, params.token, { query: base_path + 'mirroring/dropped_packets_count' + filter }),
|
|
tsd = getField(mirr_raw, 'timeSeriesData');
|
|
|
|
for (t in tsd) {
|
|
for (v in value_types) {
|
|
if (getFieldBool(tsd[t], 'pointData.0.values.0.' + [value_types[v]])) {
|
|
obj[getField(tsd[t], 'labelValues.3.stringValue')] = getField(tsd[t], 'pointData.0.values.0.' + [value_types[v]]);
|
|
}
|
|
}
|
|
}
|
|
|
|
var net_metrics = getHttpData(url, params.token, queryMap(net_paths, base_path, j_filter));
|
|
|
|
Object.assign(obj, nestedMap(net_metrics));
|
|
|
|
if (params.integrity === 'true') {
|
|
integrity_metrics = getHttpData(url, params.token, queryMap(integrity_paths, base_path, j_filter));
|
|
|
|
var keys = getField(integrity_metrics, 'timeSeriesDescriptor.pointDescriptors'),
|
|
tsd = getField(integrity_metrics, 'timeSeriesData');
|
|
|
|
for (i in keys) {
|
|
var key = getField(keys[i], 'key').replace(re, '');
|
|
|
|
obj[key] = 'undefined';
|
|
for (t in tsd) {
|
|
if (getField(tsd[t], 'pointData.0.values.' + i + '.int64Value') == 1) {
|
|
obj[key] = getField(tsd[t], 'labelValues.4.stringValue');
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return JSON.stringify(obj);
|
|
description: 'GCP Compute Engine metrics get in raw format.'
|
|
preprocessing:
|
|
- type: CHECK_NOT_SUPPORTED
|
|
parameters:
|
|
- ''
|
|
timeout: '{$GCP.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: project_id
|
|
value: '{$GCP.PROJECT.ID}'
|
|
- name: time_window
|
|
value: '{$GCP.TIME.WINDOW}'
|
|
- name: instance_id
|
|
value: '{HOST.HOST}'
|
|
- name: token
|
|
value: '{$GCP.AUTH.TOKEN}'
|
|
- name: machine_type
|
|
value: '{$GCE.MACHINE.TYPE}'
|
|
- name: integrity
|
|
value: '{$GCE.INTEGRITY.STATE}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: faf1c3ccbcc24b9eb52be355f2f782e6
|
|
name: 'GCP Compute Engine: Network: Received bytes'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.lb.received_bytes_count.false
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Count of bytes received from the network without load-balancing.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.received_bytes_count.false
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 91ef1b33d7ae479999302cdec227eb3e
|
|
name: 'GCP Compute Engine: Network: Received bytes: Load-balanced'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.lb.received_bytes_count.true
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
Whether traffic was received by an L3 loadbalanced IP address assigned to the VM.
|
|
Traffic that is externally routed to the VM's standard internal or external IP address, such as L7 loadbalanced traffic, is not considered to be loadbalanced in this metric.
|
|
The value is empty when load-balancing is not used.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.received_bytes_count.true
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 84dec0cb32ea434a9d6f29f402d337a0
|
|
name: 'GCP Compute Engine: Network: Received packets'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.lb.received_packets_count.false
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Count of packets received from the network without load-balancing.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.received_packets_count.false
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 148fe8aaa01e4863bbe2ca4c0226ce80
|
|
name: 'GCP Compute Engine: Network: Received packets: Load-balanced'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.lb.received_packets_count.true
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Whether traffic was received by an L3 loadbalanced IP address assigned to the VM.
|
|
Traffic that is externally routed to the VM's standard internal or external IP address, such as L7 loadbalanced traffic, is not considered to be loadbalanced in this metric.
|
|
The value is empty when load-balancing is not used.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.received_packets_count.true
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: b8ea22b00a254ee5a2484fd833421b12
|
|
name: 'GCP Compute Engine: Network: Sent bytes'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.lb.sent_bytes_count.false
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Count of bytes sent over the network without load-balancing.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.sent_bytes_count.false
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 77bd252194764837bc71b031e4d7e2b8
|
|
name: 'GCP Compute Engine: Network: Sent bytes: Load-balanced'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.lb.sent_bytes_count.true
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: |
|
|
Whether traffic was received by an L3 loadbalanced IP address assigned to the VM.
|
|
Traffic that is externally routed to the VM's standard internal or external IP address, such as L7 loadbalanced traffic, is not considered to be loadbalanced in this metric.
|
|
The value is empty when load-balancing is not used.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.sent_bytes_count.true
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 44032903b7da4d72b2dff35e81e787d3
|
|
name: 'GCP Compute Engine: Network: Sent packets'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.lb.sent_packets_count.false
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Count of packets sent over the network without load-balancing.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.sent_packets_count.false
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 2aef5ad0f3704550b4920ce36614b52d
|
|
name: 'GCP Compute Engine: Network: Sent packets: Load-balanced'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.lb.sent_packets_count.true
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
Whether traffic was received by an L3 loadbalanced IP address assigned to the VM.
|
|
Traffic that is externally routed to the VM's standard internal or external IP address, such as L7 loadbalanced traffic, is not considered to be loadbalanced in this metric.
|
|
The value is empty when load-balancing is not used.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.sent_packets_count.true
|
|
error_handler: DISCARD_VALUE
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 199fb1f4278848138ef8cfd8fc3e07ee
|
|
name: 'GCP Compute Engine: Network: Mirrored bytes'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.mirrored_bytes_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'The count of mirrored bytes.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mirrored_bytes_count
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: f0add3d3853d4d8c9993b1603fd7b542
|
|
name: 'GCP Compute Engine: Network: Mirrored packets'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.mirrored_packets_count
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'The count of mirrored packets.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.mirrored_packets_count
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 6ca64c0fa39e4587a2987cd607058b54
|
|
name: 'GCP Compute Engine: Network: Mirrored packets dropped: Invalid'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.mirr_dropped_packets.invalid
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
The count of mirrored packets dropped.
|
|
Reason - invalid.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.invalid
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 3cf438aa0225428385d30c5be30ea3e6
|
|
name: 'GCP Compute Engine: Network: Mirrored packets dropped: Out of quota'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.mirr_dropped_packets.out_of_quota
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
The count of mirrored packets dropped.
|
|
Reason - out of quota.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.out_of_quota
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
- uuid: 5303badcf26641f1af85366fbaecdd77
|
|
name: 'GCP Compute Engine: Network: Mirrored packets dropped: Unknown'
|
|
type: DEPENDENT
|
|
key: gcp.gce.network.mirr_dropped_packets.unknown
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: |
|
|
The count of mirrored packets dropped.
|
|
Reason - unknown.
|
|
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.unknown
|
|
master_item:
|
|
key: gcp.gce.metrics.get
|
|
tags:
|
|
- tag: component
|
|
value: network
|
|
- tag: component
|
|
value: traffic
|
|
discovery_rules:
|
|
- uuid: 260e06bfe28e46f4a726dd4a6d7fa523
|
|
name: 'GCP Compute Engine: Physical disks discovery'
|
|
type: DEPENDENT
|
|
key: gcp.gce.phys.disks.discovery
|
|
delay: '0'
|
|
filter:
|
|
evaltype: AND
|
|
conditions:
|
|
- macro: '{#GCE.DISK.NAME}'
|
|
value: '{$GCE.DISK.NAME.MATCHES}'
|
|
formulaid: C
|
|
- macro: '{#GCE.DISK.NAME}'
|
|
value: '{$GCE.DISK.NAME.NOT_MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: D
|
|
- macro: '{#GCE.DISK.DEV_TYPE}'
|
|
value: '{$GCE.DISK.DEV_TYPE.MATCHES}'
|
|
formulaid: A
|
|
- macro: '{#GCE.DISK.DEV_TYPE}'
|
|
value: '{$GCE.DISK.DEV_TYPE.NOT_MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: B
|
|
- macro: '{#GCE.DISK.STOR_TYPE}'
|
|
value: '{$GCE.DISK.STOR_TYPE.MATCHES}'
|
|
formulaid: E
|
|
- macro: '{#GCE.DISK.STOR_TYPE}'
|
|
value: '{$GCE.DISK.STOR_TYPE.NOT_MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: F
|
|
lifetime: 7d
|
|
description: 'GCP Compute Engine: Physical disks discovery.'
|
|
item_prototypes:
|
|
- uuid: dda10a0535c04fdb92092efeff020b2c
|
|
name: 'GCP Compute Engine: Disk [{#GCE.DISK.NAME}]: Read bytes'
|
|
type: DEPENDENT
|
|
key: 'gcp.gce.disk.read_bytes_count[{#GCE.DISK.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Count of bytes read from [{#GCE.DISK.NAME}] disk.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.read_bytes_count
|
|
master_item:
|
|
key: 'gcp.gce.quota.single.raw[{#GCE.DISK.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- tag: device-type
|
|
value: '{#GCE.DISK.DEV_TYPE}'
|
|
- tag: disk
|
|
value: '{#GCE.DISK.NAME}'
|
|
- tag: storage-type
|
|
value: '{#GCE.DISK.STOR_TYPE}'
|
|
- uuid: e166d3dfeb404111bcd143415070a0af
|
|
name: 'GCP Compute Engine: Disk [{#GCE.DISK.NAME}]: Read operations'
|
|
type: DEPENDENT
|
|
key: 'gcp.gce.disk.read_ops_count[{#GCE.DISK.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Count of read IO operations from [{#GCE.DISK.NAME}] disk.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.read_ops_count
|
|
master_item:
|
|
key: 'gcp.gce.quota.single.raw[{#GCE.DISK.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- tag: device-type
|
|
value: '{#GCE.DISK.DEV_TYPE}'
|
|
- tag: disk
|
|
value: '{#GCE.DISK.NAME}'
|
|
- tag: storage-type
|
|
value: '{#GCE.DISK.STOR_TYPE}'
|
|
- uuid: cf21b2bf6dc74ed28bc55a2c567b3dae
|
|
name: 'GCP Compute Engine: Disk [{#GCE.DISK.NAME}]: Write bytes'
|
|
type: DEPENDENT
|
|
key: 'gcp.gce.disk.write_bytes_count[{#GCE.DISK.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
units: B
|
|
description: 'Count of bytes written to {#GCE.DISK.NAME}] disk.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.write_bytes_count
|
|
master_item:
|
|
key: 'gcp.gce.quota.single.raw[{#GCE.DISK.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- tag: device-type
|
|
value: '{#GCE.DISK.DEV_TYPE}'
|
|
- tag: disk
|
|
value: '{#GCE.DISK.NAME}'
|
|
- tag: storage-type
|
|
value: '{#GCE.DISK.STOR_TYPE}'
|
|
- uuid: 602255b7df004129b5a3e0e1d2fba920
|
|
name: 'GCP Compute Engine: Disk [{#GCE.DISK.NAME}]: Write operations'
|
|
type: DEPENDENT
|
|
key: 'gcp.gce.disk.write_ops_count[{#GCE.DISK.NAME}]'
|
|
delay: '0'
|
|
history: 7d
|
|
trends: 90d
|
|
description: 'Count of write IO operations to [{#GCE.DISK.NAME}] disk.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.write_ops_count
|
|
master_item:
|
|
key: 'gcp.gce.quota.single.raw[{#GCE.DISK.NAME}]'
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- tag: device-type
|
|
value: '{#GCE.DISK.DEV_TYPE}'
|
|
- tag: disk
|
|
value: '{#GCE.DISK.NAME}'
|
|
- tag: storage-type
|
|
value: '{#GCE.DISK.STOR_TYPE}'
|
|
- uuid: 7fc27a6630664e2fbac8fe64ac40985a
|
|
name: 'GCP Compute Engine: Disk [{#GCE.DISK.NAME}]: Raw data'
|
|
type: DEPENDENT
|
|
key: 'gcp.gce.quota.single.raw[{#GCE.DISK.NAME}]'
|
|
delay: '0'
|
|
history: '0'
|
|
trends: '0'
|
|
value_type: TEXT
|
|
description: 'Data in raw format for the disk with the name [{#GCE.DISK.NAME}].'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$[?(@.disk_name == "{#GCE.DISK.NAME}")].metrics.first()'
|
|
master_item:
|
|
key: gcp.gce.disks.get
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- tag: component
|
|
value: storage
|
|
- tag: disk
|
|
value: '{#GCE.DISK.NAME}'
|
|
graph_prototypes:
|
|
- uuid: 9af0456af3d74041b678ceeccbc036fc
|
|
name: 'GCP Compute Engine: Disk [{#GCE.DISK.NAME}]: Read/Write bytes'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: 'gcp.gce.disk.read_bytes_count[{#GCE.DISK.NAME}]'
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: 'gcp.gce.disk.write_bytes_count[{#GCE.DISK.NAME}]'
|
|
- uuid: 542185ffc8b3485f8955b63c46a50b83
|
|
name: 'GCP Compute Engine: Disk [{#GCE.DISK.NAME}]: Read/Write operations'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: 'gcp.gce.disk.read_ops_count[{#GCE.DISK.NAME}]'
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: 'gcp.gce.disk.write_ops_count[{#GCE.DISK.NAME}]'
|
|
master_item:
|
|
key: gcp.gce.disks.get
|
|
lld_macro_paths:
|
|
- lld_macro: '{#GCE.DISK.NAME}'
|
|
path: $.disk_name
|
|
- lld_macro: '{#GCE.DISK.DEV_TYPE}'
|
|
path: $.device_type
|
|
- lld_macro: '{#GCE.DISK.STOR_TYPE}'
|
|
path: $.storage_type
|
|
preprocessing:
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 3h
|
|
tags:
|
|
- tag: class
|
|
value: cloud
|
|
- tag: target
|
|
value: compute-engine
|
|
- tag: target
|
|
value: gce
|
|
- tag: target
|
|
value: gcp
|
|
- tag: target
|
|
value: google-cloud-platform
|
|
macros:
|
|
- macro: '{$GCE.CPU.UTIL.MAX}'
|
|
value: '95'
|
|
description: 'GCP Compute Engine instance CPU utilization threshold.'
|
|
- macro: '{$GCE.DISK.DEV_TYPE.MATCHES}'
|
|
value: '.*'
|
|
description: 'The filter to include GCP Compute Engine disks by device type.'
|
|
- macro: '{$GCE.DISK.DEV_TYPE.NOT_MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'The filter to exclude GCP Compute Engine disks by device type.'
|
|
- macro: '{$GCE.DISK.NAME.MATCHES}'
|
|
value: '.*'
|
|
description: 'The filter to include GCP Compute Engine disks by namespace.'
|
|
- macro: '{$GCE.DISK.NAME.NOT_MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'The filter to exclude GCP Compute Engine disks by namespace.'
|
|
- macro: '{$GCE.DISK.STOR_TYPE.MATCHES}'
|
|
value: '.*'
|
|
description: 'The filter to include GCP Compute Engine disks by storage type.'
|
|
- macro: '{$GCE.DISK.STOR_TYPE.NOT_MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'The filter to exclude GCP Compute Engine disks by storage type.'
|
|
- macro: '{$GCE.RAM.UTIL.MAX}'
|
|
value: '90'
|
|
description: 'GCP Compute Engine instance RAM utilization threshold.'
|
|
- macro: '{$GCP.DATA.TIMEOUT}'
|
|
value: 15s
|
|
description: 'A response timeout for an API.'
|
|
- macro: '{$GCP.TIME.WINDOW}'
|
|
value: 5m
|
|
description: |
|
|
Time interval for the data requests.
|
|
Supported usage type:
|
|
1. The default update interval for most of the items.
|
|
2. The minimal time window for the data requested in the Monitoring Query Language REST API request.
|
|
|
|
dashboards:
|
|
- uuid: b8b09f6833ec4ea78c4ac7d15cdb0cc5
|
|
name: Hardware
|
|
pages:
|
|
- name: Hardware
|
|
widgets:
|
|
- type: graph
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
name: 'GCP Compute Engine: CPU usage'
|
|
- type: graph
|
|
x: '12'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.cpu.utilization
|
|
- type: graph
|
|
'y': '5'
|
|
width: '8'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
name: 'GCP Compute Engine: Memory usage'
|
|
- type: graph
|
|
x: '8'
|
|
'y': '5'
|
|
width: '8'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '1'
|
|
- type: ITEM
|
|
name: itemid
|
|
value:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.memory.ram_pused
|
|
- type: graph
|
|
x: '16'
|
|
'y': '5'
|
|
width: '8'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
name: 'GCP Compute Engine: Memory swapping'
|
|
- type: graphprototype
|
|
'y': '10'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: columns
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: rows
|
|
value: '1'
|
|
- type: GRAPH_PROTOTYPE
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
name: 'GCP Compute Engine: Disk [{#GCE.DISK.NAME}]: Read/Write bytes'
|
|
- type: graphprototype
|
|
x: '12'
|
|
'y': '10'
|
|
width: '12'
|
|
height: '5'
|
|
fields:
|
|
- type: INTEGER
|
|
name: columns
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: rows
|
|
value: '1'
|
|
- type: GRAPH_PROTOTYPE
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
name: 'GCP Compute Engine: Disk [{#GCE.DISK.NAME}]: Read/Write operations'
|
|
- type: graph
|
|
'y': '15'
|
|
width: '24'
|
|
height: '5'
|
|
fields:
|
|
- type: GRAPH
|
|
name: graphid
|
|
value:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
name: 'GCP Compute Engine: Network traffic'
|
|
valuemaps:
|
|
- uuid: d5f19327f8b74b44a40950d9d4f9410f
|
|
name: 'Instance state'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Running
|
|
- value: '1'
|
|
newvalue: Provisioning
|
|
- value: '2'
|
|
newvalue: Staging
|
|
- value: '3'
|
|
newvalue: Stopping
|
|
- value: '4'
|
|
newvalue: Repairing
|
|
- value: '5'
|
|
newvalue: Terminated
|
|
- value: '6'
|
|
newvalue: Suspending
|
|
- value: '7'
|
|
newvalue: Suspended
|
|
- value: '10'
|
|
newvalue: 'Data retrievement error'
|
|
- uuid: 1e17bce361f9486dae764fc195561703
|
|
name: 'Integrity validation status'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Passed
|
|
- value: '1'
|
|
newvalue: Failed
|
|
- value: '2'
|
|
newvalue: Unknown
|
|
graphs:
|
|
- uuid: 1ff7d04868284c07829382c44301fe0e
|
|
name: 'GCP Cloud SQL MSSQL: Disk read/write operations'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.disk.read_ops_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.disk.write_ops_count
|
|
- uuid: 0ef4b456168d4ecd87c3dc68092c673d
|
|
name: 'GCP Cloud SQL MSSQL: Disk usage'
|
|
graph_items:
|
|
- drawtype: BOLD_LINE
|
|
color: 199C0D
|
|
calc_fnc: MIN
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.disk.quota
|
|
- sortorder: '1'
|
|
drawtype: GRADIENT_LINE
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.disk.bytes_used
|
|
- uuid: 09b009aa17f1410bb926043b4c7c39e4
|
|
name: 'GCP Cloud SQL MSSQL: Memory Read/Writes'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.memory.page_ops.read
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.memory.page_ops.write
|
|
- uuid: 3273bee668e84b26911307ea4c1f620f
|
|
name: 'GCP Cloud SQL MSSQL: Memory usage'
|
|
graph_items:
|
|
- drawtype: BOLD_LINE
|
|
color: 199C0D
|
|
calc_fnc: MIN
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.memory.quota
|
|
- sortorder: '1'
|
|
drawtype: GRADIENT_LINE
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.memory.usage
|
|
- uuid: 4d5afffa67804f4da73474d2ee26bd5d
|
|
name: 'GCP Cloud SQL MSSQL: Memory workflow'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.memory.checkpoint_page_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.memory.free_list_stall_count
|
|
- sortorder: '2'
|
|
color: 00611C
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.memory.lazy_write_count
|
|
- sortorder: '3'
|
|
color: F7941D
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.memory.memory_grants_pending
|
|
- uuid: 558283815ab2414f8da6387724a784a3
|
|
name: 'GCP Cloud SQL MSSQL: Network traffic'
|
|
type: STACKED
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.network.received_bytes_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.network.sent_bytes_count
|
|
- uuid: 0bfd3e8be20c4b5a88b23f16aff4eb82
|
|
name: 'GCP Cloud SQL MSSQL: Replication data'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL Replica by HTTP'
|
|
key: gcp.cloudsql.mssql.repl.bytes_sent_to_replica_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL Replica by HTTP'
|
|
key: gcp.cloudsql.mssql.repl.log_bytes_received_count
|
|
- sortorder: '2'
|
|
color: 00611C
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL Replica by HTTP'
|
|
key: gcp.cloudsql.mssql.repl.redone_bytes_count
|
|
- uuid: 922d35bf685b473ca9848a9b9e7e34c3
|
|
name: 'GCP Cloud SQL MSSQL: Transactions'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.trans.batch_request_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.trans.forwarded_record_count
|
|
- sortorder: '2'
|
|
color: 00611C
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.trans.full_scan_count
|
|
- sortorder: '3'
|
|
color: F7941D
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.trans.page_split_count
|
|
- sortorder: '4'
|
|
color: FC6EA3
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.trans.probe_scan_count
|
|
- sortorder: '5'
|
|
color: 6C59DC
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.trans.sql_compilation_count
|
|
- sortorder: '6'
|
|
color: C7A72D
|
|
item:
|
|
host: 'GCP Cloud SQL MSSQL by HTTP'
|
|
key: gcp.cloudsql.mssql.trans.sql_recompilation_count
|
|
- uuid: 935c2f388185469f82100541d9efb2c7
|
|
name: 'GCP Cloud SQL MySQL: Disk read/write operations'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.disk.read_ops_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.disk.write_ops_count
|
|
- uuid: 1b0ea2b38fe740b197ecbcfdd7464b02
|
|
name: 'GCP Cloud SQL MySQL: Disk usage'
|
|
graph_items:
|
|
- drawtype: BOLD_LINE
|
|
color: 199C0D
|
|
calc_fnc: MIN
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.disk.quota
|
|
- sortorder: '1'
|
|
drawtype: GRADIENT_LINE
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.disk.bytes_used
|
|
- uuid: e94b7e8241b544e2beb4ea95db3e139f
|
|
name: 'GCP Cloud SQL MySQL: Lags'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL Replica by HTTP'
|
|
key: gcp.cloudsql.mysql.repl.network_lag
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL Replica by HTTP'
|
|
key: gcp.cloudsql.mysql.repl.replica_lag
|
|
- uuid: 4378be58ccff4592a1b54838b90e9ea8
|
|
name: 'GCP Cloud SQL MySQL: Memory usage'
|
|
graph_items:
|
|
- drawtype: BOLD_LINE
|
|
color: 199C0D
|
|
calc_fnc: MIN
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.memory.quota
|
|
- sortorder: '1'
|
|
drawtype: GRADIENT_LINE
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.memory.usage
|
|
- uuid: c23964e5e54541ccb3c8b7b5f5a4b24d
|
|
name: 'GCP Cloud SQL MySQL: Network traffic'
|
|
type: STACKED
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.network.received_bytes_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.network.sent_bytes_count
|
|
- uuid: e680755183ec4927893e03f8d83bc0f2
|
|
name: 'GCP Cloud SQL MySQL: pages'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.innodb_buffer_pool_pages_free
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.innodb_buffer_pool_pages_dirty
|
|
- sortorder: '2'
|
|
color: 00611C
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.innodb_buffer_pool_pages_total
|
|
- sortorder: '3'
|
|
color: F7941D
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.innodb_pages_read
|
|
- sortorder: '4'
|
|
color: FC6EA3
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.mysql.innodb_pages_written
|
|
- uuid: e447dd13336446b1a965e92d7ddeaf96
|
|
name: 'GCP Cloud SQL MySQL: Queries'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.queries
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL MySQL by HTTP'
|
|
key: gcp.cloudsql.questions
|
|
- uuid: e2e4ef0a2c1a43d68ae9f4ee881f070e
|
|
name: 'GCP Cloud SQL PostgreSQL: Disk read/write operations'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.disk.read_ops_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.disk.write_ops_count
|
|
- uuid: 707d5cca2ba349f18088d00ef7657eef
|
|
name: 'GCP Cloud SQL PostgreSQL: Disk usage'
|
|
graph_items:
|
|
- drawtype: BOLD_LINE
|
|
color: 199C0D
|
|
calc_fnc: MIN
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.disk.quota
|
|
- sortorder: '1'
|
|
drawtype: GRADIENT_LINE
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.disk.bytes_used
|
|
- uuid: 30fe61bafae64ae6b29dacd68e9a6b3b
|
|
name: 'GCP Cloud SQL PostgreSQL: Lags'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
key: gcp.cloudsql.pgsql.repl.network_lag
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
key: gcp.cloudsql.pgsql.repl.replica_lag
|
|
- sortorder: '2'
|
|
color: 00611C
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
key: gcp.cloudsql.pgsql.repl.flush_location
|
|
- sortorder: '3'
|
|
color: F7941D
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
key: gcp.cloudsql.pgsql.repl.replay_location
|
|
- sortorder: '4'
|
|
color: FC6EA3
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
key: gcp.cloudsql.pgsql.repl.sent_location
|
|
- sortorder: '5'
|
|
color: 6C59DC
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
key: gcp.cloudsql.pgsql.repl.write_location
|
|
- uuid: 897843c1fef540c2ab033c9bad0e9de1
|
|
name: 'GCP Cloud SQL PostgreSQL: Memory usage'
|
|
graph_items:
|
|
- drawtype: BOLD_LINE
|
|
color: 199C0D
|
|
calc_fnc: MIN
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.memory.quota
|
|
- sortorder: '1'
|
|
drawtype: GRADIENT_LINE
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.memory.usage
|
|
- uuid: 8a61208f44c94cf5bfcb851c4de6412a
|
|
name: 'GCP Cloud SQL PostgreSQL: Network traffic'
|
|
type: STACKED
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.network.received_bytes_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.network.sent_bytes_count
|
|
- uuid: bf09992b7f324703b3d51250e47d37f4
|
|
name: 'GCP Cloud SQL PostgreSQL: Transaction age'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.oldest_transaction.prepared
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.oldest_transaction.replication_slot
|
|
- sortorder: '2'
|
|
color: 00611C
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.oldest_transaction.replica
|
|
- sortorder: '3'
|
|
color: F7941D
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.oldest_transaction.running
|
|
- uuid: 5c567b9d1ef14fcb93eef332fccbe198
|
|
name: 'GCP Cloud SQL PostgreSQL: Transactions count'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.transaction_id_count_assigned
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL by HTTP'
|
|
key: gcp.cloudsql.pgsql.transaction_id_count_frozen
|
|
- uuid: e96be84efaf7445fbfd8cf707b585fe7
|
|
name: 'GCP Cloud SQL PostgreSQL: WAL archiving'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
key: gcp.cloudsql.pgsql.repl.log_archive_failure_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Cloud SQL PostgreSQL Replica by HTTP'
|
|
key: gcp.cloudsql.pgsql.repl.log_archive_success_count
|
|
- uuid: aa6edbd13ec74ee4b30de2c68823e6aa
|
|
name: 'GCP Compute Engine: CPU usage'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.cpu.scheduler_wait_time
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.cpu.usage_time
|
|
- uuid: a87f4b9849e34f96b7026f4abc8499a1
|
|
name: 'GCP Compute Engine: Memory swapping'
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.memory.swap_in_bytes_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.memory.swap_out_bytes_count
|
|
- uuid: 5aef2c89a0fa41cd889d87a618cc10bd
|
|
name: 'GCP Compute Engine: Memory usage'
|
|
graph_items:
|
|
- drawtype: BOLD_LINE
|
|
color: 199C0D
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.memory.ram_size
|
|
- sortorder: '1'
|
|
drawtype: GRADIENT_LINE
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.memory.ram_used
|
|
- uuid: c1c8ebb71d9542ea8b59cef775a6bd65
|
|
name: 'GCP Compute Engine: Network traffic'
|
|
type: STACKED
|
|
graph_items:
|
|
- color: 199C0D
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.firewall.dropped_bytes_count
|
|
- sortorder: '1'
|
|
color: F63100
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.network.lb.received_bytes_count.false
|
|
- sortorder: '2'
|
|
color: 00611C
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.network.lb.received_bytes_count.true
|
|
- sortorder: '3'
|
|
color: F7941D
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.network.lb.sent_bytes_count.false
|
|
- sortorder: '4'
|
|
color: FC6EA3
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.network.lb.sent_bytes_count.true
|
|
- sortorder: '5'
|
|
color: 6C59DC
|
|
item:
|
|
host: 'GCP Compute Engine Instance by HTTP'
|
|
key: gcp.gce.network.mirrored_bytes_count
|