-
Notifications
You must be signed in to change notification settings - Fork 7
Added support for Proxmox Backup server and accompanying OOB dashboar… #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| { | ||
| "name": "pbsBackupGroups", | ||
| "displayName": "Backup Groups", | ||
| "description": "Backup groups (VMs, containers, and hosts backed up) within a datastore", | ||
| "tags": ["Backup Server", "Datastore", "Backup Group"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "config": { | ||
| "baseUrl": "{{dataSource.pbsHost}}/api2/json", | ||
| "httpMethod": "get", | ||
| "endpointPath": "/admin/datastore/{{object.rawId}}/groups", | ||
| "headers": [ | ||
| { | ||
| "key": "Authorization", | ||
| "value": "PBSAPIToken {{dataSource.pbsTokenId}}:{{dataSource.pbsTokenSecret}}" | ||
| } | ||
| ], | ||
| "postRequestScript": "pbsBackupGroups.js" | ||
| }, | ||
| "matches": { "sourceType": { "type": "oneOf", "values": ["Proxmox Backup Datastore"] } }, | ||
| "metadata": [ | ||
| { "name": "groupId", "displayName": "Group ID", "shape": "string", "visible": false }, | ||
| { "name": "name", "displayName": "Name", "shape": "string", "role": "label" }, | ||
| { "name": "store", "displayName": "Datastore", "shape": "string" }, | ||
| { "name": "backupType", "displayName": "Backup Type", "shape": "string" }, | ||
| { "name": "backupId", "displayName": "Backup ID", "shape": "string" }, | ||
| { "name": "owner", "displayName": "Owner", "shape": "string" }, | ||
| { "name": "lastBackup", "displayName": "Last Backup", "shape": "timestamp" }, | ||
| { "name": "backupCount", "displayName": "Backup Count", "shape": "number" } | ||
| ], | ||
| "timeframes": false | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "name": "pbsDatastoreUsage", | ||
| "displayName": "Backup Server Datastore Usage", | ||
| "description": "Current storage capacity and usage for a Backup Server datastore", | ||
| "tags": ["Backup Server", "Datastore", "Status"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "config": { | ||
| "baseUrl": "{{dataSource.pbsHost}}/api2/json", | ||
| "httpMethod": "get", | ||
| "endpointPath": "/admin/datastore/{{object.rawId}}/status", | ||
| "headers": [ | ||
| { | ||
| "key": "Authorization", | ||
| "value": "PBSAPIToken {{dataSource.pbsTokenId}}:{{dataSource.pbsTokenSecret}}" | ||
| } | ||
| ], | ||
| "pathToData": "data" | ||
| }, | ||
| "matches": { "sourceType": { "type": "oneOf", "values": ["Proxmox Backup Datastore"] } }, | ||
| "metadata": [ | ||
| { "name": "used", "displayName": "Used", "shape": ["bytes", { "decimalPlaces": 2 }], "role": "value" }, | ||
| { "name": "total", "displayName": "Total", "shape": ["bytes", { "decimalPlaces": 2 }] }, | ||
| { "name": "avail", "displayName": "Available", "shape": ["bytes", { "decimalPlaces": 2 }] } | ||
| ], | ||
| "timeframes": false | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "name": "pbsDatastores", | ||
| "displayName": "Backup Server Datastores", | ||
| "description": "All datastores configured on the Proxmox Backup Server", | ||
| "tags": ["Backup Server", "Datastore"], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "baseUrl": "{{dataSource.pbsHost}}/api2/json", | ||
| "httpMethod": "get", | ||
| "endpointPath": "/admin/datastore", | ||
| "headers": [ | ||
| { | ||
| "key": "Authorization", | ||
| "value": "PBSAPIToken {{dataSource.pbsTokenId}}:{{dataSource.pbsTokenSecret}}" | ||
| } | ||
| ], | ||
| "pathToData": "data" | ||
| }, | ||
| "matches": "none", | ||
| "visibility": { "type": "hidden" }, | ||
| "metadata": [ | ||
| { "name": "store", "displayName": "Datastore", "shape": "string", "role": "label" }, | ||
| { "name": "comment", "displayName": "Comment", "shape": "string" } | ||
| ], | ||
| "timeframes": false | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| { | ||
| "name": "pbsGroupSnapshots", | ||
| "displayName": "Backup Group Snapshots", | ||
| "description": "Retained backup snapshots for a backup group, with size and verification status", | ||
| "tags": ["Backup Server", "Backup Group", "Snapshot"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "config": { | ||
| "baseUrl": "{{dataSource.pbsHost}}/api2/json", | ||
| "httpMethod": "get", | ||
| "endpointPath": "/admin/datastore/{{object.store}}/snapshots", | ||
| "getArgs": [ | ||
| { "key": "backup-type", "value": "{{object.backupType}}" }, | ||
| { "key": "backup-id", "value": "{{object.backupId}}" } | ||
| ], | ||
| "headers": [ | ||
| { | ||
| "key": "Authorization", | ||
| "value": "PBSAPIToken {{dataSource.pbsTokenId}}:{{dataSource.pbsTokenSecret}}" | ||
| } | ||
| ], | ||
| "postRequestScript": "pbsGroupSnapshots.js" | ||
| }, | ||
| "matches": { "sourceType": { "type": "oneOf", "values": ["Proxmox Backup Group"] } }, | ||
| "metadata": [ | ||
| { "name": "time", "displayName": "Time", "shape": "timestamp", "role": "timestamp" }, | ||
| { "name": "size", "displayName": "Size", "shape": "bytes", "role": "value" }, | ||
| { "name": "protected", "displayName": "Protected", "shape": "boolean" }, | ||
| { "name": "verificationState", "displayName": "Verification State", "shape": "string" }, | ||
| { "name": "comment", "displayName": "Comment", "shape": "string" }, | ||
| { "name": "backupGroup", "displayName": "Backup Group", "shape": "string" } | ||
| ], | ||
| "timeframes": false | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| { | ||
| "name": "pbsMaintenanceTasks", | ||
| "displayName": "Backup Server Tasks", | ||
| "description": "Task history for a datastore — backup, garbage collection, prune, and verify runs", | ||
| "tags": ["Backup Server", "Datastore", "Tasks"], | ||
| "baseDataSourceName": "httpRequestScopedSingle", | ||
| "config": { | ||
| "baseUrl": "{{dataSource.pbsHost}}/api2/json", | ||
| "httpMethod": "get", | ||
| "endpointPath": "/nodes/localhost/tasks", | ||
| "getArgs": [ | ||
| { "key": "store", "value": "{{object.rawId}}" }, | ||
| { "key": "since", "value": "{{timeframe.unixStart}}" }, | ||
| { "key": "until", "value": "{{timeframe.unixEnd}}" }, | ||
| { "key": "typefilter", "value": "{{taskType || null}}" }, | ||
| { "key": "limit", "value": "500" } | ||
| ], | ||
| "headers": [ | ||
| { | ||
| "key": "Authorization", | ||
| "value": "PBSAPIToken {{dataSource.pbsTokenId}}:{{dataSource.pbsTokenSecret}}" | ||
| } | ||
| ], | ||
| "postRequestScript": "pbsMaintenanceTasks.js" | ||
| }, | ||
| "matches": { "sourceType": { "type": "oneOf", "values": ["Proxmox Backup Datastore"] } }, | ||
| "ui": [ | ||
| { | ||
| "name": "taskType", | ||
| "type": "autocomplete", | ||
| "label": "Task type", | ||
| "allowCustomValues": false, | ||
| "isMulti": false, | ||
| "isClearable": true, | ||
| "data": { | ||
| "source": "fixed", | ||
| "values": [ | ||
| { "value": "backup", "label": "Backup" }, | ||
| { "value": "garbage_collection", "label": "Garbage Collection" }, | ||
| { "value": "prunejob", "label": "Prune" }, | ||
| { "value": "verificationjob", "label": "Verify" } | ||
| ] | ||
| } | ||
| } | ||
| ], | ||
| "metadata": [ | ||
| { "name": "upid", "displayName": "UPID", "shape": "string", "visible": false }, | ||
| { "name": "startTime", "displayName": "Started", "shape": "timestamp", "role": "timestamp" }, | ||
| { "name": "endTime", "displayName": "Ended", "shape": "timestamp" }, | ||
| { "name": "workerType", "displayName": "Task Type", "shape": "string" }, | ||
| { "name": "workerId", "displayName": "Target", "shape": "string" }, | ||
| { "name": "status", "displayName": "Status", "shape": "string" }, | ||
| { "name": "outcome", "displayName": "Outcome", "shape": ["state", { "map": { "success": ["success"], "error": ["error"], "warning": ["running"] } }] }, | ||
| { "name": "user", "displayName": "User", "shape": "string" } | ||
| ], | ||
| "timeframes": true | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "name": "pbsVersion", | ||
| "displayName": "Backup Server API Version", | ||
| "description": "Proxmox Backup Server API version and release information", | ||
| "tags": ["Backup Server", "Info"], | ||
| "baseDataSourceName": "httpRequestUnscoped", | ||
| "config": { | ||
| "baseUrl": "{{dataSource.pbsHost}}/api2/json", | ||
| "httpMethod": "get", | ||
| "endpointPath": "/version", | ||
| "headers": [ | ||
| { | ||
| "key": "Authorization", | ||
| "value": "PBSAPIToken {{dataSource.pbsTokenId}}:{{dataSource.pbsTokenSecret}}" | ||
| } | ||
| ], | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| "pathToData": "data" | ||
| }, | ||
| "matches": "none", | ||
| "visibility": { "type": "hidden" }, | ||
| "metadata": [ | ||
| { "pattern": ".*" } | ||
| ], | ||
| "timeframes": false | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| const store = context.objects[0].rawId; | ||
| const groups = (data && data.data) || []; | ||
|
|
||
| result = groups.map(function(g) { | ||
| return { | ||
| groupId: store + '/' + g['backup-type'] + '/' + g['backup-id'], | ||
| name: g['backup-type'] + '/' + g['backup-id'], | ||
| store: store, | ||
| backupType: g['backup-type'], | ||
| backupId: g['backup-id'], | ||
| owner: g.owner || null, | ||
| lastBackup: g['last-backup'] != null ? g['last-backup'] * 1000 : null, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Return ISO 8601 timestamp strings for all PBS timestamp fields. The scripts currently emit Unix milliseconds for fields declared with the 📍 Affects 2 files
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| backupCount: g['backup-count'] || 0 | ||
| }; | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| const snapshots = (data && data.data) || []; | ||
| const backupGroup = (context.objects[0] && context.objects[0].rawId) || null; | ||
|
|
||
| result = snapshots.map(function(s) { | ||
| return { | ||
| time: s['backup-time'] != null ? s['backup-time'] * 1000 : null, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Return
Proposed fix- time: s['backup-time'] != null ? s['backup-time'] * 1000 : null,
+ time: s['backup-time'] != null
+ ? new Date(s['backup-time'] * 1000).toISOString()
+ : null,🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| size: s.size || 0, | ||
| protected: !!s.protected, | ||
| verificationState: (s.verification && s.verification.state) || null, | ||
| comment: s.comment || null, | ||
| backupGroup: backupGroup | ||
| }; | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| const tasks = (data && data.data) || []; | ||
|
|
||
| result = tasks.map(function(t) { | ||
| const outcome = t.status == null ? 'running' : (t.status === 'OK' ? 'success' : 'error'); | ||
| return { | ||
| upid: t.upid, | ||
| startTime: t.starttime != null ? t.starttime * 1000 : null, | ||
| endTime: t.endtime != null ? t.endtime * 1000 : null, | ||
| workerType: t.worker_type, | ||
| workerId: t.worker_id || null, | ||
| status: t.status || null, | ||
| outcome: outcome, | ||
| user: t.user | ||
| }; | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.