Files
Veeam_jobs_disable/README.md
2026-07-16 13:07:09 +07:00

143 lines
4.1 KiB
Markdown

# Veeam Backup Jobs for Zabbix
This repository contains PowerShell scripts for Veeam Backup & Replication:
- `Monitor-VeeamJobs.ps1` collects job metrics for Zabbix.
- `NotifyOfDisabledJobs.ps1` sends an email when disabled jobs are detected.
- `zabbix-templete-veeam-jobs.xml` imports the Zabbix 7.0 template.
## Zabbix collector output
`Monitor-VeeamJobs.ps1` prints one compressed JSON object by default:
```json
{
"total": 10,
"disabled": 1,
"successful": 7,
"error": 1,
"warning": 1,
"disabled_names": "Disabled job",
"disabled_excluded_names": "Policy disabled by design",
"error_names": "Failed job",
"warning_names": "Warning job",
"jobs_table": "Name | Enabled | Last run | Next run | Result | Restore points\n...",
"jobs_lld": {
"data": [
{
"{#VEEAMJOBKEY}": "RGFpbHkgYmFja3Vw",
"{#VEEAMJOBNAME}": "Daily backup"
}
]
},
"jobs": [
{
"key": "RGFpbHkgYmFja3Vw",
"name": "Daily backup",
"enabled": true,
"enabled_numeric": 1,
"enabled_text": "yes",
"last_run": "2026-07-16 01:00:00",
"next_run": "2026-07-17 01:00:00",
"last_result": "Success",
"last_state": "Stopped",
"result": "Success",
"restore_points": 14,
"restore_points_text": "14",
"summary": "Enabled: yes | Last: 2026-07-16 01:00:00 | Next: 2026-07-17 01:00:00 | Result: Success | Restore points: 14"
}
]
}
```
Restore point counting is best effort. The script uses `Get-VBRBackup` and
`Get-VBRRestorePoint` when both cmdlets are available; if Veeam cannot map a job
to backups in the current environment, the job remains visible and its restore
point count is shown as `-`.
## Discovered per-job items
The template uses a dependent low-level discovery rule:
```text
veeam.jobs.discovery
```
It creates one set of discovered items per Veeam job:
```text
veeam.job.enabled[{#VEEAMJOBKEY}]
veeam.job.last_run[{#VEEAMJOBKEY}]
veeam.job.next_run[{#VEEAMJOBKEY}]
veeam.job.result[{#VEEAMJOBKEY}]
veeam.job.restore_points[{#VEEAMJOBKEY}]
veeam.job.summary[{#VEEAMJOBKEY}]
```
`{#VEEAMJOBNAME}` is stored as a tag named `veeam_job`, so Zabbix views and
dashboard widgets can group or filter the discovered items by job name. The
legacy `veeam.jobs.table` item remains available as a quick text overview, but
the discovered items are the preferred way to build a dashboard.
For a compact dashboard list, use the discovered summary item:
```text
Veeam job [JOB_NAME]: Summary
```
It displays one line per job:
```text
Enabled: yes | Last: 2026-07-16 01:00:00 | Next: - | Result: Success | Restore points: 14
```
## Zabbix dashboard idea
Create a dashboard named `Veeam Jobs` for hosts linked to the `Veeam Backup Jobs`
template.
Suggested widgets:
| Area | Widget | Items |
| --- | --- | --- |
| Top row | Item value | `veeam.jobs.total` |
| Top row | Item value | `veeam.jobs.successful` |
| Top row | Item value | `veeam.jobs.disabled` |
| Top row | Item value | `veeam.jobs.error` |
| Top row | Item value | `veeam.jobs.warning` |
| Middle | Item list | discovered `Veeam job [*]: Summary` items |
| Bottom left | Item value or item list | `veeam.jobs.error.names` |
| Bottom center | Item value or item list | `veeam.jobs.warning.names` |
| Bottom right | Item value or item list | `veeam.jobs.disabled.names` |
Use a red threshold for `veeam.jobs.error`, yellow for `veeam.jobs.warning`, and
keep `veeam.jobs.disabled` aligned with the existing exclusion policy. The
template intentionally keeps `veeam.jobs.disabled.excluded.names`, because some
disabled policies are expected.
## Email notification script
`NotifyOfDisabledJobs.ps1` sends an email if one or more Veeam jobs are disabled.
To exclude expected disabled jobs, add keywords to:
```text
C:\Scripts\Veeam\NotifyOfDisabledJobs_EXCLUSIONS.IN
```
Example exclusions:
```text
Backup_FILE01
Backup_FILE47
Replication_FILE
```
Example batch launch:
```bat
powershell.exe c:\scripts\Veeam\NotifyOfDisabledJobs.ps1
```
The original workflow runs this check every four hours, so intentionally disabled
jobs can be excluded while unexpected disabled jobs still raise a notification.