
# Veeam Backup and Replication by HTTP

## Overview

This template is designed to monitor Veeam Backup and Replication.
It works without any external scripts and uses the script item.

***NOTE:*** Since the RESTful API may not be available for some editions, the template will only work with the following editions of Veeam Backup and Replication:

1. Veeam Universal License (VUL) editions:
* Foundation
* Advanced
* Premium

2. Veeam Socket License editions:
* Enterprise Plus Socket  

> See [Veeam Data Platform Feature Comparison](https://www.veeam.com/licensing-pricing.html) for more details.

## Requirements

Zabbix version: 7.0 and higher.

## Tested versions

This template has been tested on:
- Veeam Backup and Replication, version 11.0

## Configuration

> Zabbix should be configured according to the instructions in the [Templates out of the box](https://www.zabbix.com/documentation/7.0/manual/config/templates_out_of_the_box) section.

## Setup

1. Create a user to monitor the service or use an existing read-only account.
> See [Veeam Help Center](https://helpcenter.veeam.com/docs/backup/vbr_rest/reference/vbr-rest-v1-rev2.html?ver=110#tag/Login/operation/CreateToken!path=grant_type&t=request) for more details. 
2. Link the template to a host.
3. Configure the following macros: `{$VEEAM.API.URL}`, `{$VEEAM.USER}`, and `{$VEEAM.PASSWORD}`.

### Macros used

|Name|Description|Default|
|----|-----------|-------|
|{$VEEAM.API.URL}|
The Veeam API endpoint is a URL in the format `<scheme>://<host>:<port>`.
|`https://localhost:9419`|
|{$VEEAM.HTTP.PROXY}|
Sets the HTTP proxy to `http_proxy` value. If this parameter is empty, then no proxy is used.
||
|{$VEEAM.PASSWORD}|
The `password` of the Veeam Backup and Replication account. It is used to obtain an access token.
||
|{$VEEAM.USER}|
The `username` of the Veeam Backup and Replication account. It is used to obtain an access token.
||
|{$VEEAM.DATA.TIMEOUT}|
A response timeout for the API.
|`10`|
|{$CREATED.AFTER}|
Returns sessions that are created after chosen days.
|`7`|
|{$SESSION.NAME.MATCHES}|
This macro is used in discovery rule to evaluate sessions.
|`.*`|
|{$SESSION.NAME.NOT_MATCHES}|
This macro is used in discovery rule to evaluate sessions.
|`CHANGE_IF_NEEDED`|
|{$SESSION.TYPE.MATCHES}|
This macro is used in discovery rule to evaluate sessions.
|`.*`|
|{$SESSION.TYPE.NOT_MATCHES}|
This macro is used in discovery rule to evaluate sessions.
|`CHANGE_IF_NEEDED`|
|{$PROXIES.NAME.MATCHES}|
This macro is used in proxies discovery rule.
|`.*`|
|{$PROXIES.NAME.NOT_MATCHES}|
This macro is used in proxies discovery rule.
|`CHANGE_IF_NEEDED`|
|{$PROXIES.TYPE.MATCHES}|
This macro is used in proxies discovery rule.
|`.*`|
|{$PROXIES.TYPE.NOT_MATCHES}|
This macro is used in proxies discovery rule.
|`CHANGE_IF_NEEDED`|
|{$REPOSITORIES.NAME.MATCHES}|
This macro is used in repositories discovery rule.
|`.*`|
|{$REPOSITORIES.NAME.NOT_MATCHES}|
This macro is used in repositories discovery rule.
|`CHANGE_IF_NEEDED`|
|{$REPOSITORIES.TYPE.MATCHES}|
This macro is used in repositories discovery rule.
|`.*`|
|{$REPOSITORIES.TYPE.NOT_MATCHES}|
This macro is used in repositories discovery rule.
|`CHANGE_IF_NEEDED`|
|{$JOB.NAME.MATCHES}|
This macro is used in discovery rule to evaluate the states of jobs.
|`.*`|
|{$JOB.NAME.NOT_MATCHES}|
This macro is used in discovery rule to evaluate the states of jobs.
|`CHANGE_IF_NEEDED`|
|{$JOB.TYPE.MATCHES}|
This macro is used in discovery rule to evaluate the states of jobs.
|`.*`|
|{$JOB.TYPE.NOT_MATCHES}|
This macro is used in discovery rule to evaluate the states of jobs.
|`CHANGE_IF_NEEDED`|
|{$JOB.STATUS.MATCHES}|
This macro is used in discovery rule to evaluate the states of jobs.
|`.*`|
|{$JOB.STATUS.NOT_MATCHES}|
This macro is used in discovery rule to evaluate the states of jobs.
|`CHANGE_IF_NEEDED`|

### Items

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Get metrics|
The result of API requests is expressed in the JSON.
|Script|veeam.get.metrics|
|Get errors|
The errors from API requests.
|Dependent item|veeam.get.errors
**Preprocessing**

- 
JSON Path: `$.error`

⛔️Custom on fail: Set value to

- 
Discard unchanged with heartbeat: `1h`

|

### Triggers

|Name|Description|Expression|Severity|Dependencies and additional info|
|----|-----------|----------|--------|--------------------------------|
|Veeam Backup: There are errors in requests to API|
Zabbix has received errors in response to API requests.
|`length(last(/Veeam Backup and Replication by HTTP/veeam.get.errors))>0`|Average||

### LLD rule Proxies discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Proxies discovery|
Discovery of proxies.
|Dependent item|veeam.proxies.discovery
**Preprocessing**

- 
JSON Path: `$.proxies.data`

- 
Discard unchanged with heartbeat: `6h`

|

### Item prototypes for Proxies discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Server [{#NAME}]: Get data|
Gets raw data collected by the proxy server.
|Dependent item|veeam.proxy.server.raw[{#NAME}]
**Preprocessing**

- 
JSON Path: `$.managedServers.data.[?(@.id=='{#HOSTID}')].first()`

|
|Proxy [{#NAME}] [{#TYPE}]: Get data|
Gets raw data collected by the proxy with the name `[{#NAME}]`, `[{#TYPE}]`.
|Dependent item|veeam.proxy.raw[{#NAME}]
**Preprocessing**

- 
JSON Path: `$.proxies.data.[?(@.id=='{#ID}')].first()`

|
|Proxy [{#NAME}] [{#TYPE}]: Max Task Count|
The maximum number of concurrent tasks.
|Dependent item|veeam.proxy.maxtask[{#NAME}]
**Preprocessing**

- 
JSON Path: `$.server.maxTaskCount`

|
|Proxy [{#NAME}] [{#TYPE}]: Host name|
The name of the proxy server.
|Dependent item|veeam.proxy.server.name[{#NAME}]
**Preprocessing**

- 
JSON Path: `$.name`

|
|Proxy [{#NAME}] [{#TYPE}]: Host type|
The type of the proxy server.
|Dependent item|veeam.proxy.server.type[{#NAME}]
**Preprocessing**

- 
JSON Path: `$.type`

|

### LLD rule Repositories discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Repositories discovery|
Discovery of repositories.
|Dependent item|veeam.repositories.discovery
**Preprocessing**

- 
JSON Path: `$.repositories_states.data`

- 
Discard unchanged with heartbeat: `6h`

|

### Item prototypes for Repositories discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Repository [{#NAME}] [{#TYPE}]: Get data|
Gets raw data from repository with the name: `[{#NAME}]`, `[{#TYPE}]`.
|Dependent item|veeam.repositories.raw[{#NAME}]
**Preprocessing**

- 
JSON Path: `$.repositories_states.data.[?(@.id=='{#ID}')].first()`

|
|Repository [{#NAME}] [{#TYPE}]: Used space [{#PATH}]|
Used space by repositories expressed in gigabytes (GB).
|Dependent item|veeam.repository.capacity[{#NAME}]
**Preprocessing**

- 
JSON Path: `$.usedSpaceGB`

|
|Repository [{#NAME}] [{#TYPE}]: Free space [{#PATH}]|
Free space of repositories expressed in gigabytes (GB).
|Dependent item|veeam.repository.free.space[{#NAME}]
**Preprocessing**

- 
JSON Path: `$.freeGB`

|

### LLD rule Sessions discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Sessions discovery|
Discovery of sessions.
|Dependent item|veeam.sessions.discovery
**Preprocessing**

- 
JSON Path: `$.sessions.data`

- 
JavaScript: `The text is too long. Please see the template.`

- 
Discard unchanged with heartbeat: `6h`

|

### Item prototypes for Sessions discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Session [{#NAME}] [{#TYPE}]: Get data|
Gets raw data from session with the name: `[{#NAME}]`, `[{#TYPE}]`.
|Dependent item|veeam.sessions.raw[{#ID}]
**Preprocessing**

- 
JSON Path: `$.sessions.data.[?(@.id=='{#ID}')].first()`

⛔️Custom on fail: Discard value

|
|Session [{#NAME}] [{#TYPE}]: State|
The state of the session. The enums used: `Stopped`, `Starting`, `Stopping`, `Working`, `Pausing`, `Resuming`, `WaitingTape`, `Idle`, `Postprocessing`, `WaitingRepository`, `WaitingSlot`.
|Dependent item|veeam.sessions.state[{#ID}]
**Preprocessing**

- 
JSON Path: `$.state`

|
|Session [{#NAME}] [{#TYPE}]: Result|
The result of the session. The enums used: `None`, `Success`, `Warning`, `Failed`.
|Dependent item|veeam.sessions.result[{#ID}]
**Preprocessing**

- 
JSON Path: `$.result.result`

|
|Session [{#NAME}] [{#TYPE}]: Message|
A message that explains the session result.
|Dependent item|veeam.sessions.message[{#ID}]
**Preprocessing**

- 
JSON Path: `$.result.message`

|
|Session progress percent [{#NAME}] [{#TYPE}]|
The progress of the session expressed as percentage.
|Dependent item|veeam.sessions.progress.percent[{#ID}]
**Preprocessing**

- 
JSON Path: `$.progressPercent`

|

### Trigger prototypes for Sessions discovery

|Name|Description|Expression|Severity|Dependencies and additional info|
|----|-----------|----------|--------|--------------------------------|
|Veeam Backup: Last result session failed||`find(/Veeam Backup and Replication by HTTP/veeam.sessions.result[{#ID}],,"like","Failed")=1`|Average|**Manual close**: Yes|

### LLD rule Jobs states discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Jobs states discovery|
Discovery of the jobs states.
|Dependent item|veeam.job.state.discovery
**Preprocessing**

- 
JSON Path: `$.jobs_states.data`

- 
Discard unchanged with heartbeat: `6h`

|

### Item prototypes for Jobs states discovery

|Name|Description|Type|Key and additional info|
|----|-----------|----|-----------------------|
|Job states [{#NAME}] [{#TYPE}]: Get data|
Gets raw data from the job states with the name `[{#NAME}]`.
|Dependent item|veeam.jobs.states.raw[{#ID}]
**Preprocessing**

- 
JSON Path: `$.jobs_states.data.[?(@.id=='{#ID}')].first()`

|
|Job states [{#NAME}] [{#TYPE}]: Status|
The current status of the job. The enums used: `running`, `inactive`, `disabled`.
|Dependent item|veeam.jobs.status[{#ID}]
**Preprocessing**

- 
JSON Path: `$.status`

|
|Job states [{#NAME}] [{#TYPE}]: Last result|
The result of the session. The enums used: `None`, `Success`, `Warning`, `Failed`.
|Dependent item|veeam.jobs.last.result[{#ID}]
**Preprocessing**

- 
JSON Path: `$.lastResult`

|

### Trigger prototypes for Jobs states discovery

|Name|Description|Expression|Severity|Dependencies and additional info|
|----|-----------|----------|--------|--------------------------------|
|Veeam Backup: Last result job failed||`find(/Veeam Backup and Replication by HTTP/veeam.jobs.last.result[{#ID}],,"like","Failed")=1`|Average|**Manual close**: Yes|

## Feedback

Please report any issues with the template at [`https://support.zabbix.com`](https://support.zabbix.com)

You can also provide feedback, discuss the template, or ask for help at [`ZABBIX forums`](https://www.zabbix.com/forum/zabbix-suggestions-and-feedback)

