REST APIからJSON形式でVeeamの設定情報をエクスポート、インポート[Veeam Backup & Replication]


v11でVeeam Backup & Replication自体のREST API追加されました。

このREST APIではJSON形式で一部設定情報をエクスポート、インポートでき、これを利用して多数のVeeam Backupサーバの設定を自動化する、バックアップサーバの移行時に一部設定だけ移行するといった操作も可能です。

今回はこの機能の注意点と実際にエクスポートで出力される情報を紹介をしていきます。

※Veeam公式の RESTFul API エンドポイントと Powershell コマンドレットの動作までをサポ―トしており、PowerShellやREST APIで作成されたスクリプト自体を弊社クライムや開発元Veeamではサポートしていないことにご注意ください。

まず、注意点として、現在のバージョン12.1.2.172でエクスポート、インポートできる設定ですが、以下に限られています。

  • vSphereバックアップジョブ
  • サーバ認証情報
  • クラウド認証情報
  • 暗号化パスワード設定情報
  • 管理対象サーバ情報
  • バックアップリポジトリ(スケールアウトやエクスターナルリポジトリは含みません)
  • vSphereバックアッププロキシ

このため、vSphere環境以外ですと、ジョブ設定はエクスポートできず、vSphere環境でもレプリケーションジョブには対応できないなど、まだ利用できる範囲が限られるものとはなっています。

次に認証情報や暗号化のパスワードやパスフレーズ、シークレットキーなどは空の状態でエクスポートされます。インポートする際には手動で追加する必要があります。

最後にインポートを行う際には以下の順番でインポートし、前提となる情報からインポートしていく必要があります。

  1. 認証情報と暗号化パスワード
  2. 管理対象サーバ
  3. バックアップリポジトリ
  4. バックアッププロキシ
  5. バックアップジョブ

REST APIの具体的な使用方法については下記をご参照いただければと存じますが、

実際にエクスポートされるJSONとしては以下のようなものとなっており、テキストベースでジョブ設定等を確認や比較できますので、便利なものになっています。

認証情報のエクスポート例

{
    "credentials": [
        {
            "type": "Linux",
            "username": "username01",
            "password": "",
            "description": "Linux account",
            "tag": "main-linux-credentials",
            "linuxAdditionalSettings": {
                "SSHPort": 22,
                "autoElevated": true,
                "addToSudoers": false,
                "useSu": false,
                "privateKey": "",
                "passphrase": "",
                "rootPassword": ""
            }
        },
        {
            "type": "Linux",
            "username": "linux01",
            "password": "",
            "description": "Linux account",
            "tag": "linux01",
            "linuxAdditionalSettings": {
                "SSHPort": 22,
                "autoElevated": false,
                "addToSudoers": false,
                "useSu": false,
                "privateKey": "",
                "passphrase": "",
                "rootPassword": ""
            }
        }
        {
            "type": "Standard",
            "username": "tech\\username02",
            "password": "",
            "description": "Domain account",
            "tag": "main-domain-credentials",
            "linuxAdditionalSettings": null
        },
        {
            "type": "Standard",
            "username": "srv05\\username03",
            "password": "",
            "description": "srv05 account",
            "tag": "main-standard-credentials",
            "linuxAdditionalSettings": null
        
    ]
}

管理対象サーバのエクスポート例

{
    "windowsHosts": [],
    "linuxHosts": [
        {
            "type": "LinuxHost",
            "name": "enterprise05.tech.local",
            "description": "Created by REST API",
            "credentials": {
                "credentialsName": "username01",
                "credentialsTag": "main-linux-credentials"
            },
            "sshSettings": {
                "sshTimeOutMs": 20000,
                "portRangeStart": 2500,
                "portRangeEnd": 3300,
                "serverThisSide": false,
                "managementPort": 6162
            },
            "sshFingerprint": "ssh-rsa a9:8d:82:e6:2e:1a:d7:0a:44:5a:b0:14:22:f1:b8:e8"
        }
    ],
    "viHosts": [
        {
            "type": "ViHost",
            "viHostType": "VC",
            "name": "vcenter01.tech.local",
            "description": "",
            "credentials": {
                "credentialsName": "tech\\username02",
                "credentialsTag": "main-domain-credentials"
            },
            "port": 443,
            "certificateThumbprint": "9A60A379FAA0F1359C2696A0E20C0DA03D539E0A"
        },
        {
            "type": "ViHost",
            "viHostType": "VC",
            "name": "vcenter02.tech.local",
            "description": "Added by REST",
            "credentials": {
                "credentialsName": "tech\\username02",
                "credentialsTag": "main-domain-credentials"
            },
            "port": 443,
            "certificateThumbprint": "B551C4433DA504184FBFDC370585E2F7B19EB0A4"
        }
    ]
}

リポジトリのエクスポート例

{
    "WindowsLocalRepositories": [
        {
            "type": "WinLocal",
            "name": "Main Big Repository",
            "description": "Created by REST API",
            "tag": "9FE108322924417FB67582B9004CEF61",
            "hostName": "srv04.tech.local",
            "repository": {
                "path": "D:\\Backups",
                "maxTaskCount": 8,
                "readWriteRate": 0,
                "advancedSettings": {
                    "alignDataBlocks": false,
                    "decompressBeforeStoring": false,
                    "rotatedDrives": false,
                    "perVmBackup": false
                }
            },
            "mountServer": {
                "mountServerName": "srv04.tech.local",
                "writeCacheFolder": "D:\\ProgramData\\Veeam\\Backup\\",
                "vPowerNFSEnabled": true,
                "vPowerNFSPortSettings": {
                    "mountPort": 1058,
                    "vPowerNFSPort": 1058
                }
            }
        }
    ],
    "LinuxLocalRepositories": [
        {
            "type": "LinuxLocal",
            "name": "Linux Direct Backup Repository 1",
            "description": "Created by REST API",
            "tag": "7365D8BED68B4CEA803FBA7414B3F01D",
            "hostName": "enterprise05.tech.local",
            "repository": {
                "path": "/backups",
                "maxTaskCount": 4,
                "readWriteRate": 0,
                "useFastCloningOnXFSVolumes": false,
                "useImmutableBackups": false,
                "makeRecentBackupsImmutableDays": 7,
                "advancedSettings": {
                    "alignDataBlocks": true,
                    "decompressBeforeStoring": false,
                    "rotatedDrives": false,
                    "perVmBackup": false
                }
            },
            "mountServer": {
                "mountServerName": "srv04.tech.local",
                "writeCacheFolder": "D:\\ProgramData\\Veeam\\Backup\\",
                "vPowerNFSEnabled": false,
                "vPowerNFSPortSettings": {
                    "mountPort": 1058,
                    "vPowerNFSPort": 1058
                }
            }
        }
    ],
    "SmbRepositories": [
        {
            "type": "Smb",
            "name": "Backup Repository SMB",
            "description": "Created by REST API",
            "tag": "08C739C306774C44A2D504D36ACCC798",
            "share": {
                "sharePath": "\\\\srv05.tech.local\\Share",
                "credentials": {
                    "credentialsName": "srv05\\username03",
                    "credentialsTag": "main-standard-credentials"
                },
                "gatewayServer": {
                    "autoSelect": true,
                    "gatewayServerName": null
                }
            },
            "repository": {
                "maxTaskCount": 4,
                "readWriteRate": 0,
                "advancedSettings": {
                    "alignDataBlocks": true,
                    "decompressBeforeStoring": false,
                    "rotatedDrives": false,
                    "perVmBackup": false
                }
            },
            "mountServer": {
                "mountServerName": "srv04.tech.local",
                "writeCacheFolder": "D:\\ProgramData\\Veeam\\Backup\\",
                "vPowerNFSEnabled": true,
                "vPowerNFSPortSettings": {
                    "mountPort": 1058,
                    "vPowerNFSPort": 1058
                }
            }
        }
    ],
    "NfsRepositories": [
        {
            "type": "Nfs",
            "name": "Linux NFS Backup Repository 1",
            "description": "Created by REST API",
            "tag": "2E9D8E8F0A8A4A449E2152701B258D47",
            "share": {
                "sharePath": "enterprise05.tech.local:/var/nfs/general",
                "gatewayServer": {
                    "autoSelect": true,
                    "gatewayServerName": null
                }
            },
            "repository": {
                "maxTaskCount": 4,
                "readWriteRate": 0,
                "advancedSettings": {
                    "alignDataBlocks": true,
                    "decompressBeforeStoring": false,
                    "rotatedDrives": false,
                    "perVmBackup": false
                }
            },
            "mountServer": {
                "mountServerName": "srv04.tech.local",
                "writeCacheFolder": "D:\\ProgramData\\Veeam\\Backup\\",
                "vPowerNFSEnabled": false,
                "vPowerNFSPortSettings": {
                    "mountPort": 1058,
                    "vPowerNFSPort": 1058
                }
            }
        }
    ]
}

ジョブのエクスポート例

{
    "jobs": [
        {
            "type": "Backup",
            "name": "Backup Job 2",
            "description": "Created by REST API",
            "isHighPriority": false,
            "virtualMachines": {
                "includes": [
                    {
                        "type": "ResourcePool",
                        "hostName": "vcenter02.tech.local",
                        "name": "likhtarovich",
                        "objectId": "resgroup-32774"
                    }
                ],
                "excludes": {
                    "vms": [],
                    "disks": [
                        {
                            "disksToProcess": "AllDisks",
                            "vmObject": {
                                "type": "ResourcePool",
                                "hostName": "vcenter02.tech.local",
                                "name": "likhtarovich",
                                "objectId": "resgroup-32774"
                            },
                            "disks": [],
                            "removeFromVMConfiguration": true
                        }
                    ],
                    "templates": {
                        "isEnabled": true,
                        "excludeFromIncremental": true
                    }
                }
            },
            "storage": {
                "backupRepository": {
                    "name": "Main Big Repository",
                    "tag": "9FE108322924417FB67582B9004CEF61"
                },
                "backupProxies": {
                    "automaticSelection": true,
                    "proxies": []
                },
                "retentionPolicy": {
                    "type": "RestorePoints",
                    "quantity": 7
                },
                "gfsPolicy": {
                    "isEnabled": false,
                    "weekly": {
                        "desiredTime": "sunday",
                        "isEnabled": false,
                        "keepForNumberOfWeeks": 1
                    },
                    "monthly": {
                        "desiredTime": "First",
                        "isEnabled": false,
                        "keepForNumberOfMonths": 1
                    },
                    "yearly": {
                        "desiredTime": "January",
                        "isEnabled": false,
                        "keepForNumberOfYears": 1
                    }
                },
                "advancedSettings": {
                    "backupModeType": "Incremental",
                    "synthenticFulls": {
                        "isEnabled": true,
                        "days": [
                            "saturday"
                        ]
                    },
                    "activeFulls": {
                        "isEnabled": false,
                        "weekly": {
                            "isEnabled": true,
                            "days": [
                                "saturday"
                            ]
                        },
                        "monthly": {
                            "dayOfWeek": "monday",
                            "dayNumberInMonth": "First",
                            "isEnabled": false,
                            "dayOfMonths": 1,
                            "months": [
                                "January",
                                "February",
                                "March",
                                "April",
                                "May",
                                "June",
                                "July",
                                "August",
                                "September",
                                "October",
                                "November",
                                "December"
                            ]
                        }
                    },
                    "backupHealth": {
                        "isEnabled": true,
                        "weekly": {
                            "isEnabled": false,
                            "days": [
                                "friday"
                            ]
                        },
                        "monthly": {
                            "dayOfWeek": "monday",
                            "dayNumberInMonth": "First",
                            "isEnabled": true,
                            "dayOfMonths": 1,
                            "months": [
                                "March",
                                "July",
                                "November"
                            ]
                        }
                    },
                    "fullBackupMaintenance": {
                        "RemoveData": {
                            "isEnabled": false,
                            "afterDays": 14
                        },
                        "defragmentAndCompact": {
                            "isEnabled": false,
                            "weekly": {
                                "isEnabled": false,
                                "days": [
                                    "saturday"
                                ]
                            },
                            "monthly": {
                                "dayOfWeek": "saturday",
                                "dayNumberInMonth": "Last",
                                "isEnabled": true,
                                "dayOfMonths": 1,
                                "months": [
                                    "January",
                                    "February",
                                    "March",
                                    "April",
                                    "May",
                                    "June",
                                    "July",
                                    "August",
                                    "September",
                                    "October",
                                    "November",
                                    "December"
                                ]
                            }
                        }
                    },
                    "storageData": {
                        "compressionLevel": "Optimal",
                        "storageOptimization": "LocalTarget",
                        "enableInlineDataDedup": true,
                        "excludeSwapFileBlocks": true,
                        "excludeDeletedFileBlocks": true,
                        "encryption": {
                            "isEnabled": false,
                            "encryptionPasswordIdOrNull": "00000000-0000-0000-0000-000000000000",
                            "encryptionPasswordTag": null
                        }
                    },
                    "notifications": {
                        "sendSNMPNotifications": false,
                        "emailNotifications": {
                            "notificationType": null,
                            "isEnabled": false,
                            "recipients": [],
                            "customNotificationSettings": null
                        },
                        "vmAttribute": {
                            "isEnabled": false,
                            "notes": "Notes",
                            "appendToExisitingValue": true
                        }
                    },
                    "vSphere": {
                        "enableVMWareToolsQuiescence": false,
                        "changedBlockTracking": {
                            "isEnabled": true,
                            "enableCBTautomatically": true,
                            "resetCBTonActiveFull": true
                        }
                    },
                    "storageIntegration": {
                        "isEnabled": true,
                        "limitProcessedVm": false,
                        "limitProcessedVmCount": 10,
                        "failoverToStandardBackup": false
                    },
                    "scripts": {
                        "periodicityType": "BackupSessions",
                        "preCommand": {
                            "isEnabled": false,
                            "command": ""
                        },
                        "postCommand": {
                            "isEnabled": false,
                            "command": ""
                        },
                        "runScriptEvery": 1,
                        "dayOfWeek": [
                            "saturday"
                        ]
                    }
                }
            },
            "guestProcessing": {
                "applicationAwareProcessing": {
                    "isEnabled": false,
                    "appSettings": []
                },
                "guestFileSystemIndexing": {
                    "isEnabled": true,
                    "indexingSettings": [
                        {
                            "vmObject": {
                                "type": "ResourcePool",
                                "hostName": "vcenter02.tech.local",
                                "name": "likhtarovich",
                                "objectId": "resgroup-32774"
                            },
                            "WindowsIndexing": {
                                "guestFSIndexingMode": "indexAllExcept",
                                "indexingList": [
                                    "%windir%",
                                    "%ProgramFiles%",
                                    "%ProgramFiles(x86)%",
                                    "%ProgramW6432%",
                                    "%TEMP%"
                                ]
                            },
                            "LinuxIndexing": {
                                "guestFSIndexingMode": "indexAllExcept",
                                "indexingList": [
                                    "/cdrom",
                                    "/dev",
                                    "/media",
                                    "/mnt",
                                    "/proc",
                                    "/tmp",
                                    "/lost+found"
                                ]
                            }
                        }
                    ]
                },
                "guestInteractionProxies": {
                    "automaticSelection": true,
                    "proxies": []
                },
                "guestCredentials": {
                    "credentials": {
                        "credentialsName": "tech\\username02",
                        "credentialsTag": "main-domain-credentials"
                    },
                    "credentialsPerMachine": []
                }
            },
            "schedule": {
                "runAutomatically": true,
                "daily": {
                    "dailyKind": "Everyday",
                    "isEnabled": false,
                    "localTime": "10:00 PM",
                    "days": [
                        "sunday",
                        "monday",
                        "tuesday",
                        "wednesday",
                        "thursday",
                        "friday",
                        "saturday"
                    ]
                },
                "monthly": {
                    "dayOfWeek": "saturday",
                    "dayNumberInMonth": "Second",
                    "isEnabled": true,
                    "localTime": "10:00 PM",
                    "dayOfMonth": 1,
                    "months": [
                        "January",
                        "February",
                        "March",
                        "April",
                        "May",
                        "June",
                        "July",
                        "August",
                        "September",
                        "October",
                        "November",
                        "December"
                    ]
                },
                "periodically": {
                    "periodicallyKind": "Hours",
                    "isEnabled": false,
                    "frequency": 24,
                    "backupWindow": {
                        "days": [
                            {
                                "day": "sunday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "monday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "tuesday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "wednesday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "thursday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "friday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "saturday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            }
                        ]
                    }
                },
                "continuously": {
                    "isEnabled": false,
                    "WindowSetting": {
                        "days": [
                            {
                                "day": "sunday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "monday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "tuesday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "wednesday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "thursday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "friday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "saturday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            }
                        ]
                    }
                },
                "afterThisJob": {
                    "isEnabled": false,
                    "jobName": null
                },
                "retry": {
                    "isEnabled": true,
                    "retryCount": 3,
                    "awaitMinutes": 10
                },
                "backupWindow": {
                    "isEnabled": false,
                    "WindowSetting": {
                        "days": [
                            {
                                "day": "sunday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "monday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "tuesday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "wednesday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "thursday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "friday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            },
                            {
                                "day": "saturday",
                                "hours": "1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
                            }
                        ]
                    }
                }
            }
        }
    ]
}
関連トピックス

コメントを残す

メールアドレスが公開されることはありません。

 

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください