ok well that makes perfect sense. The problem is that I didn’t give any arguments when compiling Nagios. I just created the /usr/local/nagios directory as advised, then installed there without issuing any optional switches at compile time.
Basically I followed the steps in the docs below without issuing any extra switches at the time of install.
You can download the latest version of Nagios from nagios.org/download.
Unpacking The Distribution
tar xzf nagios-version.tar.gz
When you have finished executing these commands, you should find a nagios-version directory that has been created in your current directory. Inside that directory you will find all the files that compromise the core Nagios distribution.
Create Nagios User/Group
You’re probably going to want to run Nagios under a normal user account, so add a new user (and group) to your system with the following command (this will vary depending on what OS you’re running):
Create Installation Directory
Create the base directory where you would like to install Nagios as follows…
Change the owner of the base installtion directory to be the Nagios user and group you added earlier as follows:
chown nagios.nagios /usr/local/nagios
Identify Web Server User
You’re probably going to want to issue external commands (like acknowledgements and scheduled downtime) from the web interface. To do so, you need to identify the user your web server runs as (typically apache, although this may differ on your system). This setting is found in your web server configuration file. The following command can be used to quickly determine what user Apache is running as (paths may differ on your system):
grep “^User” /etc/httpd/conf/httpd.conf
Add Command File Group
Next we’re going to create a new group whose members include the user your web server is running as and the user Nagios is running as. Let’s say we call this new group ‘nagcmd’ (you can name it differently if you wish). On RedHat Linux you can use the following command to add a new group (other systems may differ):
Next, add the users that your web server and Nagios run as to the newly created group with the following commands (I’ll assume apache and nagios are the respective users):
/usr/sbin/usermod -G nagcmd apache
/usr/sbin/usermod -G nagcmd nagios
Run the Configure Script
Run the configure script to initialize variables and create a Makefile as follows…(the last two options: --with-command-xxx are optional, but needed if you want to issue external commands)
./configure --prefix=prefix --with-cgiurl=cgiurl --with-htmurl=htmurl --with-nagios-user=someuser --with-nagios-group=somegroup --with-command-group=cmdgroup
* Replace prefix with the installation directory that you created in the step above (default is /usr/local/nagios)
* Replace cgiurl with the actual url you will be using to access the CGIs (default is /nagios/cgi-bin). Do NOT append a slash at the end of the url.
* Replace htmurl with the actual url you will be using to access the HTML for the main interface and documentation (default is /nagios/)
* Replace someuser with the name of a user on your system that will be used for setting permissions on the installed files (default is nagios)
* Replace somegroup with the name of a group on your system that will be used for setting permissions on the installed files (default is nagios)
* Replace cmdgroup with the name of the group running the web server (default is nagios)
Compile Nagios and the CGIs with the following command:
Installing The Binaries And HTML Files
Install the binaries and HTML files (documentation and main web page) with the following command:
Installing An Init Script
If you wish, you can also install the sample init script to /etc/rc.d/init.d/nagios with the following command:
You may have to edit the init script to make sense with your particular OS and Nagios installation by editing paths, etc.
Directory Structure And File Locations
Change to the root of your Nagios installation directory with the following command…
You should see five different subdirectories. A brief description of what each directory contains is given in the table below.