1005 lines
41 KiB
YAML
1005 lines
41 KiB
YAML
zabbix_export:
|
|
version: '7.0'
|
|
template_groups:
|
|
- uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
|
|
name: Templates/Applications
|
|
host_groups:
|
|
- uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
|
|
name: Applications
|
|
templates:
|
|
- uuid: 0bb43a48a33f48ad910441384486edb4
|
|
template: 'Nutanix Prism Element by HTTP'
|
|
name: 'Nutanix Prism Element by HTTP'
|
|
description: |
|
|
Prism Element: It is a service already built into the platform for every Nutanix cluster deployed. It provides the ability to fully configure, manage, and monitor Nutanix clusters running any hypervisors, however, it only manages the cluster it is part of.
|
|
|
|
This template is designed for the effortless deployment of Nutanix Prism Element monitoring and doesn't require any external scripts.
|
|
|
|
The templates "Nutanix Host Prism Element by HTTP" and "Nutanix Cluster Prism Element by HTTP" can be used in discovery, as well as manually linked to a host.
|
|
|
|
More details can be found in the official documentation:
|
|
- on the Nutanix Prism Element REST API: https://www.nutanix.dev/api_reference/apis/prism_v2.html
|
|
- on the differences between Nutanix API versions: https://www.nutanix.dev/api-versions/
|
|
- on the differences between Nutanix Prism Element REST API and Nutanix Prism Central REST API: https://next.nutanix.com/how-it-works-22/differences-between-prism-element-prism-central-and-prism-pro-37137
|
|
|
|
Generated by official Zabbix template tool "Templator"
|
|
vendor:
|
|
name: Zabbix
|
|
version: 7.0-3
|
|
groups:
|
|
- name: Templates/Applications
|
|
items:
|
|
- uuid: 0c073836f90a4072be7acfc5d1a96b9e
|
|
name: 'Get cluster'
|
|
type: SCRIPT
|
|
key: nutanix.cluster.get
|
|
delay: 10m
|
|
history: '0'
|
|
value_type: TEXT
|
|
trends: '0'
|
|
params: |
|
|
const CTlsConfig = function (raw_value) {
|
|
raw_value = String(raw_value).trim().toLowerCase();
|
|
|
|
if (['none', 'peer', 'full'].indexOf(raw_value) === -1) {
|
|
raw_value = 'full';
|
|
}
|
|
|
|
this.options = {
|
|
SSLVerifyPeer: (raw_value === 'peer' || raw_value === 'full'),
|
|
SSLVerifyHost: (raw_value === 'full')
|
|
};
|
|
|
|
this.enabled = (raw_value !== 'none');
|
|
|
|
this.checkURL = function (url) {
|
|
if (this.enabled && !/^https:\/\//i.test(url)) {
|
|
throw 'TLS certificate verification is enabled by {$' + 'HTTP.TLS.VERIFY}, but the URL uses plain HTTP: ' + url +
|
|
'. Use an "https://" URL, or set {$' + 'HTTP.TLS.VERIFY} to `none` to disable verification.';
|
|
}
|
|
|
|
return url;
|
|
};
|
|
}
|
|
|
|
|
|
var Nutanix = {
|
|
params: {},
|
|
|
|
setParams: function (requiredParams, allParams) {
|
|
requiredParams.forEach(function (field) {
|
|
if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
|
|
Nutanix.params = allParams;
|
|
Nutanix.tls = new CTlsConfig(allParams.tls_verify);
|
|
},
|
|
|
|
request: function (url) {
|
|
|
|
var request = new HttpRequest(Nutanix.tls.options);
|
|
|
|
if (typeof Nutanix.params.proxy !== 'undefined' && Nutanix.params.proxy !== '') {
|
|
request.setProxy(Nutanix.params.proxy);
|
|
}
|
|
|
|
request.setHttpAuth(HTTPAUTH_BASIC, Nutanix.params.username, Nutanix.params.password);
|
|
|
|
Zabbix.log(4, '[ Nutanix ] Sending request: ' + url);
|
|
|
|
const response = request.get(url);
|
|
|
|
Zabbix.log(4, '[ Nutanix ] Received response with status code ' + request.getStatus() + ': ' + response);
|
|
|
|
if (request.getStatus() < 200 || request.getStatus() >= 300) {
|
|
throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
|
|
}
|
|
|
|
try {
|
|
response = JSON.parse(response);
|
|
}
|
|
catch (error) {
|
|
throw 'Failed to parse response received from Nutanix PRISM API. Check debug log for more information.';
|
|
}
|
|
|
|
return response;
|
|
},
|
|
|
|
deduplicateAlerts: function (full_data) {
|
|
const severity_mapping = [
|
|
'kinfo',
|
|
'kwarning',
|
|
'kcritical'
|
|
]
|
|
|
|
var output_data = {};
|
|
for (var entity in full_data.entities) {
|
|
|
|
if (Nutanix.params.api_method === 'clusters') {
|
|
if (result.entities[entity].node_uuid.split('-').length == 5) continue;
|
|
}
|
|
|
|
var severity = severity_mapping.indexOf(full_data.entities[entity].severity.toLowerCase()),
|
|
message = full_data.entities[entity].message,
|
|
title = full_data.entities[entity].alert_title;
|
|
|
|
full_data.entities[entity].context_types.forEach(function(context, index) {
|
|
message = message.replace('{' + context + '}', full_data.entities[entity].context_values[index]);
|
|
title = title.replace('{' + context + '}', full_data.entities[entity].context_values[index]);
|
|
});
|
|
|
|
key = md5(title + message);
|
|
if (key in output_data) {
|
|
if (full_data.entities[entity].created_time_stamp_in_usecs > output_data[key].created) {
|
|
output_data[key].created = full_data.entities[entity].created_time_stamp_in_usecs;
|
|
output_data[key].severity = severity !== -1 ? severity : 3;
|
|
output_data[key].state = full_data.entities[entity].resolved ? 0 : 1;
|
|
output_data[key].message = full_data.entities[entity].detailed_message != '' ? full_data.entities[entity].detailed_message : message;
|
|
output_data[key].last_id = full_data.entities[entity].id;
|
|
}
|
|
output_data[key].count += 1;
|
|
} else {
|
|
output_data[key] = {
|
|
"name": title + ' - ' + message,
|
|
"title": title != '' ? title : message,
|
|
"created": full_data.entities[entity].created_time_stamp_in_usecs,
|
|
"severity": severity !== -1 ? severity : 3,
|
|
"state": full_data.entities[entity].resolved ? 0 : 1,
|
|
"message": full_data.entities[entity].detailed_message != '' ? full_data.entities[entity].detailed_message : message,
|
|
"last_id": full_data.entities[entity].id,
|
|
"count": 1
|
|
}
|
|
}
|
|
}
|
|
|
|
return output_data;
|
|
},
|
|
|
|
cleanUnsupported: function (full_stat) {
|
|
var output_stat = {};
|
|
for (var element in full_stat) {
|
|
if (full_stat[element] !== '-1') {
|
|
output_stat[element] = full_stat[element];
|
|
}
|
|
};
|
|
|
|
return output_stat;
|
|
}
|
|
};
|
|
|
|
try {
|
|
const params = JSON.parse(value);
|
|
Nutanix.setParams(['endpoint_host', 'endpoint_port', 'username', 'password', 'auth_type', 'api_method'], params);
|
|
|
|
const url = 'https://' + Nutanix.params.endpoint_host + ':' + Nutanix.params.endpoint_port + '/PrismGateway/services/rest/v2.0/' + Nutanix.params.api_method,
|
|
result = Nutanix.request(url);
|
|
|
|
return JSON.stringify(result);
|
|
}
|
|
catch (error) {
|
|
error += (String(error).endsWith('.')) ? '' : '.';
|
|
Zabbix.log(4, '[ Nutanix ] ERROR: ' + error);
|
|
|
|
return JSON.stringify({ 'error': error });
|
|
}
|
|
description: 'Get the available clusters.'
|
|
timeout: 10s
|
|
parameters:
|
|
- name: api_method
|
|
value: clusters
|
|
- name: auth_type
|
|
value: basic
|
|
- name: endpoint_host
|
|
value: '{$NUTANIX.PRISM.ELEMENT.IP}'
|
|
- name: endpoint_port
|
|
value: '{$NUTANIX.PRISM.ELEMENT.PORT}'
|
|
- name: password
|
|
value: '{$NUTANIX.PASSWORD}'
|
|
- name: proxy
|
|
value: '{$NUTANIX.PROXY}'
|
|
- name: tls_verify
|
|
value: '{$HTTP.TLS.VERIFY:"Nutanix Prism Element"}'
|
|
- name: username
|
|
value: '{$NUTANIX.USER}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: 435f96fef5e44fbaae3d3281a6fd88eb
|
|
name: 'Get cluster check'
|
|
type: DEPENDENT
|
|
key: nutanix.cluster.get.check
|
|
delay: '0'
|
|
value_type: TEXT
|
|
trends: '0'
|
|
description: 'Data collection check. Check the latest values for details.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.error
|
|
error_handler: CUSTOM_VALUE
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 3h
|
|
master_item:
|
|
key: nutanix.cluster.get
|
|
tags:
|
|
- tag: component
|
|
value: status
|
|
triggers:
|
|
- uuid: baf3ae722bd44a09a628f9c81c541259
|
|
expression: 'length(last(/Nutanix Prism Element by HTTP/nutanix.cluster.get.check))>0'
|
|
name: 'Nutanix: Failed to get cluster data from the API'
|
|
priority: HIGH
|
|
description: 'Failed to get data from the API. Check the latest values for details.'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 06ce8fe78e9642cfb2064ad2aa25b50e
|
|
name: 'Get host'
|
|
type: SCRIPT
|
|
key: nutanix.host.get
|
|
delay: 10m
|
|
history: '0'
|
|
value_type: TEXT
|
|
trends: '0'
|
|
params: |
|
|
const CTlsConfig = function (raw_value) {
|
|
raw_value = String(raw_value).trim().toLowerCase();
|
|
|
|
if (['none', 'peer', 'full'].indexOf(raw_value) === -1) {
|
|
raw_value = 'full';
|
|
}
|
|
|
|
this.options = {
|
|
SSLVerifyPeer: (raw_value === 'peer' || raw_value === 'full'),
|
|
SSLVerifyHost: (raw_value === 'full')
|
|
};
|
|
|
|
this.enabled = (raw_value !== 'none');
|
|
|
|
this.checkURL = function (url) {
|
|
if (this.enabled && !/^https:\/\//i.test(url)) {
|
|
throw 'TLS certificate verification is enabled by {$' + 'HTTP.TLS.VERIFY}, but the URL uses plain HTTP: ' + url +
|
|
'. Use an "https://" URL, or set {$' + 'HTTP.TLS.VERIFY} to `none` to disable verification.';
|
|
}
|
|
|
|
return url;
|
|
};
|
|
}
|
|
|
|
|
|
var Nutanix = {
|
|
params: {},
|
|
|
|
setParams: function (requiredParams, allParams) {
|
|
requiredParams.forEach(function (field) {
|
|
if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
|
|
Nutanix.params = allParams;
|
|
Nutanix.tls = new CTlsConfig(allParams.tls_verify);
|
|
},
|
|
|
|
request: function (url) {
|
|
|
|
var request = new HttpRequest(Nutanix.tls.options);
|
|
|
|
if (typeof Nutanix.params.proxy !== 'undefined' && Nutanix.params.proxy !== '') {
|
|
request.setProxy(Nutanix.params.proxy);
|
|
}
|
|
|
|
request.setHttpAuth(HTTPAUTH_BASIC, Nutanix.params.username, Nutanix.params.password);
|
|
|
|
Zabbix.log(4, '[ Nutanix ] Sending request: ' + url);
|
|
|
|
const response = request.get(url);
|
|
|
|
Zabbix.log(4, '[ Nutanix ] Received response with status code ' + request.getStatus() + ': ' + response);
|
|
|
|
if (request.getStatus() < 200 || request.getStatus() >= 300) {
|
|
throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
|
|
}
|
|
|
|
try {
|
|
response = JSON.parse(response);
|
|
}
|
|
catch (error) {
|
|
throw 'Failed to parse response received from Nutanix PRISM API. Check debug log for more information.';
|
|
}
|
|
|
|
return response;
|
|
},
|
|
|
|
deduplicateAlerts: function (full_data) {
|
|
const severity_mapping = [
|
|
'kinfo',
|
|
'kwarning',
|
|
'kcritical'
|
|
]
|
|
|
|
var output_data = {};
|
|
for (var entity in full_data.entities) {
|
|
|
|
if (Nutanix.params.api_method === 'clusters') {
|
|
if (result.entities[entity].node_uuid.split('-').length == 5) continue;
|
|
}
|
|
|
|
var severity = severity_mapping.indexOf(full_data.entities[entity].severity.toLowerCase()),
|
|
message = full_data.entities[entity].message,
|
|
title = full_data.entities[entity].alert_title;
|
|
|
|
full_data.entities[entity].context_types.forEach(function(context, index) {
|
|
message = message.replace('{' + context + '}', full_data.entities[entity].context_values[index]);
|
|
title = title.replace('{' + context + '}', full_data.entities[entity].context_values[index]);
|
|
});
|
|
|
|
key = md5(title + message);
|
|
if (key in output_data) {
|
|
if (full_data.entities[entity].created_time_stamp_in_usecs > output_data[key].created) {
|
|
output_data[key].created = full_data.entities[entity].created_time_stamp_in_usecs;
|
|
output_data[key].severity = severity !== -1 ? severity : 3;
|
|
output_data[key].state = full_data.entities[entity].resolved ? 0 : 1;
|
|
output_data[key].message = full_data.entities[entity].detailed_message != '' ? full_data.entities[entity].detailed_message : message;
|
|
output_data[key].last_id = full_data.entities[entity].id;
|
|
}
|
|
output_data[key].count += 1;
|
|
} else {
|
|
output_data[key] = {
|
|
"name": title + ' - ' + message,
|
|
"title": title != '' ? title : message,
|
|
"created": full_data.entities[entity].created_time_stamp_in_usecs,
|
|
"severity": severity !== -1 ? severity : 3,
|
|
"state": full_data.entities[entity].resolved ? 0 : 1,
|
|
"message": full_data.entities[entity].detailed_message != '' ? full_data.entities[entity].detailed_message : message,
|
|
"last_id": full_data.entities[entity].id,
|
|
"count": 1
|
|
}
|
|
}
|
|
}
|
|
|
|
return output_data;
|
|
},
|
|
|
|
cleanUnsupported: function (full_stat) {
|
|
var output_stat = {};
|
|
for (var element in full_stat) {
|
|
if (full_stat[element] !== '-1') {
|
|
output_stat[element] = full_stat[element];
|
|
}
|
|
};
|
|
|
|
return output_stat;
|
|
}
|
|
};
|
|
|
|
try {
|
|
const params = JSON.parse(value);
|
|
Nutanix.setParams(['endpoint_host', 'endpoint_port', 'username', 'password', 'auth_type', 'api_method'], params);
|
|
|
|
const url = 'https://' + Nutanix.params.endpoint_host + ':' + Nutanix.params.endpoint_port + '/PrismGateway/services/rest/v2.0/' + Nutanix.params.api_method,
|
|
result = Nutanix.request(url);
|
|
|
|
return JSON.stringify(result);
|
|
}
|
|
catch (error) {
|
|
error += (String(error).endsWith('.')) ? '' : '.';
|
|
Zabbix.log(4, '[ Nutanix ] ERROR: ' + error);
|
|
|
|
return JSON.stringify({ 'error': error });
|
|
}
|
|
description: 'Get the available hosts.'
|
|
timeout: 10s
|
|
parameters:
|
|
- name: api_method
|
|
value: hosts
|
|
- name: auth_type
|
|
value: basic
|
|
- name: endpoint_host
|
|
value: '{$NUTANIX.PRISM.ELEMENT.IP}'
|
|
- name: endpoint_port
|
|
value: '{$NUTANIX.PRISM.ELEMENT.PORT}'
|
|
- name: password
|
|
value: '{$NUTANIX.PASSWORD}'
|
|
- name: proxy
|
|
value: '{$NUTANIX.PROXY}'
|
|
- name: tls_verify
|
|
value: '{$HTTP.TLS.VERIFY:"Nutanix Prism Element"}'
|
|
- name: username
|
|
value: '{$NUTANIX.USER}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: 7fa751ec3908489391aa2403723e2ac1
|
|
name: 'Get host check'
|
|
type: DEPENDENT
|
|
key: nutanix.host.get.check
|
|
delay: '0'
|
|
value_type: TEXT
|
|
trends: '0'
|
|
description: 'Data collection check. Check the latest values for details.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.error
|
|
error_handler: CUSTOM_VALUE
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 3h
|
|
master_item:
|
|
key: nutanix.host.get
|
|
tags:
|
|
- tag: component
|
|
value: status
|
|
triggers:
|
|
- uuid: 56e915c86d4640c3b073cb8309bf1d6e
|
|
expression: 'length(last(/Nutanix Prism Element by HTTP/nutanix.host.get.check))>0'
|
|
name: 'Nutanix: Failed to get host data from the API'
|
|
priority: HIGH
|
|
description: 'Failed to get data from the API. Check the latest values for details.'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 10cd43e73f1146cf8eb4bffd33978344
|
|
name: 'Get storage container'
|
|
type: SCRIPT
|
|
key: nutanix.storage.container.get
|
|
delay: 10m
|
|
history: '0'
|
|
value_type: TEXT
|
|
trends: '0'
|
|
params: |
|
|
const CTlsConfig = function (raw_value) {
|
|
raw_value = String(raw_value).trim().toLowerCase();
|
|
|
|
if (['none', 'peer', 'full'].indexOf(raw_value) === -1) {
|
|
raw_value = 'full';
|
|
}
|
|
|
|
this.options = {
|
|
SSLVerifyPeer: (raw_value === 'peer' || raw_value === 'full'),
|
|
SSLVerifyHost: (raw_value === 'full')
|
|
};
|
|
|
|
this.enabled = (raw_value !== 'none');
|
|
|
|
this.checkURL = function (url) {
|
|
if (this.enabled && !/^https:\/\//i.test(url)) {
|
|
throw 'TLS certificate verification is enabled by {$' + 'HTTP.TLS.VERIFY}, but the URL uses plain HTTP: ' + url +
|
|
'. Use an "https://" URL, or set {$' + 'HTTP.TLS.VERIFY} to `none` to disable verification.';
|
|
}
|
|
|
|
return url;
|
|
};
|
|
}
|
|
|
|
|
|
var Nutanix = {
|
|
params: {},
|
|
|
|
setParams: function (requiredParams, allParams) {
|
|
requiredParams.forEach(function (field) {
|
|
if (typeof allParams !== 'object' || typeof allParams[field] === 'undefined' || allParams[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
|
|
Nutanix.params = allParams;
|
|
Nutanix.tls = new CTlsConfig(allParams.tls_verify);
|
|
},
|
|
|
|
request: function (url) {
|
|
|
|
var request = new HttpRequest(Nutanix.tls.options);
|
|
|
|
if (typeof Nutanix.params.proxy !== 'undefined' && Nutanix.params.proxy !== '') {
|
|
request.setProxy(Nutanix.params.proxy);
|
|
}
|
|
|
|
request.setHttpAuth(HTTPAUTH_BASIC, Nutanix.params.username, Nutanix.params.password);
|
|
|
|
Zabbix.log(4, '[ Nutanix ] Sending request: ' + url);
|
|
|
|
const response = request.get(url);
|
|
|
|
Zabbix.log(4, '[ Nutanix ] Received response with status code ' + request.getStatus() + ': ' + response);
|
|
|
|
if (request.getStatus() < 200 || request.getStatus() >= 300) {
|
|
throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
|
|
}
|
|
|
|
try {
|
|
response = JSON.parse(response);
|
|
}
|
|
catch (error) {
|
|
throw 'Failed to parse response received from Nutanix PRISM API. Check debug log for more information.';
|
|
}
|
|
|
|
return response;
|
|
},
|
|
|
|
deduplicateAlerts: function (full_data) {
|
|
const severity_mapping = [
|
|
'kinfo',
|
|
'kwarning',
|
|
'kcritical'
|
|
]
|
|
|
|
var output_data = {};
|
|
for (var entity in full_data.entities) {
|
|
|
|
if (Nutanix.params.api_method === 'clusters') {
|
|
if (result.entities[entity].node_uuid.split('-').length == 5) continue;
|
|
}
|
|
|
|
var severity = severity_mapping.indexOf(full_data.entities[entity].severity.toLowerCase()),
|
|
message = full_data.entities[entity].message,
|
|
title = full_data.entities[entity].alert_title;
|
|
|
|
full_data.entities[entity].context_types.forEach(function(context, index) {
|
|
message = message.replace('{' + context + '}', full_data.entities[entity].context_values[index]);
|
|
title = title.replace('{' + context + '}', full_data.entities[entity].context_values[index]);
|
|
});
|
|
|
|
key = md5(title + message);
|
|
if (key in output_data) {
|
|
if (full_data.entities[entity].created_time_stamp_in_usecs > output_data[key].created) {
|
|
output_data[key].created = full_data.entities[entity].created_time_stamp_in_usecs;
|
|
output_data[key].severity = severity !== -1 ? severity : 3;
|
|
output_data[key].state = full_data.entities[entity].resolved ? 0 : 1;
|
|
output_data[key].message = full_data.entities[entity].detailed_message != '' ? full_data.entities[entity].detailed_message : message;
|
|
output_data[key].last_id = full_data.entities[entity].id;
|
|
}
|
|
output_data[key].count += 1;
|
|
} else {
|
|
output_data[key] = {
|
|
"name": title + ' - ' + message,
|
|
"title": title != '' ? title : message,
|
|
"created": full_data.entities[entity].created_time_stamp_in_usecs,
|
|
"severity": severity !== -1 ? severity : 3,
|
|
"state": full_data.entities[entity].resolved ? 0 : 1,
|
|
"message": full_data.entities[entity].detailed_message != '' ? full_data.entities[entity].detailed_message : message,
|
|
"last_id": full_data.entities[entity].id,
|
|
"count": 1
|
|
}
|
|
}
|
|
}
|
|
|
|
return output_data;
|
|
},
|
|
|
|
cleanUnsupported: function (full_stat) {
|
|
var output_stat = {};
|
|
for (var element in full_stat) {
|
|
if (full_stat[element] !== '-1') {
|
|
output_stat[element] = full_stat[element];
|
|
}
|
|
};
|
|
|
|
return output_stat;
|
|
}
|
|
};
|
|
|
|
try {
|
|
const params = JSON.parse(value);
|
|
Nutanix.setParams(['endpoint_host', 'endpoint_port', 'username', 'password', 'auth_type', 'api_method'], params);
|
|
|
|
const url = 'https://' + Nutanix.params.endpoint_host + ':' + Nutanix.params.endpoint_port + '/PrismGateway/services/rest/v2.0/' + Nutanix.params.api_method,
|
|
result = Nutanix.request(url);
|
|
|
|
var output_data = {};
|
|
for (var entity in result.entities) {
|
|
output_data[result.entities[entity].storage_container_uuid] = result.entities[entity]
|
|
}
|
|
|
|
return JSON.stringify(output_data);
|
|
}
|
|
catch (error) {
|
|
error += (String(error).endsWith('.')) ? '' : '.';
|
|
Zabbix.log(4, '[ Nutanix ] ERROR: ' + error);
|
|
|
|
return JSON.stringify({ 'error': error });
|
|
}
|
|
description: 'Get the available storage containers.'
|
|
timeout: 10s
|
|
parameters:
|
|
- name: api_method
|
|
value: storage_containers
|
|
- name: auth_type
|
|
value: basic
|
|
- name: endpoint_host
|
|
value: '{$NUTANIX.PRISM.ELEMENT.IP}'
|
|
- name: endpoint_port
|
|
value: '{$NUTANIX.PRISM.ELEMENT.PORT}'
|
|
- name: password
|
|
value: '{$NUTANIX.PASSWORD}'
|
|
- name: proxy
|
|
value: '{$NUTANIX.PROXY}'
|
|
- name: tls_verify
|
|
value: '{$HTTP.TLS.VERIFY:"Nutanix Prism Element"}'
|
|
- name: username
|
|
value: '{$NUTANIX.USER}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: a59d77244200466384ec0b4cad7648db
|
|
name: 'Get storage container check'
|
|
type: DEPENDENT
|
|
key: nutanix.storage.container.get.check
|
|
delay: '0'
|
|
value_type: TEXT
|
|
trends: '0'
|
|
description: 'Data collection check. Check the latest values for details.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.error
|
|
error_handler: CUSTOM_VALUE
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 3h
|
|
master_item:
|
|
key: nutanix.storage.container.get
|
|
tags:
|
|
- tag: component
|
|
value: status
|
|
triggers:
|
|
- uuid: f46c6213084c4afe88065beb6cdcef33
|
|
expression: 'length(last(/Nutanix Prism Element by HTTP/nutanix.storage.container.get.check))>0'
|
|
name: 'Nutanix: Failed to get storage container data from the API'
|
|
priority: HIGH
|
|
description: 'Failed to get data from the API. Check the latest values for details.'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
discovery_rules:
|
|
- uuid: 3611bdb3bf0343bc813510e11d32f273
|
|
name: 'Cluster discovery'
|
|
type: DEPENDENT
|
|
key: nutanix.cluster.discovery
|
|
delay: '0'
|
|
filter:
|
|
evaltype: AND
|
|
conditions:
|
|
- macro: '{#NUTANIX.CLUSTER.NAME}'
|
|
value: '{$NUTANIX.CLUSTER.DISCOVERY.NAME.MATCHES}'
|
|
formulaid: A
|
|
- macro: '{#NUTANIX.CLUSTER.NAME}'
|
|
value: '{$NUTANIX.CLUSTER.DISCOVERY.NAME.NOT_MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: B
|
|
description: 'Discovery of all clusters.'
|
|
host_prototypes:
|
|
- uuid: c1f630a16e304dcda7771895344638c7
|
|
host: '{#NUTANIX.CLUSTER.UUID}'
|
|
name: '{#NUTANIX.CLUSTER.NAME}'
|
|
group_links:
|
|
- group:
|
|
name: Applications
|
|
templates:
|
|
- name: 'Nutanix Cluster Prism Element by HTTP'
|
|
macros:
|
|
- macro: '{$NUTANIX.CLUSTER.UUID}'
|
|
value: '{#NUTANIX.CLUSTER.UUID}'
|
|
description: 'UUID of the cluster.'
|
|
master_item:
|
|
key: nutanix.cluster.get
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.entities
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const json_data = JSON.parse(value);
|
|
|
|
const result = json_data.map(function(entity) {
|
|
return {
|
|
"{#NUTANIX.CLUSTER.NAME}": entity.name ? entity.name : entity.uuid,
|
|
"{#NUTANIX.CLUSTER.UUID}": entity.uuid
|
|
};
|
|
});
|
|
|
|
return JSON.stringify(result);
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
- uuid: 19cd9a3bc7ac4e42860f3e3b0ab20afe
|
|
name: 'Host discovery'
|
|
type: DEPENDENT
|
|
key: nutanix.host.discovery
|
|
delay: '0'
|
|
filter:
|
|
evaltype: AND
|
|
conditions:
|
|
- macro: '{#NUTANIX.HOST.NAME}'
|
|
value: '{$NUTANIX.HOST.DISCOVERY.NAME.MATCHES}'
|
|
formulaid: A
|
|
- macro: '{#NUTANIX.HOST.NAME}'
|
|
value: '{$NUTANIX.HOST.DISCOVERY.NAME.NOT_MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: B
|
|
description: 'Discovery of all hosts.'
|
|
host_prototypes:
|
|
- uuid: 24ccbeb75dc949ccb6c094416618443b
|
|
host: '{#NUTANIX.HOST.UUID}'
|
|
name: '{#NUTANIX.HOST.NAME}'
|
|
group_links:
|
|
- group:
|
|
name: Applications
|
|
templates:
|
|
- name: 'Nutanix Host Prism Element by HTTP'
|
|
macros:
|
|
- macro: '{$NUTANIX.HOST.UUID}'
|
|
value: '{#NUTANIX.HOST.UUID}'
|
|
description: 'UUID of the host.'
|
|
master_item:
|
|
key: nutanix.host.get
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.entities
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const json_data = JSON.parse(value);
|
|
|
|
const result = json_data.map(function(entity) {
|
|
return {
|
|
"{#NUTANIX.HOST.NAME}": entity.name ? entity.name : entity.uuid,
|
|
"{#NUTANIX.HOST.UUID}": entity.uuid
|
|
};
|
|
});
|
|
|
|
return JSON.stringify(result);
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
- uuid: 7ece7ee4f9d0423b856b6ecd7f616026
|
|
name: 'Storage container discovery'
|
|
type: DEPENDENT
|
|
key: nutanix.storage.container.discovery
|
|
delay: '0'
|
|
filter:
|
|
evaltype: AND
|
|
conditions:
|
|
- macro: '{#STORAGE.CONTAINER.NAME}'
|
|
value: '{$NUTANIX.STORAGE.CONTAINER.DISCOVERY.NAME.MATCHES}'
|
|
formulaid: A
|
|
- macro: '{#STORAGE.CONTAINER.NAME}'
|
|
value: '{$NUTANIX.STORAGE.CONTAINER.DISCOVERY.NAME.NOT_MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: B
|
|
description: 'Discovery of all storage containers.'
|
|
item_prototypes:
|
|
- uuid: f0a6602489f54d5c8be85bb75ebd3e6f
|
|
name: 'Container [{#STORAGE.CONTAINER.NAME}]: Space: Total, bytes'
|
|
type: DEPENDENT
|
|
key: 'nutanix.storage.container.capacity.bytes["{#STORAGE.CONTAINER.UUID}"]'
|
|
delay: '0'
|
|
units: B
|
|
description: 'The total space of the storage container.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.[''{#STORAGE.CONTAINER.UUID}''].usage_stats.[''storage.capacity_bytes'']'
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
master_item:
|
|
key: nutanix.storage.container.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- tag: container
|
|
value: '{#STORAGE.CONTAINER.NAME}'
|
|
- uuid: dac6fb1aa0ee4d93ab67e1bd3374c412
|
|
name: 'Container [{#STORAGE.CONTAINER.NAME}]: Space: Free, bytes'
|
|
type: DEPENDENT
|
|
key: 'nutanix.storage.container.free.bytes["{#STORAGE.CONTAINER.UUID}"]'
|
|
delay: '0'
|
|
units: B
|
|
description: 'The free space of the storage container.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.[''{#STORAGE.CONTAINER.UUID}''].usage_stats.[''storage.free_bytes'']'
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
master_item:
|
|
key: nutanix.storage.container.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- tag: container
|
|
value: '{#STORAGE.CONTAINER.NAME}'
|
|
- uuid: dc76d8405d204e90bd6213f34344dcb6
|
|
name: 'Container [{#STORAGE.CONTAINER.NAME}]: Replication factor'
|
|
type: DEPENDENT
|
|
key: 'nutanix.storage.container.replication.factor["{#STORAGE.CONTAINER.UUID}"]'
|
|
delay: '0'
|
|
description: 'The replication factor of the storage container.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.[''{#STORAGE.CONTAINER.UUID}''].replication_factor'
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
master_item:
|
|
key: nutanix.storage.container.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- tag: container
|
|
value: '{#STORAGE.CONTAINER.NAME}'
|
|
- uuid: 5d40812ff4f14146a5199edf271be1ec
|
|
name: 'Container [{#STORAGE.CONTAINER.NAME}]: Space: Used, bytes'
|
|
type: DEPENDENT
|
|
key: 'nutanix.storage.container.usage.bytes["{#STORAGE.CONTAINER.UUID}"]'
|
|
delay: '0'
|
|
units: B
|
|
description: 'The used space of the storage container.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.[''{#STORAGE.CONTAINER.UUID}''].usage_stats.[''storage.usage_bytes'']'
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
master_item:
|
|
key: nutanix.storage.container.get
|
|
tags:
|
|
- tag: component
|
|
value: storage
|
|
- tag: container
|
|
value: '{#STORAGE.CONTAINER.NAME}'
|
|
graph_prototypes:
|
|
- uuid: b067c9f9467b4760b43235aa453ee424
|
|
name: 'Container [{#STORAGE.CONTAINER.NAME}]: Space: Total and Used'
|
|
graph_items:
|
|
- drawtype: GRADIENT_LINE
|
|
color: 0040FF
|
|
item:
|
|
host: 'Nutanix Prism Element by HTTP'
|
|
key: 'nutanix.storage.container.usage.bytes["{#STORAGE.CONTAINER.UUID}"]'
|
|
- sortorder: '1'
|
|
drawtype: GRADIENT_LINE
|
|
color: 00BFFF
|
|
item:
|
|
host: 'Nutanix Prism Element by HTTP'
|
|
key: 'nutanix.storage.container.capacity.bytes["{#STORAGE.CONTAINER.UUID}"]'
|
|
master_item:
|
|
key: nutanix.storage.container.get
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const json_data = JSON.parse(value);
|
|
var output_data = [];
|
|
|
|
for (var entity in json_data) {
|
|
output_data.push({
|
|
"{#STORAGE.CONTAINER.UUID}": json_data[entity].storage_container_uuid,
|
|
"{#STORAGE.CONTAINER.NAME}": json_data[entity].name
|
|
});
|
|
}
|
|
|
|
return JSON.stringify(output_data);
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
tags:
|
|
- tag: class
|
|
value: software
|
|
- tag: target
|
|
value: nutanix
|
|
- tag: target
|
|
value: prism-element
|
|
macros:
|
|
- macro: '{$HTTP.TLS.VERIFY}'
|
|
value: full
|
|
description: 'TLS certificate verification for script items: "none" - disabled, "peer" - verify the certificate chain and expiration, "full" - full verification. Any other value enables full verification. To override the setting for this template only, define the macro with the context "Nutanix Prism Element", e.g. {$HTTP.TLS.VERIFY:"Nutanix Prism Element"}.'
|
|
- macro: '{$NUTANIX.CLUSTER.DISCOVERY.NAME.MATCHES}'
|
|
value: '.*'
|
|
description: 'Filter of discoverable Nutanix clusters by name.'
|
|
- macro: '{$NUTANIX.CLUSTER.DISCOVERY.NAME.NOT_MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'Filter to exclude discovered Nutanix clusters by name.'
|
|
- macro: '{$NUTANIX.HOST.DISCOVERY.NAME.MATCHES}'
|
|
value: '.*'
|
|
description: 'Filter of discoverable Nutanix hosts by name.'
|
|
- macro: '{$NUTANIX.HOST.DISCOVERY.NAME.NOT_MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'Filter to exclude discovered Nutanix hosts by name.'
|
|
- macro: '{$NUTANIX.PASSWORD}'
|
|
type: SECRET_TEXT
|
|
description: 'Nutanix API password.'
|
|
- macro: '{$NUTANIX.PRISM.ELEMENT.IP}'
|
|
value: '<Put your IP here>'
|
|
description: 'Set the Nutanix API IP here.'
|
|
- macro: '{$NUTANIX.PRISM.ELEMENT.PORT}'
|
|
value: '9440'
|
|
description: 'Set the Nutanix API port here.'
|
|
- macro: '{$NUTANIX.PROXY}'
|
|
description: 'Sets the HTTP proxy value. If this macro is empty, then no proxy is used.'
|
|
- macro: '{$NUTANIX.STORAGE.CONTAINER.DISCOVERY.NAME.MATCHES}'
|
|
value: '.*'
|
|
description: 'Filter of discoverable storage containers by name.'
|
|
- macro: '{$NUTANIX.STORAGE.CONTAINER.DISCOVERY.NAME.NOT_MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'Filter to exclude discovered storage containers by name.'
|
|
- macro: '{$NUTANIX.USER}'
|
|
value: '<Put your API username here>'
|
|
description: 'Nutanix API username.'
|
|
dashboards:
|
|
- uuid: 02f05b74967140859a2e86d0d14b0545
|
|
name: 'Nutanix Prism Element overview'
|
|
pages:
|
|
- name: 'Nutanix: Overview'
|
|
widgets:
|
|
- type: graphprototype
|
|
name: Capacity
|
|
width: '36'
|
|
height: '6'
|
|
fields:
|
|
- type: INTEGER
|
|
name: columns
|
|
value: '1'
|
|
- type: ITEM_PROTOTYPE
|
|
name: itemid.0
|
|
value:
|
|
host: 'Nutanix Prism Element by HTTP'
|
|
key: 'nutanix.storage.container.capacity.bytes["{#STORAGE.CONTAINER.UUID}"]'
|
|
- type: STRING
|
|
name: reference
|
|
value: MLSDY
|
|
- type: INTEGER
|
|
name: source_type
|
|
value: '3'
|
|
- type: graphprototype
|
|
name: 'Free space'
|
|
'y': '6'
|
|
width: '72'
|
|
height: '6'
|
|
fields:
|
|
- type: GRAPH_PROTOTYPE
|
|
name: graphid.0
|
|
value:
|
|
host: 'Nutanix Prism Element by HTTP'
|
|
name: 'Container [{#STORAGE.CONTAINER.NAME}]: Space: Total and Used'
|
|
- type: STRING
|
|
name: reference
|
|
value: MLSDW
|
|
- type: honeycomb
|
|
name: 'Replication factor'
|
|
x: '36'
|
|
width: '36'
|
|
height: '6'
|
|
fields:
|
|
- type: STRING
|
|
name: bg_color
|
|
value: 81D4FA
|
|
- type: STRING
|
|
name: items.0
|
|
value: '*Replication factor'
|
|
- type: STRING
|
|
name: primary_label
|
|
value: '{{ITEM.NAME}.regsub("Container.\[(.*)\]:\sReplication factor", \1)}'
|
|
- type: INTEGER
|
|
name: primary_label_size_type
|
|
value: '1'
|
|
- type: STRING
|
|
name: reference
|
|
value: LSGAA
|
|
- type: INTEGER
|
|
name: secondary_label_bold
|
|
value: '0'
|
|
- type: INTEGER
|
|
name: secondary_label_decimal_places
|
|
value: '0'
|