One of the items that I’ve found and adapted for my own use over the past couple of years has been a script for my servers that emails me a status report on a daily basis. The script tells me a number of things that are good to know, including the following:
Free space on all attached drives
Who’s logged in via SSH or in the console (console = logged in via Login Window)
If AFP is running, and who is logged in via AFP
If SMB is running, and who is logged in via SMB
Unsuccessful login attempts via SSH
Unsuccessful attempts to use sudo by accounts not authorized to use sudo
Authorized sudo commands that have been run
Time Machine backup status (10.5.x and 10.6.x only)
Apple Hardware RAID status
XServe hardware monitoring messages
Any available software updates
The script has been written and adapted by a number of folks, including Corey Carson and Noah Abrahamson, and has been really useful in helping me both gather information and diagnose problems on my Mac servers. Since it’s so useful, I’m posting it here for others to use and adapt for their own purposes.
Scripts updated – 4-29-2011. I’ve added a section to the 10.4.x script and the 10.5.x/10.6.x script that checks for and reports on the status of your Apple hardware RAID (this is using Apple’s MEGARAID card on the G5 XServes, or with the Apple RAID card available for the Intel XServes and Mac Pros.) See comments in the script for more details.
To make this work, you’ll need to edit the script to have it send to whatever email address you want to use. The script is pretty well commented, but please let me know if you’ve got any questions about how it works.