This guide explains how to use the maintenanceWindowAutomation.py script to add or remove Maintenance Windows (MW) and Schedule Entries in JetPatch using a CSV file and REST API.
Prerequisites
1. Jetpatch Manager version 4.2.8.254 UR6 and up
2. Python version 3.4 and up on the JetPatch server (via the intigua-python-client RPM)
3. SSH to JetPatch server and copy the attached shell script to /opt/intigua-python-client/
4. Maintenance Window names should already be created, this script just adds new entries
5. For append / delete_add create a CSV file
Format:
maintenanceWindowName,maintenanceScheduleName,startDate,endDate,repeatType,repeatCount,daysOfWeek,dayInMonth
Examples:
To Remove Maintenance Window
You can add the Maintenance window names line by line.
maintenanceWindowName 24/7 test_maintenance_Window
For Remove Maintenance schedules(entries),
MaintenanceWindow,MaintenanceSchedule test_maintenance_Window,Schedule_test
For Append/delete_add Kindly follow below format in csv.
MaintenanceWindow,MaintenanceSchedule1,2025-04-15 9:00:00,2026-04-30 16:00:00,daily,1,, MaintenanceWindow,MaintenanceSchedule2,2025-04-15 9:00:00,2026-04-30 16:00:00,weekly,1,"['MONDAY','TUESDAY']",, MaintenanceWindow,MaintenanceSchedule3,2025-04-15 9:00:00,2026-04-30 16:00:00,monthly,1,,20 MaintenanceWindow,MaintenanceSchedule4,2025-01-15 9:00:00,2026-04-30 16:00:00,oneShot,,, MaintenanceWindow,MaintenanceSchedule5,2025-04-15 9:00:00,2026-04-30 16:00:00,allTime,,,
6. For delete_mw / delete_schedules create a CSV file
maintenanceWindowName 24/7 test
7. Create API key, refer to Granting API Permission URL for more details.
Using Script:
Supported Actions:
| Action | Description |
|---|---|
append |
Add new schedule entries to existing Maintenance Windows based on names provided in CSV. |
delete_all_mw |
Delete all Maintenance Windows and their schedules (does not require a CSV file). |
delete_mw |
Delete specific Maintenance Windows based on names provided in CSV. |
delete_schedules |
Delete all schedule entries from specified Maintenance Windows based on names provided in CSV. |
delete_add |
Delete existing schedules from all Maintenance Windows and add new ones based on names provided in CSV. |
How to Run the Script
Note: If we are running the script in same JetPatch Server, use managerIPAddress as localhost/127.0.0.1
python3 maintenanceWindowAutomation.py \
--managerIPAddress <JetPatch_IP_or_DNS> \
--user <username> \
--apikey <API_KEY> \
--csvPath "csv_file.csv" \
--action <action_name>
Comments
0 comments
Please sign in to leave a comment.