EasyNagios for OsX Server | testing

Just gave a try to Nagios thanks to that very handy script : easyNagiosForOSXServer install

from :
https://github.com/ygini/easyNagiosForOSXServer

prereq :

install mysql and gd2

I don’t know really why but not having mysql made sciprt and make fail.

brew install gd
brew install mysql

brew list

gd jpeg libpng mysql

==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/mysql-5.6.13.mountain_lion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mysql-5.6.13.mountain_lion.bottle.tar.gz
==> /usr/local/Cellar/mysql/5.6.13/bin/mysql_install_db --verbose --user=localadminoem --basedir=/usr/local/Cellar/mysql/5.6.13
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

#####To connect:
mysql -uroot

#####To have launchd start mysql at login:

ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents

`#####Then to load mysql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

Or, if you don’t want/need launchctl, you can just run:
mysql.server start

==> Summary
/usr/local/Cellar/mysql/5.6.13: 9382 files, 354M
$`

note :

I don’t want launchd to start mysql for now… later

macpro:~ localadminoem$ mysql.server start
Starting MySQL
. SUCCESS! 
macpro:~ localadminoem$ 

installing nagios with Yoann Gini easyNagios

sudo sh ./nagios_installFullScript.sh
…
…

from readme : When done, the script let you in a working environment. All you have to do is: — add authorized users to your new local group named nagiosweb ; — enable the webapp plugin in one of your website hosted on OS X Server for Mountain Lion and go on http[s]://your.server.tld/monitoring (use the shortname of nagiosweb’s members to login)

so let’s follow the manual RTFM!

webapp in Server app

Activate the webapp in the website of your choice.

add users to nagios group

either via command line or System preferences

login with the user you just add in nagios group

http://yoursite/monitoring/

If all is fine you should allready get localhost and some alerts like me as I don’t have caldav service running.

Going further

install XCode if not yet

get osx-monitoring-tools from jedda.me

cd yourdev.directory

git clone https://github.com/jedda/OSX-Monitoring-Tools.git

or else download it directly if you like.

open Xcode projects :

yourdev.directory/osx-monitoring-tools/check_osx_mem/check_osx_mem.xcodeproj

yourdev.directory/osx-monitoring-tools/check_osx_smc/check_osx_smc.xcodeproj

and build them.

note :

I had to “validate project” and choose current Osx10.8 SDK.
don’t know yet if it going to be a pb for Lion Clients.

Copy jedda scripts into easynagios

I don’t copy them in libexec as some would have name conflicts

cd path.to.osx-monitoring-tools

copy all .sh scripts and just build check_osx_mem & check_osx_smc
into new directory osx-monitoring-tools

mkdir /Library/EasyNagios/osx-monitoring-tools
cp -R ./*.sh /Library/EasyNagios/osx-monitoring-tools/
cp check_osx_mem/build/check_osx_mem check_osx_smc/build/check_osx_smc /Library/EasyNagios/osx-monitoring-tools/

make nagios the owner

chown -R nagios:nagios /Library/EasyNagios/osx-monitoring-tools/*

Testing some of the tools localy on the server

cd /Library/EasyNagios/osx-monitoring-tools 
sudo ./check_osx_smc -r TA0P,TCAH,F0Ac,F1Ac,F2Ac,F3Ac -w 75,85,3800,3800,3800,3800 -c 85,100,5200,5200,5200,5200 -s c
Password:
OK - All sensors within threshold! | TA0P=30.0000;75.0000;85.0000; TCAH=-127.0000;85.0000;100.0000; F0Ac=552.0000;3800.0000;5200.0000; F1Ac=800.0000;3800.0000;5200.0000; F2Ac=652.0000;3800.0000;5200.0000; F3Ac=799.0000;3800.0000;5200.0000;
./check_osx_mem -w 65.00 -c 85.00
OK: 63.147637 percent memory utilization | active=3081.000000; wired=796.000000; inactive=1148.000000; free=1114.000000; total=6141.000000; utilization=63.147637;

Cool.

Configure nagios (localhost for now)

Adding nagios to the sudoers
sudo visudo
Compile and Install the NRPE daemon
cd ~/Downloads/ - see note 1

Extract the NRPE source code tarball

tar xvf nrpe-2.15.tar.gz
cd nrpe-2.15
note :

Not done => as I used 2.15 and did not find equivalent of line 6673.

Update the configure file for Mac OS X compatibility
vim ./configure
on line 6673 change the text to read
if test -f “$dir/libssl.dylib”; then

Compile the NRPE daemon

did change a bit ./configure to match easyNagios setup in /Library

/configure --prefix="/Library/EasyNagios" --with-nagios-user="nagios" --with-nagios-group="nagios" --with-cgiurl="/Library/EasyNagios/sbin"

make all

Install the NRPE plugin, dameon and example config file

sudo make install-plugin
sudo make install-daemon
sudo make install-daemon-config
copy the LaunchDaemons plist from

download file from :
http://arfore.com/files/nrpe.plist.zip

http://arfore.com/2008/09/25/nagios-nrpe-on-os-x-server-105/

Edited Nagios directory in the .plist with correct EasyNagios Path /Library/EasyNagios/

Renamed file to org.nagios.nrpe.plist

Moved to /LaunchDaemons

cd ~/Downloads/ - you should be there

sudo cp org.nagios.nrpe.plist /Library/LaunchDaemons/org.nagios.nrpe.plist

sudo launchctl load /Library/LaunchDaemons/org.nagios.nrpe.plist

sudo launchctl start org.nagios.nrpe


./check_nrpe -H localhost
connect to address ::1 port 5666: Connection refused
CHECK_NRPE: Error - Could not complete SSL handshake.

Ok I have to dig more.
For now I stick with Lithium5 (wich is no longer maintained as the dev stopped when moving jobs, and did not found any successor to continue his work)

I have to say that Lithium has a super cool elegant GUI and is ultra easy to setup.

I just have to use SNMP as servermgrd was not working on 10.7 and more. but still reports are really nice. I’m stuck with the number of allowed clients, so unless I “hack it” (I’m thinking of making some VMs clones for each Site) but this is not a good “production setup” and I’ll either go back to Zenoss or go on with nagios.

I Also tried Cacti, but compared to Lithium it is hard to go to those solutions. Still I just have no choice and Nagios have my preference and Mac Os X tools are available like the one I used in this test.

Olivier
About

Product and graphic designer turned to be a Mac SysAdmin.

Posted in Admin, Deploy, Linux, Mac Tagged with: , , , , , , ,
2 comments on “EasyNagios for OsX Server | testing
  1. Chris Johnson says:

    Your EasyNagios script hangs and fails at a certain point. Any way to progress past this?

    http://i.imgur.com/JD4vRVJ.png

    • oem oem says:

      Hello Chris,

      Sorry for late reply I’ve had trouble with Internet connection.

      OK first this is not “my script” here …. ;)

      I see in your log screenshot that you have a problem with the tar archives.

      as I did saved the log of my install, I checked to see if I could find some common lines, and found indeed :

      [COPY PASTE BEGIN]

      *** Exfoliation theme installed ***
      NOTE: Use ‘make install-classicui’ to revert to classic Nagios theme

      — Downloading radiusclient-ng-latest.tar.gz form http://sourceforge.net/projects/radiusclient-ng.berlios/files/latest/download
      % Total % Received % Xferd Average Speed Time Time Time Current
      Dload Upload Total Spent Left Speed
      0 455 0 0 0 0 0 0 –:–:– –:–:– –:–:– 0
      0 0 0 0 0 0 0 0 –:–:– –:–:– –:–:– 0
      100 374k 100 374k 0 0 218k 0 0:00:01 0:00:01 –:–:– 616k
      — Download done, start archive extraction
      — Archive extraction done

      [COPY PASTE END]

      So you’ll notice that you have an error after the line

      #############
      — Download done, start archive extraction
      tar: Unrecognized archive format
      tar: Error exit delayed from previous errors.
      #############

      Peharps you could try to download by your side the latest “nagios radius client” tar file in the install directory from :
      http://sourceforge.net/projects/radiusclient-ng.berlios/files/latest/download

      and try to untar it first prior to relaunch the script with the command:
      tar -xvf name-of-the-tar-archive.tar
      add the z trigger -xvfz if its a gzip (.tar.gz).

      Hope it helps…

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>