On 5/9/20 3:30 pm, Mark Wagner wrote:
On Sat, 5 Sep 2020 13:29:54 +1000 Brian Scott <Brian.Scott at bunyatech.com.au> wrote:
Hi list,
Has anyone had experience with running the xymon client on the latest Macos?
My particular problem is that the handling of disk mounts and capacities has gone seriously weird. First exhibit - output from the mount command:
mount
/dev/disk1s1 on / (apfs, local, read-only, journaled) devfs on /dev (devfs, local, nobrowse) /dev/disk1s2 on /System/Volumes/Data (apfs, local, journaled, nobrowse) /dev/disk1s5 on /private/var/vm (apfs, local, journaled, nobrowse) map auto_home on /System/Volumes/Data/home (autofs, automounted, nobrowse)
All volumes are either marked nobrowse or read-only so no disks are selected by xymonclient-darwin.sh. This has the immediate kick on effect of causing a bash set command to dump all set variables because the filesystem list is empty. Ignoring this because we actually want to select some filesystems, the question is which ones. Looking at the output from df:
df -P -H
Filesystem????? Size?? Used? Avail Capacity? Mounted on /dev/disk1s1??? 1.0T??? 11G??? 92G??? 11%??? / devfs?????????? 345k?? 345k???? 0B?? 100%??? /dev /dev/disk1s2??? 1.0T?? 893G??? 92G??? 91%??? /System/Volumes/Data /dev/disk1s5??? 1.0T?? 3.2G??? 92G???? 4%??? /private/var/vm map auto_home???? 0B???? 0B???? 0B?? 100%??? /System/Volumes/Data/home
It looks like /dev/disk1s1, s2 and s5 are all the same real partition but account for different space from it, i.e. total size = 1.0T, Used = 11G+893G+3.2G=907.2G, Avail=92G.
This would suggest that a reasonable thing to monitor would be one of these entries ('/' makes some sense) and derive used as size-avail (1.0T-92G). APFS volumes are more akin to BTRFS subvolumes or ZFS filesystems than to traditional partitions: the available space on the physical storage is shared between them on an as-needed basis.
There might be some Apple-specific command line tool to get the statistics you want, but failing that, you'll need to track which partitions are APFS versus something else when deciding how to calculate usage.
Many thanks,
I've cooked up a change to xymonclient-darwin.sh to try to deal with this. In particular, non-apfs disks and partitions should be treated as you would expect for conventional file systems.
For apfs volumes, I've just reported one for each underlying disk showing the total used figures.
Inodes seem to be used individually for each volume so I've reported each of them. Mind you, the maximum appears to be effectively infinite so there is no danger of ever running out so this is of limited use. The existing code wouldn't have been reporting inodes anyway (df command mistake).
Cheers,
Brian Scott