Monitoring the new OS X Server Caching Service with Nagios

In followup to last week’s post on Monitoring Mac OS X Server Software Update Server, here is my new script to monitor the Caching Service on OS X Mountain Lion Server (Server.app 2.2+).

The Caching Service is a deceptively magical new service which automatically caches Apple update and Mac App Store content with no need for client configuration. A very good writeup of what the service actually does can be found at Noel Alonso’s blog.

In classic Apple style, the new Caching Service looks pretty bare on the surface, with a simple toggle and a slider to change the size of your cache. Whilst advanced configuration of the service is definitely possible; from a cursory glance, none of the options or statuses give you a really good idea of what is happening in the background.

This is where the following script works nicely. Checking that the service is active, registered, and accessible to clients provides a good way to monitor that caching of content should occur, but the performance data that the script returns gives you some excellent ways to monitor and analyse cache size and efficiency. As you can see in the graph above, I am able to get a good visual indication over time of how much content my server is caching, as well as how much cached content it is providing to clients versus downloading directly from Apple. In the next few weeks, I will write some articles on the RRDtool commands I am using to produce these graphs.

It is really satisfying to be able to see nice chunks of bandwidth that no longer have to come in via the internet. Enjoy!

check_osx_caching.sh on GitHub


Monitoring Mac OS X Server Software Update Server with Nagios

Many organisations use an internal Apple Software Update server to save bandwidth and control distribution of Apple supplied updates. With the introduction of the new Caching service in Mountain Lion server, the uptake in these kind of internal caching and update services is only going to rise.

The model for an internal Apple Software Update server however, has no easy failover or timeout built in, and therefore assumes excellent uptime for the service. If your service breaks down, users will not have access to any software updates, and many Mac admins will speak of how finicky and hateful the Software Update service can be at times.

With that, here is my Nagios monitoring script for the Software Update service. It will ensure the service is both running and accessible on it’s service port, then return performance data on the number of mirrored and enabled packages, as well as the overall size of your mirrored update cache.

I have also completed and am using a similar script for monitoring Apple’s new Caching service in Mountain Lion Server, and will release it this week after collecting enough historical data to make a pretty graph.

For now, here is check_osx_swupdate.sh:

check_osx_swupdate.sh on GitHub


Monitoring Mac OS X Server DHCP service with Nagios

Whilst not recommended as the primary DHCP server for large networks, Mac OS X Server is quite competent at providing leases for a subnet or two, particularly when coupled with NetBoot services. In our testing lab, we use a Mac OS X server for this exact purpose, serving as a NAT gateway, and providing DHCP and NetBoot services to a subnet, and we have had issues in the past with the underlying bootpd process locking up or too many clients on the subnet exhausting available leases.

With that, I have added a script to check the DHCP service on Mac OS X server. It will work on 10.6-8, and will check that the DHCP service is running, and then return performance data on the number of provided leases and active clients.

Over the next few weeks, I am planning to detail some of the workflows I am using to generate graphs like the one pictured above, giving excellent visibility into the historical performance of your Mac services.

check_osx_dhcp.sh on GitHub