title-icon-code

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

3 Responses to "Monitoring Mac OS X Server DHCP service with Nagios"

Add Comment
  1. Josh

    December 17, 2012 at 10:51 am

    Another great script, Jedda, though I am running in to some strange behavior trying to run it from a Launch Daemon. It is constantly returning “CRITICAL – DHCP service is not running!”, though when run straight from Terminal it returns correctly. Any thoughts on why this might be?

    Reply
    • jedda

      December 17, 2012 at 12:20 pm

      Hey Josh. Thanks! I’m glad you are getting some use out of it.

      Your issue stems from the fact that the root user that launchd is running under does not have a reference to the path that serveradmin resides at. On 10.8, this is inside the Server.app bundle in your Applications folder. You could use launchctl setenv PATH as referenced in this excellent post to fix this. Another far easier way to fix the problem would be to create a symbolic link to the serveradmin binary somewhere in your current PATH structure. If you just execute the ln command below, your issue should be solved. Let me know how you go!

      ln -s /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin /usr/sbin/serveradmin
      Reply
      • Josh

        January 27, 2013 at 12:57 pm

        Sorry that I forgot to respond back. This worked like a charm! You are a gentleman and a scholar.

        Reply

Submit a comment

Your email address will not be published. Required fields are marked *