[url]http://nagioswiki.com/wiki/index.php/Nagios_and_Fruity_on_CentOS_4.x[/url]

[edit] Install CentOS

[edit] Update CentOS repositories

[edit] Fruity Requirements

Web Server
  • PHP 5.x (5 Is now used, for object oriented support)
    • PHP MySQL Extension
    • PHP Session Extension
  • MySQL Database Engine
    • Tested on MySQL 4.1.
  • Nagios v2.0
    • Nagios v1.x support is no longer supported.
    • You can import v1.x configs, however.

[edit] LAMP

LAMP stuff to install for Nagios and Fruity

yum -y install httpd php mysql mysql-server php-mysql httpd-manual php-adodb php-gd
/etc/init.d/mysqld start
chkconfig mysqld on
/etc/init.d/httpd start
chkconfig httpd on

[edit] PHP4 to PHP5

yum --enablerepo=centosplus upgrade php*
or to do and install, use this command:
yum --enablerepo=centosplus --exclude=php-domxml install php*
(or install individually the files that you need)
or enable entire CentOS 5 repository
or enable CentOS Web Stack

[edit] Vanilla Nagios Install

  • yum search nagios
yum install nagios*
/etc/init.d/nagios start
chkconfig nagios on
ServerName     nagios.yourDomain.com:80
htpasswd -c /etc/nagios/htpasswd.users nagiosadmin (then put in your password)
password: nagios
  • vim /etc/nagios/cgi.cfg
# AUTHENTICATION USAGE
  use_authentication=1
# SYSTEM/PROCESS INFORMATION ACCESS
  authorized_for_system_information=nagiosadmin
# CONFIGURATION INFORMATION ACCESS
  authorized_for_configuration_information=nagiosadmin
# SYSTEM/PROCESS COMMAND ACCESS
  authorized_for_system_commands=nagiosadmin
# GLOBAL HOST/SERVICE VIEW ACCESS
  authorized_for_all_services=nagiosadmin
  authorized_for_all_hosts=nagiosadmin
# GLOBAL HOST/SERVICE COMMAND ACCESS
  authorized_for_all_service_commands=nagiosadmin
  authorized_for_all_host_commands=nagiosadmin

[edit] From INSTALL file

1) "Extract this codebase in your web directory's document root. This will extract the files in a fruity subdirectory."
wget [url]http://easynews.dl.sourceforge.net/sourceforge/fruity/fruity-1.0-rc2.tar.gz[/url]
tar zxfv fruity-1.0-rc2.tar.gz
mv fruity-1.0-rc2.tar.gz fruity
cp fruity /var/www/html/ -R
chown root:root /var/www/html/fruity/ -R
chmod (permissions) /var/www/html/fruity/ -R

2) Create a symlink or copy of your nagios's icon logo's directory to the fruity's base directory with the name of logos.
ln -s /var/www/html/fruity/ /etc/nagios/logos
3) Create a database for fruity in MySQL with select,insert,drop,empty privileges. Import the SQL data contained in sqldata/fruity-mysql.sql
mysql -u root -p
create database fruity
mysql -u root -p fruity < /var/www/html/fruity/sqldata/fruity-mysql.sql
4) Configure the config.inc file in fruity's includes directory. Notes on what each parameter is is specified in the file.
vim /var/www/html/fruity/includes/config.inc
//$sys_config['logos_path'] = '/usr/local/groundwork/fruity/logos';     // Must be symlinked or a copy of the logos directory from nagios
$sys_config['logos_path'] = '/etc/nagios/logos';     // Must be symlinked or a copy of the logos directory from nagios
//$sys_config['nagios_path'] = '/usr/local/nagios/bin/nagios';  // The path to the Nagios binary
$sys_config['nagios_path'] = '/usr/bin/nagios';  // The path to the Nagios binary

5) Point your web browser to your fruity's installation on your webserver to start Fruity.

tail /etc/httpd/logs/error_log

[edit] Post Fruity Configs

(We use "locate file" to find where the file lives on CentOS)
Configuration Directory: /etc/nagios/
This is the location on the filesystem where you would like your nagios configuration files to be stored. The webserver user MUST have write access to this directory and the files within.
Log File: /var/log/nagios/nagios.log
This variable specifies where Nagios should create its main log file. This should be the first variable that you define in your configuration file, as Nagios will try to write errors that it finds in the rest of your configuration data to this file. If you have log rotation enabled, this file will automatically be rotated every hour, day, week, or month.
Object Cache File: /var/log/nagios/objects.cache
This directive is used to specify a file in which a cached copy of object definitions should be stored. The cache file is (re)created every time Nagios is (re)started and is used by the CGIs. It is intended to speed up config file caching in the CGIs and allow you to edit the source object config files while Nagios is running without affecting the output displayed in the CGIs.
Temporary File: /var/log/nagios/nagios.tmp
This is a temporary file that Nagios periodically creates to use when updating comment data, status data, etc. The file is deleted when it is no longer needed.
Status File: /var/log/nagios/status.dat
This is the file that Nagios uses to store the current status of all monitored services. The status of all hosts associated with the service you monitor are also recorded here. This file is used by the CGIs so that current monitoring status can be reported via a web interface. The CGIs must have read access to this file in order to function properly. This file is deleted every time Nagios stops and recreated when it starts.
Log Archive Path: /var/log/nagios/archives/
This is the directory where Nagios should place log files that have been rotated. This option is ignored if you choose to not use the log rotation functionality.
Command File: /var/log/nagios/rw/nagios.cmd
This is the file that Nagios will check for external commands to process. The command CGI writes commands to this file. Other third party programs can write to this file if proper file permissions have been granted as outline in here. The external command file is implemented as a named pipe (FIFO), which is created when Nagios starts and removed when it shuts down. If the file exists when Nagios starts, the Nagios process will terminate with an error message.
Downtime File: /var/log/nagios/downtime.dat
This is the file that Nagios will use for storing scheduled host and service downtime information. Comments can be viewed and added for both hosts and services through the extended information CGI.
Comment File: /var/log/nagios/comments.dat
This is the file that Nagios will use for storing service and host comments. Comments can be viewed and added for both hosts and services through the extended information CGI.
Lock File: /tmp/nagios.lock
This option specifies the location of the lock file that Nagios should create when it runs as a daemon (when started with the -d command line argument). This file contains the process id (PID) number of the running Nagios process.
State Retention File: /var/log/nagios/retention.dat
This is the file that Nagios will use for storing service and host state information before it shuts down. When Nagios is restarted it will use the information stored in this file for setting the initial states of services and hosts before it starts monitoring anything. This file is deleted after Nagios reads in initial state information when it (re)starts. In order to make Nagios retain state information between program restarts, you must enable the retain_state_information option.
p1.pl File: 
This value determines where the p1.pl perl script (used by the embedded Perl interpreter) is located. If you didn't compile Nagios with embedded Perl support, this option has no effect.