ConSol* Consulting & Solutions Sofware GmbH Deutschland
ConSol* Consulting & Solutions Software GmbH DeutschlandConSol* Consulting & Solutions Software GmbH Deutschland
 
    Home  Apple Solutions  Tips & Tricks  Nagios Server Setup  

Nagios Server Setup for Mac OS 10.5

The following should provide you with a step by step instruction for setting up a Nagios Server on Mac OS 10.5 Server

 

1. Install Mac OS 10.5 Server

A Mac Mini should be suitable as a Nagios Server for small to medium sized environments.


2. Download and install Xcode Tools and Macports

When downloaded you can either install Xcode and Macports via GUI or commandline.

Command line Installation of Xcode Tools:

 

# hdiutil mount Xcode_tools.dmg
# sudo installer -pkg /Volumes/Xcode_tools/xcode_tools.pkg -target /


Command line installation of Macports:

# hdiutil mount <Macports dmg>
# sudo installer -pkg /Volumes/<Macports>/Macports.pkg -target /

 

3. update Macports

# . ~/.profile
# sudo port selfupdate
# sudo port sync

 

4. install Nagios Server, NRPE daemon and plugins

# sudo port install nagios
# sudo port install nagios-plugins
# sudo port install nrpe

 

If you want to monitor your Xserve RAIDs do:
# sudo port install xseve-raid-tools

 

5. configure and start the web server

edit /etc/apache2/httpd.conf

change the User and Group to nagios.

Then insert the "Nagios stuff" text block somewhere *above* your Apache cgi-bin ScriptAlias statement:

        ScriptAlias /cgi-bin/ "/Library/WebServer/CGI-Executables/"

#
# Nagios stuff

ScriptAlias /nagios/cgi-bin/ "/opt/local/sbin/nagios/"
<Directory "/opt/local/sbin/nagios">
 AllowOverride None
    Options ExecCGI
    Order allow,deny
    Allow from all
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /opt/local/etc/nagios/htpasswd.users
    require valid-user
</Directory>

Alias /nagios "/opt/local/share/nagios"
<Directory "/opt/local/share/nagios">
    Options None
    AllowOverride AuthConfig
    Order allow,deny
    Allow from all
</Directory>

# End Nagios stuff
#

Then start apache:

# sudo serveradmin start web

 

6. configure and start postfix

edit /etc/mail/main.cf and add the following lines:

mydomain_fallback = localhost    
myhostname = net1.mail.is-a-chef.com
mailbox_transport = cyrus
enable_server_options = yes
local_recipient_maps =
luser_relay = admin

then start postfix:
# sudo serveradmin start mail

 

7. configure the Nagios Server

Configure the Nagios sample files in /opt/local/etc/nagios.

a) First, backup the Nagios sample files.

# cd /opt/local/etc/nagios
# sudo mkdir sample
# sudo cp *.cfg-sample sample/

b) Then rename the sample files for use.

# sudo -s
# for i in *cfg-sample; do mv $i `echo $i | sed -e s/cfg-sample/cfg/`; done;


c) Set user 'nagiosadmin' as a "superuser" to browse all hosts/services in
   /opt/local/etc/nagios/cgi.cfg

   authorized_for_system_information=nagiosadmin
   authorized_for_configuration_information=nagiosadmin
   authorized_for_system_commands=nagiosadmin
   authorized_for_all_services=nagiosadmin
   authorized_for_all_hosts=nagiosadmin
   authorized_for_all_service_commands=nagiosadmin
   authorized_for_all_host_commands=nagiosadmin

 

d) Configure the default commands.cfg file to your requirements.  Then test the Nagios configuration with this command until you get no errors:

# sudo /opt/local/bin/nagios -v /opt/local/etc/nagios/nagios.cfg


e) Create a 'nagiosadmin' Apache user/password to correspond with the Nagios Apache user created above

# htpasswd -c /opt/local/etc/nagios/htpasswd.users nagiosadmin

f) Set Nagios to start at system boot, and start Nagios

# sudo launchctl load -w /Library/LaunchDaemons/org.macports.nagios.plist

8. You may now login as 'nagiosadmin' to the Nagios web interface at localhost/nagios