Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions plugins/ProxmoxVE/v1/configValidation.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
"required": true,
"error": "Could not connect to Proxmox VE. Check your Host URL is reachable, and that your Token ID and Token Secret are correct.",
"success": "Connected to Proxmox VE successfully."
},
{
"displayName": "Check Backup Server access",
"dataStream": { "name": "pbsVersion" },
"required": false,
"error": "Could not connect to Proxmox Backup Server. If you enabled the Backup Server section, check the Host URL is reachable, and that your Token ID and Token Secret are correct. Backup Server metrics will be unavailable until this is fixed.",
"success": "Connected to Proxmox Backup Server successfully."
}
]
}
14 changes: 14 additions & 0 deletions plugins/ProxmoxVE/v1/custom_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,19 @@
"icon": "box",
"singular": "Container",
"plural": "Containers"
},
{
"name": "Proxmox Backup Datastore",
"sourceType": "Proxmox Backup Datastore",
"icon": "database",
"singular": "Backup Datastore",
"plural": "Backup Datastores"
},
{
"name": "Proxmox Backup Group",
"sourceType": "Proxmox Backup Group",
"icon": "clock-rotate-left",
"singular": "Backup Group",
"plural": "Backup Groups"
}
]
31 changes: 31 additions & 0 deletions plugins/ProxmoxVE/v1/dataStreams/pbsBackupGroups.json
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
}
26 changes: 26 additions & 0 deletions plugins/ProxmoxVE/v1/dataStreams/pbsDatastoreUsage.json
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
}
26 changes: 26 additions & 0 deletions plugins/ProxmoxVE/v1/dataStreams/pbsDatastores.json
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
}
33 changes: 33 additions & 0 deletions plugins/ProxmoxVE/v1/dataStreams/pbsGroupSnapshots.json
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
}
57 changes: 57 additions & 0 deletions plugins/ProxmoxVE/v1/dataStreams/pbsMaintenanceTasks.json
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
}
25 changes: 25 additions & 0 deletions plugins/ProxmoxVE/v1/dataStreams/pbsVersion.json
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"],
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"baseDataSourceName": "httpRequestUnscoped",
"config": {
"baseUrl": "{{dataSource.pbsHost}}/api2/json",
"httpMethod": "get",
"endpointPath": "/version",
"headers": [
{
"key": "Authorization",
"value": "PBSAPIToken {{dataSource.pbsTokenId}}:{{dataSource.pbsTokenSecret}}"
}
],
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"pathToData": "data"
},
"matches": "none",
"visibility": { "type": "hidden" },
"metadata": [
{ "pattern": ".*" }
],
"timeframes": false
}
15 changes: 15 additions & 0 deletions plugins/ProxmoxVE/v1/dataStreams/scripts/pbsBackupGroups.js
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 ? new Date(g['last-backup'] * 1000).toISOString() : null,
backupCount: g['backup-count'] || 0
};
});
13 changes: 13 additions & 0 deletions plugins/ProxmoxVE/v1/dataStreams/scripts/pbsGroupSnapshots.js
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 ? new Date(s['backup-time'] * 1000).toISOString() : null,
size: s.size || 0,
protected: !!s.protected,
verificationState: (s.verification && s.verification.state) || null,
comment: s.comment || null,
backupGroup: backupGroup
};
});
15 changes: 15 additions & 0 deletions plugins/ProxmoxVE/v1/dataStreams/scripts/pbsMaintenanceTasks.js
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 ? new Date(t.starttime * 1000).toISOString() : null,
endTime: t.endtime != null ? new Date(t.endtime * 1000).toISOString() : null,
workerType: t.worker_type,
workerId: t.worker_id || null,
status: t.status || null,
outcome: outcome,
user: t.user
};
});
Loading
Loading