I rotate physical disks in and out of my mirrored ZFS zpool (using ZoL) to use for offsite backups; to help streamline the process I've been using udev rules to respond to the drives being swapped.
Currently when a drive is inserted I use a zfs attach, which requires the name of an existing drive from within the pool. For now it's hardcoded to one of the disks that never goes offsite.
So, rather than hardcoding an id, how could I get the ID of an online disk for the target pool? Currently I'm toying with grepping it from zpool status but was hoping there might be a better option.