Files
templates-default/Veeam_Backup_Enterprise_Manager_by_HTTP.yaml

499 lines
20 KiB
YAML

zabbix_export:
version: '7.0'
template_groups:
- uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
name: Templates/Applications
templates:
- uuid: 2ce384bafd524db5b910d7f55bca1fbb
template: 'Veeam Backup Enterprise Manager by HTTP'
name: 'Veeam Backup Enterprise Manager by HTTP'
description: |
This template is designed to monitor Veeam Backup Enterprise Manager.
NOTE: The REST API may not be available for some editions, see (https://www.veeam.com/licensing-pricing.html) for more details.
Setup:
1. Create a user to monitor the service, or use an existing read-only account.
Similarly to the user authentication in the Veeam Backup Enterprise Manager Web UI,
the client authentication in the REST API dictates which operations a client is allowed to perform when working with the REST API.
That is, if the client is authenticated using an account that does not have enough permissions to perform some actions, it will not be able to execute them.
You can also obtain the collected jobs if you are logged in under an account having only `Portal Administrator` role.
See (https://helpcenter.veeam.com/docs/backup/em_rest/http_authentication.html?ver=110) for more details.
2. Link the template to a host.
3. Configure the following macros: {$VEEAM.MANAGER.API.URL}, {$VEEAM.MANAGER.USER}, {$VEEAM.MANAGER.PASSWORD}.
You can discuss this template or leave feedback on our forum https://www.zabbix.com/forum/zabbix-suggestions-and-feedback/
Generated by official Zabbix template tool "Templator"
vendor:
name: Zabbix
version: 7.0-2
groups:
- name: Templates/Applications
items:
- uuid: a1b612cd8e274a27a834dbdb69fe7d08
name: 'Failed Job Runs'
type: DEPENDENT
key: veeam.manager.failed.jobs
delay: '0'
description: 'Informs about the failed job runs.'
preprocessing:
- type: JSONPATH
parameters:
- $.JobStatistics.FailedJobRuns
error_handler: DISCARD_VALUE
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 1h
master_item:
key: veeam.manager.get.metrics
tags:
- tag: component
value: reports
triggers:
- uuid: 4885d43f36b541219be87b5e5ea19088
expression: 'last(/Veeam Backup Enterprise Manager by HTTP/veeam.manager.failed.jobs)>{$VEEAM.MANAGER.JOB.MAX.FAIL}'
name: 'Veeam Backup: Failed job runs is too high'
event_name: 'Veeam Backup: Failed job runs is too high (over {$VEEAM.MANAGER.JOB.MAX.FAIL})'
priority: AVERAGE
manual_close: 'YES'
tags:
- tag: scope
value: availability
- uuid: e698c05dae9f4d2f8323ce718e9ed83b
name: 'Get errors'
type: DEPENDENT
key: veeam.manager.get.errors
delay: '0'
value_type: TEXT
trends: '0'
description: 'The errors from API requests.'
preprocessing:
- type: JSONPATH
parameters:
- $.error
error_handler: CUSTOM_VALUE
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 1h
master_item:
key: veeam.manager.get.metrics
tags:
- tag: component
value: status
triggers:
- uuid: 83316e2168414042aeb9d98857534baa
expression: 'length(last(/Veeam Backup Enterprise Manager by HTTP/veeam.manager.get.errors))>0'
name: 'Veeam Backup: There are errors in requests to API'
opdata: '{ITEM.LASTVALUE1}'
priority: AVERAGE
description: 'Zabbix has received errors in response to API requests.'
tags:
- tag: scope
value: availability
- uuid: 525a61ff4fb747efab6ac58d1ac8b7c4
name: 'Get metrics'
type: SCRIPT
key: veeam.manager.get.metrics
delay: 5m
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 Veeam = {
params: {},
setParams: function (params) {
['api_endpoint', 'user', 'password'].forEach(function (field) {
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
throw 'Required param is not set: ' + field + '.';
}
});
Veeam.params = params;
if (typeof Veeam.params.api_endpoint === 'string' && !Veeam.params.api_endpoint.endsWith('/')) {
Veeam.params.api_endpoint += '/';
}
Veeam.tls = new CTlsConfig(params.tls_verify);
Veeam.tls.checkURL(Veeam.params.api_endpoint);
},
request: function (url) {
var response, request = new HttpRequest(Veeam.tls.options);
if (typeof Veeam.params.http_proxy !== 'undefined' && Veeam.params.http_proxy !== '') {
request.setProxy(Veeam.params.http_proxy);
}
request.addHeader('Accept: application/json');
request.addHeader('Authorization: Basic ' + btoa(Veeam.params.user + ':' + Veeam.params.password));
request.post(Veeam.params.api_endpoint + 'api/sessionMngr');
response = request.get(url);
if (request.getStatus() !== 200 || response === null) {
throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
}
try {
return JSON.parse(response);
}
catch (error) {
throw 'Failed to parse response received from API.';
}
},
getMetricsData: function() {
var data = {};
endpoints = {
'backupFiles': 'api/backupFiles',
};
reports_summary = Veeam.request(Veeam.params.api_endpoint + 'api/reports/summary')
if (typeof reports_summary !== 'object' || reports_summary.hasOwnProperty('Links') === false)
throw 'Failed response parse. Check debug log for more information.';
reports_summary.Links.forEach(function (field) {
data[field.Name] = Veeam.request(field.Href)
})
Object.keys(endpoints).forEach(function (key) {
data[key] = Veeam.request(Veeam.params.api_endpoint + endpoints[key]);
if (typeof data[key] !== 'object' || data[key].hasOwnProperty('Refs') === false)
throw 'Failed response parse. Check debug log for more information.';
data[key].Refs.forEach(function (field) {
data[field.Name] = Veeam.request(field.Href)
})
})
return data;
}
};
try {
Veeam.setParams(JSON.parse(value));
return JSON.stringify(Veeam.getMetricsData());
}
catch (error) {
error += (String(error).endsWith('.')) ? '' : '.';
Zabbix.log(3, '[ VEEAM MANAGER ] ERROR: ' + error);
return JSON.stringify({'error': error});
}
description: 'The result of API requests is expressed in the JSON.'
timeout: '{$VEEAM.MANAGER.DATA.TIMEOUT}'
parameters:
- name: api_endpoint
value: '{$VEEAM.MANAGER.API.URL}'
- name: http_proxy
value: '{$VEEAM.MANAGER.HTTP.PROXY}'
- name: password
value: '{$VEEAM.MANAGER.PASSWORD}'
- name: tls_verify
value: '{$HTTP.TLS.VERIFY:"Veeam Backup Enterprise Manager"}'
- name: user
value: '{$VEEAM.MANAGER.USER}'
tags:
- tag: component
value: raw
- uuid: a0a1e67c99c64bd1a801c87eeda3977b
name: 'Running Jobs'
type: DEPENDENT
key: veeam.manager.running.jobs
delay: '0'
description: 'Informs about the running jobs.'
preprocessing:
- type: JSONPATH
parameters:
- $.JobStatistics.RunningJobs
error_handler: DISCARD_VALUE
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 1h
master_item:
key: veeam.manager.get.metrics
tags:
- tag: component
value: reports
- uuid: d7510e46c6094e09979ea7dad2828cef
name: 'Scheduled Backup Jobs'
type: DEPENDENT
key: veeam.manager.scheduled.backup.jobs
delay: '0'
description: 'Informs about the scheduled backup jobs.'
preprocessing:
- type: JSONPATH
parameters:
- $.JobStatistics.ScheduledBackupJobs
error_handler: DISCARD_VALUE
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 1h
master_item:
key: veeam.manager.get.metrics
tags:
- tag: component
value: reports
- uuid: de9f62198b5b42cdb25460315f4af949
name: 'Scheduled Jobs'
type: DEPENDENT
key: veeam.manager.scheduled.jobs
delay: '0'
description: 'Informs about the scheduled jobs.'
preprocessing:
- type: JSONPATH
parameters:
- $.JobStatistics.ScheduledJobs
error_handler: DISCARD_VALUE
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 1h
master_item:
key: veeam.manager.get.metrics
tags:
- tag: component
value: reports
- uuid: 599a25d753ce4f5d8542d08569f2a136
name: 'Scheduled Replica Jobs'
type: DEPENDENT
key: veeam.manager.scheduled.replica.jobs
delay: '0'
description: 'Informs about the scheduled replica jobs.'
preprocessing:
- type: JSONPATH
parameters:
- $.JobStatistics.ScheduledReplicaJobs
error_handler: DISCARD_VALUE
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 1h
master_item:
key: veeam.manager.get.metrics
tags:
- tag: component
value: reports
- uuid: 7d96ebb849c94d5b89656bdfa6398a1d
name: 'Total Job Runs'
type: DEPENDENT
key: veeam.manager.scheduled.total.jobs
delay: '0'
description: 'Informs about the total job runs.'
preprocessing:
- type: JSONPATH
parameters:
- $.JobStatistics.TotalJobRuns
error_handler: DISCARD_VALUE
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 1h
master_item:
key: veeam.manager.get.metrics
tags:
- tag: component
value: reports
- uuid: b39d33c9d5c544a2996736dbdccfcaff
name: 'Warnings Job Runs'
type: DEPENDENT
key: veeam.manager.warning.jobs
delay: '0'
description: 'Informs about the warning job runs.'
preprocessing:
- type: JSONPATH
parameters:
- $.JobStatistics.WarningsJobRuns
error_handler: DISCARD_VALUE
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 1h
master_item:
key: veeam.manager.get.metrics
tags:
- tag: component
value: reports
triggers:
- uuid: f65998e99bb24e02a2810b632a4a3f4e
expression: 'last(/Veeam Backup Enterprise Manager by HTTP/veeam.manager.warning.jobs)>{$VEEAM.MANAGER.JOB.MAX.WARN}'
name: 'Veeam Backup: Warning job runs is too high'
event_name: 'Veeam Backup: Warning job runs is too high (over {$VEEAM.MANAGER.JOB.MAX.WARN})'
priority: WARNING
manual_close: 'YES'
tags:
- tag: scope
value: availability
discovery_rules:
- uuid: d07b06fbd84d493bb38d61ac0824e794
name: 'Backup Files discovery'
type: DEPENDENT
key: veeam.backup.files.discovery
delay: '0'
filter:
evaltype: AND
conditions:
- macro: '{#NAME}'
value: '{$BACKUP.NAME.MATCHES}'
formulaid: A
- macro: '{#NAME}'
value: '{$BACKUP.NAME.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: B
- macro: '{#TYPE}'
value: '{$BACKUP.TYPE.MATCHES}'
formulaid: C
- macro: '{#TYPE}'
value: '{$BACKUP.TYPE.NOT_MATCHES}'
operator: NOT_MATCHES_REGEX
formulaid: D
description: 'Discovery of all backup files created on, or imported to the backup servers that are connected to Veeam Backup Enterprise Manager.'
item_prototypes:
- uuid: d3f87401602c48d3a837504ed08902db
name: 'Compression ratio [{#NAME}]'
type: DEPENDENT
key: 'veeam.backup.compress.ratio[{#NAME}]'
delay: '0'
description: 'Gets the data compression ratio with the name `[{#NAME}]`.'
preprocessing:
- type: JSONPATH
parameters:
- '$.[''{#NAME}''].BackupFile.CompressRatio'
error_handler: DISCARD_VALUE
master_item:
key: veeam.manager.get.metrics
tags:
- tag: backup
value: '{#NAME}'
- tag: component
value: backups
- uuid: 0c5be137b40949c4946a09c57ccc7796
name: 'Data Size [{#NAME}]'
type: DEPENDENT
key: 'veeam.backup.data.size[{#NAME}]'
delay: '0'
value_type: FLOAT
units: B
description: 'Gets the data size with the name `[{#NAME}]`.'
preprocessing:
- type: JSONPATH
parameters:
- '$.[''{#NAME}''].BackupFile.DataSize'
error_handler: DISCARD_VALUE
master_item:
key: veeam.manager.get.metrics
tags:
- tag: backup
value: '{#NAME}'
- tag: component
value: backups
- uuid: 62d0b0341bac40f9a63f0fbf3639e0d0
name: 'Deduplication Ratio [{#NAME}]'
type: DEPENDENT
key: 'veeam.backup.deduplication.ratio[{#NAME}]'
delay: '0'
description: 'Gets the data deduplication ratio with the name `[{#NAME}]`.'
preprocessing:
- type: JSONPATH
parameters:
- '$.[''{#NAME}''].BackupFile.DeduplicationRatio'
error_handler: DISCARD_VALUE
master_item:
key: veeam.manager.get.metrics
tags:
- tag: backup
value: '{#NAME}'
- tag: component
value: backups
- uuid: 098cc39afb88483f93a98c96fc1450d1
name: 'Backup Size [{#NAME}]'
type: DEPENDENT
key: 'veeam.backup.file.size[{#NAME}]'
delay: '0'
value_type: FLOAT
units: B
description: 'Gets the backup size with the name `[{#NAME}]`.'
preprocessing:
- type: JSONPATH
parameters:
- '$.[''{#NAME}''].BackupFile.BackupSize'
error_handler: DISCARD_VALUE
master_item:
key: veeam.manager.get.metrics
tags:
- tag: backup
value: '{#NAME}'
- tag: component
value: backups
master_item:
key: veeam.manager.get.metrics
lld_macro_paths:
- lld_macro: '{#NAME}'
path: $.Name
- lld_macro: '{#TYPE}'
path: $.Type
- lld_macro: '{#UID}'
path: $.UID
- lld_macro: '{#URL}'
path: $.Href
preprocessing:
- type: JSONPATH
parameters:
- $.backupFiles.Refs
- type: DISCARD_UNCHANGED_HEARTBEAT
parameters:
- 6h
tags:
- tag: class
value: software
- tag: target
value: veeam
macros:
- macro: '{$BACKUP.NAME.MATCHES}'
value: '.*'
description: 'This macro is used in backup discovery rule.'
- macro: '{$BACKUP.NAME.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: 'This macro is used in backup discovery rule.'
- macro: '{$BACKUP.TYPE.MATCHES}'
value: '.*'
description: 'This macro is used in backup discovery rule.'
- macro: '{$BACKUP.TYPE.NOT_MATCHES}'
value: CHANGE_IF_NEEDED
description: 'This macro is used in backup discovery rule.'
- macro: '{$HTTP.TLS.VERIFY}'
value: full
description: 'TLS certificate verification for the script item: "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 "Veeam Backup Enterprise Manager", e.g. {$HTTP.TLS.VERIFY:"Veeam Backup Enterprise Manager"}.'
- macro: '{$VEEAM.MANAGER.API.URL}'
value: 'https://localhost:9398'
description: 'Veeam Backup Enterprise Manager API endpoint is a URL in the format: `<scheme>://<host>:<port>`.'
- macro: '{$VEEAM.MANAGER.DATA.TIMEOUT}'
value: '10'
description: 'A response timeout for API.'
- macro: '{$VEEAM.MANAGER.HTTP.PROXY}'
description: 'Sets the HTTP proxy to `http_proxy` value. If this parameter is empty, then no proxy is used.'
- macro: '{$VEEAM.MANAGER.JOB.MAX.FAIL}'
value: '5'
description: 'The maximum score of failed jobs (for a trigger expression).'
- macro: '{$VEEAM.MANAGER.JOB.MAX.WARN}'
value: '10'
description: 'The maximum score of warning jobs (for a trigger expression).'
- macro: '{$VEEAM.MANAGER.PASSWORD}'
type: SECRET_TEXT
description: 'The `password` of the Veeam Backup Enterprise Manager account.'
- macro: '{$VEEAM.MANAGER.USER}'
type: SECRET_TEXT
description: 'The `user name` of the Veeam Backup Enterprise Manager account .'