check_veeam_backups

check_veeam_backups

A Python-based Icinga2 plugin to monitor Veeam Backup & Replication v12 using the native REST API. It provides a comprehensive health check of backup jobs and repository storage status, including performance data for graphing.


Requirements

Requirement Version
Python ≥ 3.6
requests ≥ 2.25
urllib3 ≥ 1.26

Installation

apt-get install python3-requests git
git clone https://gitlab.easter-eggs.com/brenard/check_veeam_backups.git \
  /usr/local/src/check_veeam_backups
ln -s /usr/local/src/check_veeam_backups/check_veeam_backups \
  /usr/local/lib/nagios/plugins/check_veeam_backups

Usage

Minimal invocation

check_veeam_backups -H 192.168.1.31 -u "DOMAIN\Administrator" -p "Password123" -k

Advanced invocation

# Monitor with custom thresholds and debug output
check_veeam_backups \
  --host vbr-server.local \
  --user "svc-monitoring" \
  --password "SecretPass" \
  --warning-pct 15 \
  --critical-pct 8 \
  --timeout 20 \
  --debug

Command-line Reference

Veeam v12 REST API Options

Argument Default Description
-H, --host Required IP address or FQDN of the Veeam Backup server.
-P, --port 9419 TCP port for the REST API service.
-u, --user Required Windows or Domain user with API access permissions.
-p, --password Required Password for the specified user.
-k, --insecure False Skip SSL certificate verification (useful for self-signed certs).
-t, --timeout 10 Request timeout in seconds.
-V, --api-version 1.2-rev0 Mandatory x-api-version header for Veeam v12.

Monitoring Thresholds & Logging

Argument Default Description
-w, --warning-pct 10 Free space percentage threshold for WARNING status on repositories.
-C, --critical-pct 5 Free space percentage threshold for CRITICAL status on repositories.
-d, --debug False Enable detailed debug logging on stderr.

Plugin Output

The plugin follows the standard Nagios/Icinga2 output format: STATUS - Summary Message | Performance Data

Example Output

OK State:

OK - All jobs and repositories are healthy | running_jobs=1;0;0;5 warn_jobs=0;0;0;5 failed_jobs=0;0;0;5 default_backup_repository=5294.9GB;1490.2;745.1;14902
Job AD Backup is running, last run on 2024-02-04T21:40:34 (result: Success)
Repo Default Backup Repository space used at 35.5% (free space=5294.9 on 14902GB)

Critical State:

CRITICAL - Job WebServer_Daily failed, Repo Backup_SATA is OFFLINE | ...

Integration with Icinga2

1. CheckCommand Definition

object CheckCommand "veeam_backups" {
  import "ipv4-or-ipv6"
  command = [ "/usr/local/lib/nagios/plugins/check_veeam_backups" ]

  arguments = {
    "-H" = "$veeam_host$"
    "-P" = "$veeam_port$"
    "-u" = "$veeam_user$"
    "-p" = "$veeam_password$"
    "-k" = {
      set_if = "$veeam_insecure$"
    }
    "-w" = "$veeam_warning_pct$"
    "-C" = "$veeam_critical_pct$"
    "-V" = {
      value = "$veeam_api_version$"
      set_if = {{ macro("$veeam_api_version$") != false }}
    }
  }

  vars.veeam_host = "$check_address$"
  vars.veeam_port = 9419
  vars.veeam_insecure = false
  vars.veeam_warning_pct = 10
  vars.veeam_critical_pct = 5
  vars.veeam_api_version = false
}

2. Service Template

apply Service "Veeam Health" {
    import "generic-service"
    check_command = "veeam_backups"

    vars.veeam_user = "MONITOR\\icinga_user"
    vars.veeam_password = "secure_password"

    assign where host.vars.os == "Windows" && host.vars.role == "backup-server"
}

Exit Codes

Code Status Meaning
0 OK All jobs succeeded (or are running) and repositories are online with sufficient space.
1 WARNING At least one job ended with a Warning, or repository space is below the warning threshold.
2 CRITICAL At least one job Failed, or a repository is Offline, or space is below the critical threshold.
3 UNKNOWN API connection failure, invalid credentials, or internal script error.

Troubleshooting

  • 404 Errors: Ensure the "Veeam Backup REST API Service" is running on the Windows server and that the port (9419) is open in the firewall.
  • SSL Errors: If you haven't installed a commercial certificate on your Veeam server, you must use the -k or --insecure flag.
  • Authentication: Ensure your user has the "Veeam Backup Administrator" or "Veeam Backup Viewer" role assigned within the Veeam Console.

Would you like me to add a section on how to troubleshoot specific REST API error codes in this README?


Copyright

Copyright (c) 2026 Benjamin Renard


License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.