1215 lines
48 KiB
YAML
1215 lines
48 KiB
YAML
zabbix_export:
|
|
version: '7.0'
|
|
template_groups:
|
|
- uuid: c2c162144c2d4c5491c8801193af4945
|
|
name: Templates/Cloud
|
|
templates:
|
|
- uuid: 3d527f609e344ed8a4ec19762c31c619
|
|
template: 'Azure Backup Jobs by HTTP'
|
|
name: 'Azure Backup Jobs by HTTP'
|
|
description: |
|
|
This template is designed to monitor Azure Backup Jobs via HTTP.
|
|
It works without any external scripts and uses the script item.
|
|
|
|
Setup:
|
|
1. Create an Azure service principal via the Azure command-line interface (Azure CLI) for your subscription.
|
|
`az ad sp create-for-rbac --name zabbix --role reader --scope /subscriptions/<subscription_id>`
|
|
See https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli for more details.
|
|
2. Link the template to a host.
|
|
3. Configure the macros: {$AZURE.APP.ID}, {$AZURE.PASSWORD}, {$AZURE.TENANT.ID}, {$AZURE.SUBSCRIPTION.ID}, and {$AZURE.RESOURCE.ID}.
|
|
|
|
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-1
|
|
groups:
|
|
- name: Templates/Cloud
|
|
items:
|
|
- uuid: b733302413d54250ba053b017367c6d6
|
|
name: 'Availability status detailed'
|
|
type: DEPENDENT
|
|
key: azure.vault.availability.details
|
|
delay: '0'
|
|
value_type: CHAR
|
|
trends: '0'
|
|
description: 'The summary description of the availability status.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.health.summary
|
|
error_handler: DISCARD_VALUE
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: health
|
|
- uuid: 1dc10b5b07f648d4a75f614573bb8da5
|
|
name: 'Availability state'
|
|
type: DEPENDENT
|
|
key: azure.vault.availability.state
|
|
delay: '0'
|
|
description: |
|
|
The availability status of the resource.
|
|
0 - Available - no events detected that affect the health of the resource.
|
|
1 - Degraded - your resource detected a loss in performance, although it's still available for use.
|
|
2 - Unavailable - the service detected an ongoing platform or non-platform event that affects the health of the resource.
|
|
3 - Unknown - Resource Health hasn't received information about the resource for more than 10 minutes.
|
|
valuemap:
|
|
name: 'Azure resource health state'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.health.availabilityState
|
|
error_handler: CUSTOM_VALUE
|
|
error_handler_params: '3'
|
|
- type: STR_REPLACE
|
|
parameters:
|
|
- Available
|
|
- '0'
|
|
- type: STR_REPLACE
|
|
parameters:
|
|
- Degraded
|
|
- '1'
|
|
- type: STR_REPLACE
|
|
parameters:
|
|
- Unavailable
|
|
- '2'
|
|
- type: STR_REPLACE
|
|
parameters:
|
|
- Unknown
|
|
- '3'
|
|
- type: IN_RANGE
|
|
parameters:
|
|
- '0'
|
|
- '3'
|
|
error_handler: CUSTOM_VALUE
|
|
error_handler_params: '3'
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: health
|
|
triggers:
|
|
- uuid: 68ee9193a98c40778ee57ab2256082ec
|
|
expression: 'last(/Azure Backup Jobs by HTTP/azure.vault.availability.state)=1'
|
|
name: 'Azure backup jobs: Azure vault is degraded'
|
|
opdata: 'Current state: {ITEM.LASTVALUE1}'
|
|
priority: AVERAGE
|
|
description: 'The resource is in a degraded state.'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 40b756bf271d46da94d3a9de2b892d88
|
|
expression: 'last(/Azure Backup Jobs by HTTP/azure.vault.availability.state)=3'
|
|
name: 'Azure backup jobs: Azure vault is in unknown state'
|
|
opdata: 'Current state: {ITEM.LASTVALUE1}'
|
|
priority: WARNING
|
|
description: 'The resource state is unknown.'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: cecb9bb0945f4f21bb2ad3df02307641
|
|
expression: 'last(/Azure Backup Jobs by HTTP/azure.vault.availability.state)=2'
|
|
name: 'Azure backup jobs: Azure vault is unavailable'
|
|
opdata: 'Current state: {ITEM.LASTVALUE1}'
|
|
priority: HIGH
|
|
description: 'The resource state is unavailable.'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 00848eb26866420282b2afdfc4334484
|
|
name: 'Get errors'
|
|
type: DEPENDENT
|
|
key: azure.vault.data.errors
|
|
delay: '0'
|
|
value_type: TEXT
|
|
trends: '0'
|
|
description: 'A list of errors from API requests.'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.error
|
|
error_handler: CUSTOM_VALUE
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: error
|
|
triggers:
|
|
- uuid: d70f2e4edb38492ea019abbfc1cbb82a
|
|
expression: 'length(last(/Azure Backup Jobs by HTTP/azure.vault.data.errors))>0'
|
|
name: 'Azure backup jobs: There are errors in requests to API'
|
|
opdata: 'Error: {ITEM.LASTVALUE1}'
|
|
priority: AVERAGE
|
|
description: 'Zabbix has received errors in response to API requests.'
|
|
tags:
|
|
- tag: scope
|
|
value: availability
|
|
- uuid: 57d191150c06423daa1674d09c846dc7
|
|
name: 'Get data'
|
|
type: SCRIPT
|
|
key: azure.vault.data.get
|
|
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 Azure = {
|
|
params: {},
|
|
token: null,
|
|
|
|
setParams: function (params) {
|
|
['app_id', 'password', 'tenant_id', 'subscription_id', 'resource_id', 'period'].forEach(function (field) {
|
|
if (typeof params !== 'object' || typeof params[field] === 'undefined' || params[field] === '') {
|
|
throw 'Required param is not set: ' + field + '.';
|
|
}
|
|
});
|
|
|
|
Azure.params = params;
|
|
Azure.tls = new CTlsConfig(params.tls_verify);
|
|
},
|
|
|
|
login: function () {
|
|
var response, login = new HttpRequest(Azure.tls.options);
|
|
|
|
if (typeof Azure.params.proxy !== 'undefined' && Azure.params.proxy !== '') {
|
|
login.setProxy(Azure.params.proxy);
|
|
}
|
|
|
|
login.addHeader('Content-Type: application/x-www-form-urlencoded');
|
|
response = login.post(
|
|
'https://login.microsoftonline.com/' + encodeURIComponent(Azure.params.tenant_id) + '/oauth2/token',
|
|
'grant_type=client_credentials&resource=' + encodeURIComponent('https://management.azure.com/') + '&client_id=' + encodeURIComponent(Azure.params.app_id) + '&client_secret=' + encodeURIComponent(Azure.params.password)
|
|
);
|
|
|
|
if (login.getStatus() !== 200) {
|
|
throw 'Login failed with status code ' + login.getStatus() + ': ' + response;
|
|
}
|
|
|
|
try {
|
|
response = JSON.parse(response);
|
|
}
|
|
catch (error) {
|
|
throw 'Failed to parse login session response.';
|
|
}
|
|
|
|
if (!response.hasOwnProperty('access_token')) {
|
|
throw 'Authentication response does not contain access token.';
|
|
}
|
|
|
|
Azure.token = response['access_token'];
|
|
},
|
|
|
|
request: function (url) {
|
|
var response, request = new HttpRequest(Azure.tls.options);
|
|
|
|
if (typeof Azure.params.proxy !== 'undefined' && Azure.params.proxy !== '') {
|
|
request.setProxy(Azure.params.proxy);
|
|
}
|
|
|
|
if (!Azure.token) {
|
|
throw 'Request does not contain access token.';
|
|
}
|
|
|
|
request.addHeader('Content-Type: application/json');
|
|
request.addHeader('Authorization: Bearer ' + Azure.token);
|
|
Zabbix.log(4, '[ Azure Vault ] request url: ' + url);
|
|
|
|
response = request.get(url);
|
|
|
|
if (request.getStatus() !== 200) {
|
|
throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
|
|
}
|
|
|
|
try {
|
|
return JSON.parse(response);
|
|
}
|
|
catch (error) {
|
|
throw 'Failed to parse response received from API.';
|
|
}
|
|
},
|
|
|
|
getField: function (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 was not found: ' + path;
|
|
}
|
|
data = data[step];
|
|
}
|
|
|
|
return data;
|
|
},
|
|
|
|
getMetricsData: function () {
|
|
var data = {},
|
|
end_date = new Date(),
|
|
start_date = new Date();
|
|
|
|
function formatDate(date) {
|
|
var year = date.getFullYear(),
|
|
month = (date.getMonth() + 1),
|
|
day = date.getDate(),
|
|
hours = date.getHours(),
|
|
minutes = date.getMinutes(),
|
|
seconds = date.getSeconds(),
|
|
ampm = hours >= 12 ? 'PM' : 'AM';
|
|
|
|
hours = hours % 12 || 12;
|
|
month = month < 10 ? '0' + month : month;
|
|
day = day < 10 ? '0' + day : day;
|
|
hours = hours < 10 ? '0' + hours : hours;
|
|
minutes = minutes < 10 ? '0' + minutes : minutes;
|
|
seconds = seconds < 10 ? '0' + seconds : seconds;
|
|
|
|
formatted_date = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds + ' ' + ampm;
|
|
|
|
return formatted_date
|
|
};
|
|
|
|
start_date.setDate(start_date.getDate() - Azure.params.period);
|
|
end_date = encodeURIComponent('\'' + formatDate(end_date) + '\'');
|
|
start_date = encodeURIComponent('\'' + formatDate(start_date) + '\'');
|
|
date_filter = '&$filter=' + encodeURIComponent('startTime eq ') + start_date + encodeURIComponent(' and endTime eq ') + end_date;
|
|
|
|
data.health = Azure.getField(Azure.request('https://management.azure.com' + Azure.params.resource_id + '/providers/Microsoft.ResourceHealth/availabilityStatuses?api-version=2020-05-01'), 'value.0.properties');
|
|
data.jobs = Azure.getField(Azure.request('https://management.azure.com' + Azure.params.resource_id + '/backupjobs?api-version=2025-01-01' + date_filter), 'value');
|
|
|
|
return data
|
|
}
|
|
};
|
|
|
|
try {
|
|
Azure.setParams(JSON.parse(value));
|
|
Azure.login();
|
|
return JSON.stringify(Azure.getMetricsData());
|
|
}
|
|
catch (error) {
|
|
error += (String(error).endsWith('.')) ? '' : '.';
|
|
Zabbix.log(3, '[ Azure Vault ] ERROR: ' + error);
|
|
return JSON.stringify({ 'error': error });
|
|
}
|
|
description: 'Gathers data of the Azure vault.'
|
|
timeout: '{$AZURE.DATA.TIMEOUT}'
|
|
parameters:
|
|
- name: app_id
|
|
value: '{$AZURE.APP.ID}'
|
|
- name: password
|
|
value: '{$AZURE.PASSWORD}'
|
|
- name: period
|
|
value: '{$AZURE.VAULT.PERIOD}'
|
|
- name: proxy
|
|
value: '{$AZURE.PROXY}'
|
|
- name: resource_id
|
|
value: '{$AZURE.RESOURCE.ID}'
|
|
- name: subscription_id
|
|
value: '{$AZURE.SUBSCRIPTION.ID}'
|
|
- name: tenant_id
|
|
value: '{$AZURE.TENANT.ID}'
|
|
- name: tls_verify
|
|
value: '{$HTTP.TLS.VERIFY:"Azure Backup Jobs"}'
|
|
tags:
|
|
- tag: component
|
|
value: raw
|
|
- uuid: c5eb6f559a544be89f51ea3f8eee6dab
|
|
name: 'Jobs: Backup'
|
|
type: DEPENDENT
|
|
key: azure.vault.jobs.backup
|
|
delay: '0'
|
|
description: 'The number of backup jobs over the period of `{$AZURE.VAULT.PERIOD}` day(s).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.jobs[?(@.properties.operation == "Backup")].length()'
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: backup
|
|
- uuid: 78a30e56155c4a9c8af1fe54999276fd
|
|
name: 'Jobs: Configuring backup'
|
|
type: DEPENDENT
|
|
key: azure.vault.jobs.backup.config
|
|
delay: '0'
|
|
description: 'The number of backup configuration jobs over the period of `{$AZURE.VAULT.PERIOD}` day(s).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.jobs[?(@.properties.operation == "ConfigureBackup")].length()'
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: backup
|
|
triggers:
|
|
- uuid: 881f3faf12da40458266c62f047c3c1e
|
|
expression: 'change(/Azure Backup Jobs by HTTP/azure.vault.jobs.backup.config)>0'
|
|
recovery_mode: NONE
|
|
name: 'Azure backup jobs: Backup configuration job has appeared'
|
|
opdata: 'Current amount: {ITEM.LASTVALUE1}'
|
|
priority: INFO
|
|
description: 'New backup configuration job has appeared.'
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: notice
|
|
- uuid: 7b6e5f9eb7e74524bf4fa856225ad107
|
|
name: 'Jobs: Deleting backup data'
|
|
type: DEPENDENT
|
|
key: azure.vault.jobs.backup.delete
|
|
delay: '0'
|
|
description: 'The number of backup data deletion jobs over the period of `{$AZURE.VAULT.PERIOD}` day(s).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.jobs[?(@.properties.operation == "DeleteBackupData")].length()'
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: backup
|
|
triggers:
|
|
- uuid: 7d4a36701e3c4384991858c34017b04f
|
|
expression: 'change(/Azure Backup Jobs by HTTP/azure.vault.jobs.backup.delete)>0'
|
|
recovery_mode: NONE
|
|
name: 'Azure backup jobs: Backup data deletion job has appeared'
|
|
opdata: 'Current amount: {ITEM.LASTVALUE1}'
|
|
priority: WARNING
|
|
description: 'New backup data deletion job has appeared.'
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: notice
|
|
- uuid: 7a8af0d3852546e9aa49a3754af4e1f3
|
|
name: 'Jobs: Cancelled'
|
|
type: DEPENDENT
|
|
key: azure.vault.jobs.cancelled
|
|
delay: '0'
|
|
description: 'The number of cancelled jobs over the period of `{$AZURE.VAULT.PERIOD}` day(s).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.jobs[?(@.properties.status == "Cancelled")].length()'
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: backup
|
|
- uuid: 1b2f4f764b2c4a65b824e816094117d5
|
|
name: 'Jobs: Completed'
|
|
type: DEPENDENT
|
|
key: azure.vault.jobs.completed
|
|
delay: '0'
|
|
description: 'The number of completed jobs over the period of `{$AZURE.VAULT.PERIOD}` day(s).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.jobs[?(@.properties.status == "Completed")].length()'
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: backup
|
|
- uuid: 90a112a3ef2b42d2a372b8b4fb5c95fb
|
|
name: 'Jobs: Failed'
|
|
type: DEPENDENT
|
|
key: azure.vault.jobs.failed
|
|
delay: '0'
|
|
description: 'The number of failed jobs over the period of `{$AZURE.VAULT.PERIOD}` day(s).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.jobs[?(@.properties.status == "Failed")].length()'
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: backup
|
|
- uuid: 5b9b00fad0364710b82ed05595848e82
|
|
name: 'Jobs: In progress'
|
|
type: DEPENDENT
|
|
key: azure.vault.jobs.in_progress
|
|
delay: '0'
|
|
description: 'The number of jobs in progress over the period of `{$AZURE.VAULT.PERIOD}` day(s).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.jobs[?(@.properties.status == "InProgress")].length()'
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: backup
|
|
- uuid: 482582a2ac6045dc97be5d2fc19bbe8f
|
|
name: 'Jobs: Restore'
|
|
type: DEPENDENT
|
|
key: azure.vault.jobs.restore
|
|
delay: '0'
|
|
description: 'The number of restore jobs over the period of `{$AZURE.VAULT.PERIOD}` day(s).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.jobs[?(@.properties.operation == "Restore")].length()'
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: backup
|
|
triggers:
|
|
- uuid: 04f76f2f21a043169ac1fa11d42f72f3
|
|
expression: 'change(/Azure Backup Jobs by HTTP/azure.vault.jobs.restore)>0'
|
|
recovery_mode: NONE
|
|
name: 'Azure backup jobs: Restore job has appeared'
|
|
opdata: 'Current amount: {ITEM.LASTVALUE1}'
|
|
priority: AVERAGE
|
|
description: 'New restore job has appeared.'
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: notice
|
|
- uuid: 3024516bc255403b8aaa765b4d376835
|
|
name: 'Jobs: Total'
|
|
type: DEPENDENT
|
|
key: azure.vault.jobs.total
|
|
delay: '0'
|
|
description: 'The number of jobs over the period of `{$AZURE.VAULT.PERIOD}` day(s).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- $.jobs.length()
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: backup
|
|
- uuid: 4ac88439754f426090b0aa454ea4a5ed
|
|
name: 'Jobs: Completed with warnings'
|
|
type: DEPENDENT
|
|
key: azure.vault.jobs.with_warning
|
|
delay: '0'
|
|
description: 'The number of jobs completed with warnings over the period of `{$AZURE.VAULT.PERIOD}` day(s).'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.jobs[?(@.properties.status == "CompletedWithWarnings")].length()'
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: backup
|
|
discovery_rules:
|
|
- uuid: e37ff9885d014939b9ea182ce2087e05
|
|
name: 'Azure backup job discovery'
|
|
type: DEPENDENT
|
|
key: azure.vault.job.discovery
|
|
delay: '0'
|
|
filter:
|
|
evaltype: AND
|
|
conditions:
|
|
- macro: '{#JOB.FRIENDLY.NAME}'
|
|
value: '{$AZURE.JOBS.FRIENDLY.NAME.MATCHES}'
|
|
formulaid: A
|
|
- macro: '{#JOB.FRIENDLY.NAME}'
|
|
value: '{$AZURE.JOBS.FRIENDLY.NAME.NOT.MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: B
|
|
- macro: '{#JOB.OPERATION}'
|
|
value: '{$AZURE.JOBS.OPERATION.MATCHES}'
|
|
formulaid: C
|
|
- macro: '{#JOB.OPERATION}'
|
|
value: '{$AZURE.JOBS.OPERATION.NOT.MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: D
|
|
- macro: '{#JOB.STATUS}'
|
|
value: '{$AZURE.JOBS.STATUS.MATCHES}'
|
|
formulaid: E
|
|
- macro: '{#JOB.STATUS}'
|
|
value: '{$AZURE.JOBS.STATUS.NOT.MATCHES}'
|
|
operator: NOT_MATCHES_REGEX
|
|
formulaid: F
|
|
lifetime: '0'
|
|
description: 'List of backup jobs in the vault.'
|
|
item_prototypes:
|
|
- uuid: 9a46651633ad45d69a2a931259d381ac
|
|
name: 'Job status [{#JOB.FRIENDLY.NAME}, {#JOB.NAME}]'
|
|
type: DEPENDENT
|
|
key: 'azure.vault.job.status[{#JOB.NAME}]'
|
|
delay: '0'
|
|
description: |
|
|
Job status.
|
|
Possible values:
|
|
0 - Unknown
|
|
1 - In progress
|
|
2 - Queued
|
|
3 - Completed
|
|
4 - Completed with warnings
|
|
5 - Failed
|
|
6 - Cancelled
|
|
7 - Expired
|
|
valuemap:
|
|
name: 'Azure backup job status'
|
|
preprocessing:
|
|
- type: JSONPATH
|
|
parameters:
|
|
- '$.jobs[?(@.name == ''{#JOB.NAME}'')].properties.status.first()'
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const idx = {
|
|
'InProgress': 1,
|
|
'Queued': 2,
|
|
'Completed': 3,
|
|
'CompletedWithWarnings': 4,
|
|
'Failed': 5,
|
|
'Cancelled': 6,
|
|
'Expired': 7
|
|
};
|
|
|
|
return typeof idx[value] === 'undefined' ? 0 : idx[value];
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
tags:
|
|
- tag: component
|
|
value: health
|
|
- tag: resource
|
|
value: '{#JOB.FRIENDLY.NAME}'
|
|
trigger_prototypes:
|
|
- uuid: a3a8cb87e41546b0a6550375578cc651
|
|
expression: 'last(/Azure Backup Jobs by HTTP/azure.vault.job.status[{#JOB.NAME}])=6'
|
|
name: 'Azure backup jobs: Job cancelled [{#JOB.NAME}]'
|
|
event_name: 'Azure backup jobs: Job type [{#JOB.OPERATION}] for [{#JOB.FRIENDLY.NAME}] with ID [{#JOB.NAME}] has cancelled.'
|
|
opdata: 'Current status: {ITEM.LASTVALUE1}'
|
|
priority: AVERAGE
|
|
description: 'Job has received "Cancelled" status.'
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: notice
|
|
- uuid: 475a62e73f9c4a2abef6320c6909e7fa
|
|
expression: 'last(/Azure Backup Jobs by HTTP/azure.vault.job.status[{#JOB.NAME}])=4'
|
|
name: 'Azure backup jobs: Job completed with warnings [{#JOB.NAME}]'
|
|
event_name: 'Azure backup jobs: Job type [{#JOB.OPERATION}] for [{#JOB.FRIENDLY.NAME}] with ID [{#JOB.NAME}] has completed with warnings.'
|
|
opdata: 'Current status: {ITEM.LASTVALUE1}'
|
|
priority: WARNING
|
|
description: 'Job has received "Completed with warnings" status.'
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: notice
|
|
- uuid: b7e43dbcd4914f228bb0687f585951ea
|
|
expression: 'last(/Azure Backup Jobs by HTTP/azure.vault.job.status[{#JOB.NAME}])=7'
|
|
name: 'Azure backup jobs: Job expired [{#JOB.NAME}]'
|
|
event_name: 'Azure backup jobs: Job type [{#JOB.OPERATION}] for [{#JOB.FRIENDLY.NAME}] with ID [{#JOB.NAME}] has expired.'
|
|
opdata: 'Current status: {ITEM.LASTVALUE1}'
|
|
priority: AVERAGE
|
|
description: 'Job has received "Expired" status.'
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: notice
|
|
- uuid: f340de23cd004f1b94239dbcf7ec136e
|
|
expression: 'last(/Azure Backup Jobs by HTTP/azure.vault.job.status[{#JOB.NAME}])=5'
|
|
name: 'Azure backup jobs: Job failed [{#JOB.NAME}]'
|
|
event_name: 'Azure backup jobs: Job type [{#JOB.OPERATION}] for [{#JOB.FRIENDLY.NAME}] with ID [{#JOB.NAME}] has failed.'
|
|
opdata: 'Current status: {ITEM.LASTVALUE1}'
|
|
priority: HIGH
|
|
description: 'Job has received "Failed" status.'
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: notice
|
|
- uuid: 860b6d8bbefd4daba537e517dfb94007
|
|
expression: 'last(/Azure Backup Jobs by HTTP/azure.vault.job.status[{#JOB.NAME}])=0'
|
|
name: 'Azure backup jobs: Job status unknown [{#JOB.NAME}]'
|
|
event_name: 'Azure backup jobs: Job type [{#JOB.OPERATION}] for [{#JOB.FRIENDLY.NAME}] with ID [{#JOB.NAME}] is in unknown status.'
|
|
opdata: 'Current status: {ITEM.LASTVALUE1}'
|
|
priority: AVERAGE
|
|
description: 'Job has received "Unknown" status.'
|
|
manual_close: 'YES'
|
|
tags:
|
|
- tag: scope
|
|
value: notice
|
|
master_item:
|
|
key: azure.vault.data.get
|
|
lld_macro_paths:
|
|
- lld_macro: '{#JOB.FRIENDLY.NAME}'
|
|
path: $.entity_friendly_name
|
|
- lld_macro: '{#JOB.NAME}'
|
|
path: $.name
|
|
- lld_macro: '{#JOB.OPERATION}'
|
|
path: $.operation
|
|
- lld_macro: '{#JOB.STATUS}'
|
|
path: $.status
|
|
preprocessing:
|
|
- type: JAVASCRIPT
|
|
parameters:
|
|
- |
|
|
const job_list = JSON.parse(value);
|
|
|
|
const result = job_list.jobs.map(function (job) {
|
|
return {
|
|
'name': job.name,
|
|
'entity_friendly_name': job.properties.entityFriendlyName,
|
|
'status': job.properties.status,
|
|
'operation': job.properties.operation
|
|
};
|
|
});
|
|
|
|
return JSON.stringify(result);
|
|
- type: DISCARD_UNCHANGED_HEARTBEAT
|
|
parameters:
|
|
- 1h
|
|
tags:
|
|
- tag: class
|
|
value: cloud
|
|
- tag: subclass
|
|
value: backup
|
|
- tag: target
|
|
value: azure
|
|
macros:
|
|
- macro: '{$AZURE.APP.ID}'
|
|
description: 'The App ID of Microsoft Azure.'
|
|
- macro: '{$AZURE.DATA.TIMEOUT}'
|
|
value: 15s
|
|
description: 'API response timeout.'
|
|
- macro: '{$AZURE.JOBS.FRIENDLY.NAME.MATCHES}'
|
|
value: '.*'
|
|
description: 'Set the regex string to include backup jobs based on `entityFriendlyName`.'
|
|
- macro: '{$AZURE.JOBS.FRIENDLY.NAME.NOT.MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'Set the regex string to exclude backup jobs based on `entityFriendlyName`.'
|
|
- macro: '{$AZURE.JOBS.OPERATION.MATCHES}'
|
|
value: '.*'
|
|
description: 'Set the regex string to include backup jobs based on operation type.'
|
|
- macro: '{$AZURE.JOBS.OPERATION.NOT.MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'Set the regex string to exclude backup jobs based on operation type.'
|
|
- macro: '{$AZURE.JOBS.STATUS.MATCHES}'
|
|
value: '.*'
|
|
description: 'Set the regex string to include backup jobs based on status.'
|
|
- macro: '{$AZURE.JOBS.STATUS.NOT.MATCHES}'
|
|
value: CHANGE_IF_NEEDED
|
|
description: 'Set the regex string to exclude backup jobs based on status.'
|
|
- macro: '{$AZURE.PASSWORD}'
|
|
type: SECRET_TEXT
|
|
description: 'Microsoft Azure password.'
|
|
- macro: '{$AZURE.PROXY}'
|
|
description: 'Sets the HTTP proxy value. If this macro is empty, then no proxy is used.'
|
|
- macro: '{$AZURE.RESOURCE.ID}'
|
|
description: 'Microsoft Azure vault resource ID.'
|
|
- macro: '{$AZURE.SUBSCRIPTION.ID}'
|
|
description: 'Microsoft Azure subscription ID.'
|
|
- macro: '{$AZURE.TENANT.ID}'
|
|
description: 'Microsoft Azure tenant ID.'
|
|
- macro: '{$AZURE.VAULT.PERIOD}'
|
|
value: '7'
|
|
description: 'The number of days over which to retrieve backup jobs.'
|
|
- 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 "Azure Backup Jobs", e.g. {$HTTP.TLS.VERIFY:"Azure Backup Jobs"}.'
|
|
dashboards:
|
|
- uuid: dd616732edf646cba117f8de257bafba
|
|
name: 'Azure backup jobs'
|
|
pages:
|
|
- name: 'Backup job overview'
|
|
widgets:
|
|
- type: item
|
|
name: 'Total jobs'
|
|
width: '15'
|
|
fields:
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid.0
|
|
value:
|
|
host: 'Azure Backup Jobs by HTTP'
|
|
key: azure.vault.jobs.total
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
- type: item
|
|
name: 'Backup jobs'
|
|
'y': '2'
|
|
width: '15'
|
|
fields:
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid.0
|
|
value:
|
|
host: 'Azure Backup Jobs by HTTP'
|
|
key: azure.vault.jobs.backup
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
- type: itemnavigator
|
|
name: 'Jobs grouped by resource'
|
|
'y': '4'
|
|
width: '22'
|
|
height: '7'
|
|
fields:
|
|
- type: INTEGER
|
|
name: group_by.0.attribute
|
|
value: '3'
|
|
- type: STRING
|
|
name: group_by.0.tag_name
|
|
value: resource
|
|
- type: STRING
|
|
name: items.0
|
|
value: 'Job status [*]'
|
|
- type: STRING
|
|
name: reference
|
|
value: EBACA
|
|
- type: item
|
|
name: 'Selected job'
|
|
'y': '11'
|
|
width: '22'
|
|
height: '1'
|
|
hide_header: 'YES'
|
|
fields:
|
|
- type: STRING
|
|
name: description
|
|
value: 'Selected job status:'
|
|
- type: INTEGER
|
|
name: desc_h_pos
|
|
value: '0'
|
|
- type: INTEGER
|
|
name: desc_size
|
|
value: '60'
|
|
- type: INTEGER
|
|
name: desc_v_pos
|
|
value: '1'
|
|
- type: STRING
|
|
name: itemid._reference
|
|
value: EBACA._itemid
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: value_h_pos
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
- type: item
|
|
name: 'In progress jobs'
|
|
x: '15'
|
|
width: '14'
|
|
fields:
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid.0
|
|
value:
|
|
host: 'Azure Backup Jobs by HTTP'
|
|
key: azure.vault.jobs.in_progress
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '2'
|
|
- type: STRING
|
|
name: thresholds.0.color
|
|
value: 00A1FF
|
|
- type: STRING
|
|
name: thresholds.0.threshold
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
- type: item
|
|
name: 'Restore jobs'
|
|
x: '15'
|
|
'y': '2'
|
|
width: '14'
|
|
fields:
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid.0
|
|
value:
|
|
host: 'Azure Backup Jobs by HTTP'
|
|
key: azure.vault.jobs.restore
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '2'
|
|
- type: STRING
|
|
name: thresholds.0.color
|
|
value: FF465C
|
|
- type: STRING
|
|
name: thresholds.0.threshold
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
- type: honeycomb
|
|
name: 'Job statuses'
|
|
x: '22'
|
|
'y': '4'
|
|
width: '50'
|
|
height: '7'
|
|
fields:
|
|
- type: STRING
|
|
name: items.0
|
|
value: 'Job status [*]'
|
|
- type: STRING
|
|
name: reference
|
|
value: AFAEA
|
|
- type: STRING
|
|
name: secondary_label
|
|
value: '{{ITEM.NAME}.regsub("(Job status \[)(.*)(,.*\])","\2")}'
|
|
- type: INTEGER
|
|
name: secondary_label_type
|
|
value: '0'
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '2'
|
|
- type: STRING
|
|
name: thresholds.0.color
|
|
value: EC1594
|
|
- type: STRING
|
|
name: thresholds.0.threshold
|
|
value: '0'
|
|
- type: STRING
|
|
name: thresholds.1.color
|
|
value: 00A1FF
|
|
- type: STRING
|
|
name: thresholds.1.threshold
|
|
value: '1'
|
|
- type: STRING
|
|
name: thresholds.2.color
|
|
value: 6AC8FF
|
|
- type: STRING
|
|
name: thresholds.2.threshold
|
|
value: '2'
|
|
- type: STRING
|
|
name: thresholds.3.color
|
|
value: 0EC9AC
|
|
- type: STRING
|
|
name: thresholds.3.threshold
|
|
value: '3'
|
|
- type: STRING
|
|
name: thresholds.4.color
|
|
value: FFD54F
|
|
- type: STRING
|
|
name: thresholds.4.threshold
|
|
value: '4'
|
|
- type: STRING
|
|
name: thresholds.5.color
|
|
value: FF465C
|
|
- type: STRING
|
|
name: thresholds.5.threshold
|
|
value: '5'
|
|
- type: STRING
|
|
name: thresholds.6.color
|
|
value: BF00FF
|
|
- type: STRING
|
|
name: thresholds.6.threshold
|
|
value: '6'
|
|
- type: STRING
|
|
name: thresholds.7.color
|
|
value: BAE37D
|
|
- type: STRING
|
|
name: thresholds.7.threshold
|
|
value: '7'
|
|
- type: item
|
|
name: 'Selected job'
|
|
x: '22'
|
|
'y': '11'
|
|
width: '50'
|
|
height: '1'
|
|
hide_header: 'YES'
|
|
fields:
|
|
- type: STRING
|
|
name: description
|
|
value: '{{ITEM.NAME}.regsub("(Job status \[)(.*)(, )(.*)(\])","Resource: \2, Job ID: \4")}'
|
|
- type: INTEGER
|
|
name: desc_h_pos
|
|
value: '0'
|
|
- type: INTEGER
|
|
name: desc_size
|
|
value: '60'
|
|
- type: INTEGER
|
|
name: desc_v_pos
|
|
value: '1'
|
|
- type: STRING
|
|
name: itemid._reference
|
|
value: AFAEA._itemid
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: value_h_pos
|
|
value: '2'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
- type: item
|
|
name: 'Failed jobs'
|
|
x: '29'
|
|
width: '14'
|
|
fields:
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid.0
|
|
value:
|
|
host: 'Azure Backup Jobs by HTTP'
|
|
key: azure.vault.jobs.failed
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '2'
|
|
- type: STRING
|
|
name: thresholds.0.color
|
|
value: FF465C
|
|
- type: STRING
|
|
name: thresholds.0.threshold
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
- type: item
|
|
name: 'Deleting backup data jobs'
|
|
x: '29'
|
|
'y': '2'
|
|
width: '14'
|
|
fields:
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid.0
|
|
value:
|
|
host: 'Azure Backup Jobs by HTTP'
|
|
key: azure.vault.jobs.backup.delete
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '2'
|
|
- type: STRING
|
|
name: thresholds.0.color
|
|
value: FFD54F
|
|
- type: STRING
|
|
name: thresholds.0.threshold
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
- type: item
|
|
name: 'Cancelled jobs'
|
|
x: '43'
|
|
width: '14'
|
|
fields:
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid.0
|
|
value:
|
|
host: 'Azure Backup Jobs by HTTP'
|
|
key: azure.vault.jobs.cancelled
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '2'
|
|
- type: STRING
|
|
name: thresholds.0.color
|
|
value: BF00FF
|
|
- type: STRING
|
|
name: thresholds.0.threshold
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
- type: item
|
|
name: 'Configuring backup jobs'
|
|
x: '43'
|
|
'y': '2'
|
|
width: '14'
|
|
fields:
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid.0
|
|
value:
|
|
host: 'Azure Backup Jobs by HTTP'
|
|
key: azure.vault.jobs.backup.config
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '2'
|
|
- type: STRING
|
|
name: thresholds.0.color
|
|
value: 6AC8FF
|
|
- type: STRING
|
|
name: thresholds.0.threshold
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
- type: item
|
|
name: 'Completed jobs'
|
|
x: '57'
|
|
width: '15'
|
|
fields:
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid.0
|
|
value:
|
|
host: 'Azure Backup Jobs by HTTP'
|
|
key: azure.vault.jobs.completed
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '2'
|
|
- type: STRING
|
|
name: thresholds.0.color
|
|
value: 0EC9AC
|
|
- type: STRING
|
|
name: thresholds.0.threshold
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
- type: item
|
|
name: 'Completed with warning jobs'
|
|
x: '57'
|
|
'y': '2'
|
|
width: '15'
|
|
fields:
|
|
- type: INTEGER
|
|
name: decimal_places
|
|
value: '0'
|
|
- type: ITEM
|
|
name: itemid.0
|
|
value:
|
|
host: 'Azure Backup Jobs by HTTP'
|
|
key: azure.vault.jobs.with_warning
|
|
- type: INTEGER
|
|
name: show.0
|
|
value: '4'
|
|
- type: INTEGER
|
|
name: show.1
|
|
value: '2'
|
|
- type: STRING
|
|
name: thresholds.0.color
|
|
value: FFD54F
|
|
- type: STRING
|
|
name: thresholds.0.threshold
|
|
value: '1'
|
|
- type: INTEGER
|
|
name: value_size
|
|
value: '60'
|
|
valuemaps:
|
|
- uuid: f79314c2d4bb458caf510b85f65cae81
|
|
name: 'Azure backup job status'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Unknown
|
|
- value: '1'
|
|
newvalue: InProgress
|
|
- value: '2'
|
|
newvalue: Queued
|
|
- value: '3'
|
|
newvalue: Completed
|
|
- value: '4'
|
|
newvalue: CompletedWithWarnings
|
|
- value: '5'
|
|
newvalue: Failed
|
|
- value: '6'
|
|
newvalue: Cancelled
|
|
- value: '7'
|
|
newvalue: Expired
|
|
- uuid: 7bca76cc48c3468ca67b924f59003e4a
|
|
name: 'Azure resource health state'
|
|
mappings:
|
|
- value: '0'
|
|
newvalue: Available
|
|
- value: '1'
|
|
newvalue: Degraded
|
|
- value: '2'
|
|
newvalue: Unavailable
|
|
- value: '3'
|
|
newvalue: Unknown
|