A Python library for interacting with the Zerto Virtual Manager (ZVM) API.
This library provides a comprehensive Python interface to manage and automate Zerto Virtual Replication operations. It includes functionality for:
- Managing Virtual Protection Groups (VPGs)
- Handling VM protection and recovery
- Managing checkpoints and recovery points
- Monitoring alerts and events
- Managing licenses
- Configuring service profiles
- Handling encryption detection
- Managing datastores and VRAs
- Working with server date/time settings
- Managing ZORGs (Zerto Organizations)
git clone https://github.com/ZertoPublic/zvml-python-sdk.git
cd zvml-python-sdk
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt- requests
- urllib3
- logging
- json
- typing
The library is organized into several modules:
zvml/- Core library componentsalerts.py- Alert management and monitoringcheckpoints.py- Checkpoint operations and managementcommon.py- Common enums and utilitiesencryptiondetection.py- Encryption detection functionalitylicense.py- License managementlocalsite.py- Local site operationsrecovery_reports.py- Recovery reporting functionalityserver_date_time.py- Server time operationsservice_profiles.py- Service profile configurationtasks.py- Task management and monitoringvirtualization_sites.py- Site management operationsvpgs.py- VPG operations and managementvras.py- VRA deployment and managementzorgs.py- ZORG operations
- Python 3.11+
- Zerto Virtual Replication environment
- Network access to ZVM server
- Keycloak authentication credentials
- Clone the repository
- Install required dependencies
- Configure your Zerto environment credentials
- Run the example scripts to understand basic operations
- Integrate the library into your automation workflows
The library uses Keycloak authentication. You'll need:
- ZVM server address
- Client ID
- Client Secret (* KeyCloak)
- Optional: SSL verification settings
In order to use api client you'll need:
- Login into ZVML keycloak UI. https://///auth
- Select zerto realm (Switch from Master to Zerto using left menu drop box)
- Click on "Clients" using the left menu
- Click on CreateClient button
- Fill in client id (will be used for authentication) and client name (logical), click next
- Enable the following options: "Client authentication", "Authorization", "Standard flow", "Direct access grants", "Implicit flow", "OAuth 2.0 Device Authorization Grant", click next, click save.
- Select "Service account roles" tab, click on "Assign Role" button, check mark "admin" (or another role), click on "Assign" button
- Select "Credentials" tab, copy "Client Secret"
- Use the combination of the created client id and the client secret for authntication in your code
The library includes comprehensive error handling and logging:
- Input validation
- Error status checking
- Detailed error messages
- Operation status logging
Each example script demonstrates specific functionality:
alerts_example.py - Simple alert monitoring and management (list, dismiss, undismiss):
python examples/alerts_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_sslvpg_vms_example.py - VPG creation and VM management between VPGs:
python examples/vpg_vms_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_ssl \
--vm1 "vm-name-1" \
--vm2 "vm-name-2"vpg_failover_example.py - Complete VPG lifecycle including failover testing:
python examples/vpg_failover_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_sslvras_example.py - Interactive VRA deployment and management:
python examples/vras_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_sslzorgs_example.py - ZORG information retrieval and management:
python examples/zorgs_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_ssllicense_example.py - License information and management:
python examples/license_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_sslevents_example.py - Monitor and retrieve Zerto events:
python examples/events_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_sslencryption_detection_example.py - Manage encryption detection settings:
python examples/encryption_detection_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_sslservice_profiles_example.py - Manage service profiles:
python examples/service_profiles_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_sslvolumes_example.py - Manage protected volumes:
python examples/volumes_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_sslserver_date_time_example.py - Manage protected volumes:
python examples/server_date_time_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_ssldatastore_example.py - Manage protected volumes:
python examples/datastore_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_ssllocalsite_example.py - Manage protected volumes:
python examples/localsite_example.py \
--zvm_address "192.168.111.20" \
--client_id "zerto-api" \
--client_secret "your-secret-here" \
--ignore_sslpython examples/peersites_example.py \
--site1_zvm_address <zvm1_address> \
--site1_client_id <client_id1> \
--site1_client_secret <secret1> \
--site2_zvm_address <zvm2_address> \
--site2_client_id <client_id2> \
--site2_client_secret <secret2> \
--ignore_sslpython examples/tweaks_example.py \
--zvm_address <zvm_address> \
--client_id <client_id> \
--client_secret <client_secret> \
--ignore_sslEach example includes detailed comments explaining the functionality and demonstrates proper error handling and best practices for using the ZVML SDK.
Contributions are welcome! Please feel free to submit a Pull Request.
This project includes a legal disclaimer. See the header of each file for details.
For detailed API documentation and examples, please refer to the individual module files and example scripts.