So, why is `whois $dm | egrep "Registrar Registration Expiration Date|Registry Expiry Date"` not working on the remote machine? There are several possibilities (I leave the determination of which one up to you).
Please note: the Nagios plugin doesn't run in your /home directory on the remote. This is what is known in the trade as a 'Great Big Clue'.