Skip to content

Commit

Permalink
check health != 'unknown'
Browse files Browse the repository at this point in the history
  • Loading branch information
arteck authored Jan 19, 2025
1 parent 73b7fc6 commit e95798b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,25 +451,28 @@ class Proxmox extends utils.Adapter {
});

if (disk.type !== undefined) {
await this.createCustomState(sid, `${diskPath}.type`, 'text', disk.type);
if (disk.type.toLowerCase() != 'unknown') {
await this.createCustomState(sid, `${diskPath}.type`, 'text', disk.type);
}
}
if (disk.size !== undefined) {
await this.createCustomState(sid, `${diskPath}.size`, 'size', disk.size);
}
if (disk.health !== undefined) {
await this.createCustomState(sid, `${diskPath}.health`, 'text', disk.health);
if (disk.health.toLowerCase() != 'unknown') {
await this.createCustomState(sid, `${diskPath}.health`, 'text', disk.health);
const nodeDiskSmart = await this.proxmox.getNodeDisksSmart(node.node, disk.devpath);
if (nodeDiskSmart?.data?.text) {
await this.createCustomState(sid, `${diskPath}.smart`, 'text', nodeDiskSmart.data.text);
}
}
}
if (disk.wearout !== undefined && !isNaN(disk.wearout)) {
await this.createCustomState(sid, `${diskPath}.wearout`, 'level', disk.wearout);
}
if (disk.model !== undefined) {
await this.createCustomState(sid, `${diskPath}.model`, 'text', disk.model);
}

const nodeDiskSmart = await this.proxmox.getNodeDisksSmart(node.node, disk.devpath);
if (nodeDiskSmart?.data?.text) {
await this.createCustomState(sid, `${diskPath}.smart`, 'text', nodeDiskSmart.data.text);
}
}
}
}
} catch (err) {
Expand Down

0 comments on commit e95798b

Please sign in to comment.