### Tags

I have a fairly comprehensive Icinga monitoring platform monitoring my various linux hosts, but one area which has been lacking until now is the monitoring of the OSX Mavericks Mac Mini that I use for a home media center. Considering this is used by my family to watch TV/Movies, play music, and manage iPhoto, it’s arguably one of the most important hosts to monitor carefully. Of course, I could monitor its state (up or down) by pinging it from Icinga, but I wanted to know more than that. I’ve had issues in the past with running out of disk space on the host, and I’m all to familiar with the risks of 4-year-old hardware using spindled disks. This solution enables me to monitor the following on OSX with Icinga:

• Disk Usage
• Time Machine Status
• Disk Health

# Prerequisites

## Homebrew Install

Homebrew as per the docs on the website (or just paste in the line below):

ruby -e "\$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

# Configuration Edit /usr/local/etc/nrpe.cfg, and set at least the

allowed_hosts directive to the IP of your Icinga host It may also be necessary (because of the location the plugins are installed to) to change occurances of
/usr/local/Cellar/nrpe/2.15/ To /usr/local/Cellar/nagios-plugins/1.5/ Further, customize disk usage plugin as follows, by removing reference to the specific device (/ instead of /dev/) # Disk usage (use plugin supplied by nagios-plugins from brew) command[check_disk]=/usr/local/Cellar/nrpe/2.15/sbin/check_disk -w 20% -c 10% -p / To start NRPE immediately, run: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nrpe.plist

## Install smartmontools Use Brew again to install smartmontools, necessary for the disk health check: brew install nrpe smartmontools

https://github.com/jedda/OSX-Monitoring-Tools (I used check_smart.sh and check_time_machine_currency.sh) To avoid future updates breaking non-brew-managed plugins, put them in ~/bin/. Symlink smartctl into ~/bin to avoid future conflicts: ln -s /usr/local/Cellar/smartmontools/6.2/sbin/smartctl ~/bin/ Edit check_smart.sh, and replace every occurance of /opt/local/libexec/nagios/smartctl with /Users/<youruser>/bin/smartctl Add the following to /usr/local/etc/nrpe.cfg: # Disk Health (use custom plugin) command[check_disk_health]=/Users/<youruser>/bin/check_smart.sh -d disk0 -g "badSectors,reallocSectors,powerOnHours,tempCelcius,retiredBlockCount,lifetimeWrites,lifetimeReads" # Time Machine (use custom plugin) command[check_timemachine]=/Users/<youruser>/bin/check_time_machine_currency.sh -w 360 -c 720 And restarted NRPE