Skip to content

Instantly share code, notes, and snippets.

@bageljp
Created November 3, 2013 11:03
Show Gist options
  • Select an option

  • Save bageljp/196460df01df4d60ddcf to your computer and use it in GitHub Desktop.

Select an option

Save bageljp/196460df01df4d60ddcf to your computer and use it in GitHub Desktop.
nagios on Mac OS X 10.8.3
[user1@canal-mac01 19:58:46 log][315][20]$ brew install nagios
Warning: Your Xcode (4.6.3) is outdated
Please update to Xcode 5.0.1.
Xcode can be updated from the App Store.
==> Installing dependencies for nagios: libpng, jpeg, gd, nagios-plugins
==> Installing nagios dependency: libpng
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libpng-1.5.14.mountain_lion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libpng-1.5.14.mountain_lion.bottle.tar.gz
🍺 /usr/local/Cellar/libpng/1.5.14: 15 files, 1.0M
==> Installing nagios dependency: jpeg
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/jpeg-8d.mountain_lion.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring jpeg-8d.mountain_lion.bottle.1.tar.gz
🍺 /usr/local/Cellar/jpeg/8d: 18 files, 784K
==> Installing nagios dependency: gd
==> Downloading https://bitbucket.org/libgd/gd-libgd/downloads/libgd-2.1.0.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gd/2.1.0 --with-png=/usr/local/opt/libpng --without-freetype --with-jpeg=/usr/local/opt/jpeg --without-tiff --without-vpx
==> make install
🍺 /usr/local/Cellar/gd/2.1.0: 32 files, 1.1M, built in 17 seconds
==> Installing nagios dependency: nagios-plugins
==> Downloading https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/nagios-plugins/1.5 --libexecdir=/usr/local/Cellar/nagios-plugins/1.5/sbin
==> make install
==> make install-root
==> Caveats
All plugins have been installed in:
/usr/local/sbin
==> Summary
🍺 /usr/local/Cellar/nagios-plugins/1.5: 55 files, 2.5M, built in 59 seconds
==> Installing nagios
==> Downloading http://downloads.sourceforge.net/project/nagios/nagios-3.x/nagios-3.5.1/nagios-3.5.1.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/nagios/3.5.1 --sbindir=/usr/local/Cellar/nagios/3.5.1/cgi-bin --sysconfdir=/usr/local/etc/nagios --localstatedir=/usr/local/var/
==> make all
==> make install
==> make install-config
==> make install-webconf
==> Caveats
First we need to create a command dir using superhuman powers:
mkdir -p /usr/local/var/lib/nagios/rw
sudo chgrp _www /usr/local/var/lib/nagios/rw
sudo chmod 2775 /usr/local/var/lib/nagios/rw
Then install the Nagios web frontend into Apple's build-in Apache:
1) Turn on Personal Web Sharing.
2) Load the php module by patching /etc/apache2/httpd.conf:
-#LoadModule php5_module libexec/apache2/libphp5.so
+LoadModule php5_module libexec/apache2/libphp5.so
3) Symlink the sample config and create your web account:
sudo ln -sf /usr/local/Cellar/nagios/3.5.1/share/nagios.conf /etc/apache2/other/
htpasswd -cs /usr/local/etc/nagios/htpasswd.users nagiosadmin
sudo apachectl restart
Log in with your web account (and don't forget to RTFM :-)
open http://localhost/nagios
To have launchd start nagios at startup:
sudo cp -fv /usr/local/opt/nagios/*.plist /Library/LaunchDaemons
Then to load nagios now:
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nagios.plist
Or, if you don't want/need launchctl, you can just run:
nagios /usr/local/etc/nagios/nagios.cfg
==> Summary
🍺 /usr/local/Cellar/nagios/3.5.1: 371 files, 5.9M, built in 19 seconds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment