Skip to content
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

Improve macOS compatibility #255

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ben-z
Copy link

@ben-z ben-z commented Nov 28, 2024

Currently, the internal drive in my mac (M4 mini, Sonoma) doesn't appear in the metrics because of this error:

Read 1 entries from Error Information Log failed: GetLogPage failed: system=0x38, sub=0x0, code=745

I'm not sure what this is about, but a google search appears to show this in a lot of macOS smartctl outputs. This PR ignores this error so that the drive metrics can be exported.

Also, device name parsing appears to be broken due to how macOS presents device names to smartctl:

> smartctl --json --scan                                                                                                                    4s
{
  "json_format_version": [
    1,
    0
  ],
  "smartctl": {
    "version": [
      7,
      4
    ],
    "pre_release": false,
    "svn_revision": "5530",
    "platform_info": "Darwin 24.1.0 arm64",
    "build_info": "(local build)",
    "argv": [
      "smartctl",
      "--json",
      "--scan"
    ],
    "exit_status": 0
  },
  "devices": [
    {
      "name": "IOService:/AppleARMPE/arm-io@10F00000/AppleH16GFamilyIO/ans@81600000/AppleASCWrapV6/iop-ans-nub/RTBuddy(ANS2)/RTBuddyService/AppleANS3CGv2Controller/NS_01@1",
      "info_name": "IOService:/AppleARMPE/arm-io@10F00000/AppleH16GFamilyIO/ans@81600000/AppleASCWrapV6/iop-ans-nub/RTBuddy(ANS2)/RTBuddyService/AppleANS3CGv2Controller/NS_01@1",
      "type": "nvme",
      "protocol": "NVMe"
    },
    {
      "name": "IOService:/AppleARMPE/arm-io@10F00000/AppleH16GFamilyIO/apciec3@80000000/AppleT8132PCIeC/pcic3-bridge@0/IOPP/pci-bridge@0/IOPP/pci-bridge@1/IOPP/pci144d,a80c@0/IONVMeController/IONVMeBlockStorageDevice@1",
      "info_name": "IOService:/AppleARMPE/arm-io@10F00000/AppleH16GFamilyIO/apciec3@80000000/AppleT8132PCIeC/pcic3-bridge@0/IOPP/pci-bridge@0/IOPP/pci-bridge@1/IOPP/pci144d,a80c@0/IONVMeController/IONVMeBlockStorageDevice@1",
      "type": "nvme",
      "protocol": "NVMe"
    }
  ]
}

This PR includes a change to the extractDiskName function, such that it returns the entire input string IOService:/AppleARMPE/arm-io@10F00000/AppleH16GFamilyIO/apciec3@80000000/AppleT8132PCIeC/pcic3-bridge@0/IOPP/pci-bridge@0/IOPP/pci-bridge@1/IOPP/pci144d,a80c@0/IONVMeController/IONVMeBlockStorageDevice@1 as the name instead of an empty string. This resolves the restriction that no two devices can have the same name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant