It’s an old Unix trick, but it’s so very nice to have. On your local machine, in Terminal, you have the who and uptime commands to see who is using your machine (be it someone logged into the console/GUI or over SSH) and uptime to see your uptime and load. Useful information, this.
But what about the other machines on your network? Do you need to shell out hundreds of dollars for something like Apple Remote Desktop to see what’s happening to every machine in your home or small business? Do you have to SSH to each and leave a window open just to put uptime in a loop to see what it’s doing? Do you have to install something like Webmin and setup a monitoring cluster? Or even setup email reports in cron to get the output of the commands?
Not really, no. Remote load and usage monitoring is built-in to Mac OS X.
I’ll start by saying you want to use this on small networks where privacy is not a concern. You can use this to see who is logged into a machine and, thus, a valid user account to try to get in as. This would be one of many reasons it’s off by default. The other is it runs on broadcasts and, in large numbers, could hinder network performance.
However, if you have desire or need to monitor machines around you, rwhod is a neat party trick. rwho and ruptime let you see a who and uptime report for all the machines on your subnet that are running rwhod. It’s really that simple.
$ rwho -a; ruptime -a
ahknight Kalyke:console Jul 6 14:50 48:14
ahknight Kalyke:ttyp1 Jul 8 14:52 :03
ahknight Kalyke:ttyp2 Jul 8 14:55 :06
ahknight Kalyke:ttyp3 Jul 8 01:54 13:07
ahknight Saturn:console Jul 7 03:25 35:39
Kalyke up 2+00:15, 4 users, load 0.18, 0.27, 0.25
Saturn up 1+11:40, 1 user, load 0.02, 0.05, 0.06
That’s all it is. But, now I can monitor my home server without logging into it because my local computer is watching for those rwhod broadcasts and logging them.
This simple trick requires one step: start rwhod as root. The rest just happens. Now, you can run it once, or you can put the following in /Library/LaunchDaemons and launchctl load it and the system will keep it going for you:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>bsd.rwhod</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/rwhod</string>
</array>
<key>RunAtLoad</key>
<true/>
</true/></dict>
</plist>
After that’s done on every machine you want to monitor or listen for broadcasts from, run one of rwho or ruptime to test it.
Read the man pages on rwho, ruptime, or rwhod for more information.