|
NagiosQL Documentation
- Requirements
- Installation
- HTML_Template_IT
- NagiosQL
- Download and Decompress
- MySQL
- Configuration
- Apache
- PHP
- Directory Structure
- Nagios
- Permissions
- Verify Installation and Configuration
- Running NagiosQL
Requirements - Webserver (Apache 1.3.x/2.0.x)
- PHP Version 4.1 or higher / 5.0 or higher
- MySQL Version 4.1 or higher / 5.0 or higher
- Pear Module HTML_Template_IT Version 1.1 (http://pear.php.net)
- Nagios Version 2.x (1.x is not supported)
- Javascript supported by your browser
- Cookies accepted by your browser
Installation HTML_Template_IT Pear modules can be installed automatically by invoking the following command (requires internet access): # pear install HTML_Template_IT
NagiosQL Download and Decompress Download latest NagiosQL Version from www.nagiosql.org and decompress the nagiosql-*.tar.gz to a directory accessible by your webserver (e.g. /srv/www/htdocs). A subdirectory "nagiosQL" will be created: # cd /srv/www/htdocs/ # cp nagiosql-*.tar.gz /srv/www/htdocs/nagiosQL/ # tar zxvf nagiosql-2.00-P00.tar.gz
MySQL Create the MySQL database by invoking the following command. The MySQL script automatically creates a new database with the name db_nagiosql_v2, all tables as well as the user "nagiosqlusr" with the password "nagiosqlpwd". # cd /srv/www/htdocs/nagiosQL/config # mysql -uroot -p < nagiosQL_v2_db_mysql.sql # Password: xxxx
In our example we use a database user "root" with password "xxxx". For security reasons we strongly advice to set a new password for the user: # mysql -uroot -p # Password: xxxx mysql> use mysql; mysql> UPDATE user SET Password=PASSWORD("mypassword") WHERE User="nagiosqlusr"; mysql> FLUSH PRIVILEGES; mysql> exit
Configuration Apache 1. By using the provided .htaccess file For .htaccess files it is required to have AllowOverride set to All in your Apache configuration: <Directory /srv/www/htdocs/nagiosQL> AllowOverride All </Directory>
2. or by amending the Apache configuration (RECOMMENDED!) Just add the following entry to your Apache configuration: <Directory /srv/www/htdocs/nagiosQL> <FilesMatch \.(?i:ini)$> Order allow,deny Deny from all </FilesMatch> </Directory>
In case of changes to the apache configuration you need to reload your apache server. SECURITY: You have two options to secure your configuration files (*.ini). .htaccess files should be used in a case where the content providers need to make configuration changes to the server on a per-directory basis, but do not have root access on the server system. However, in general, use of .htaccess files should be avoided when possible. Any configuration that you would consider putting in a .htaccess file, can just as effectively be made in a <Directory> section in your main server configuration file. Please check if your server is secure by trying to download your own configuration http://www.domain.tld/nagiosQL/config/settings.ini If you can see the file, your configuration is not secure! PHP NagiosQL requires to have 'magic_quotes_gpc = On' in your php.ini Directory Structure It is required to have the following directory structure (you can change the directory names in your NagiosQL settings.ini): /etc/nagios/ -> Common configuration files " /hosts -> Host configuration files " /services -> Service configuration files " /backup/ -> Backups of the common configuration files " " /hosts -> Backups of the host configuration files " " /services -> Backups of the service configuration files
Nagios In order to find the configuration files generated by NagiosQL your Nagios configuration must be amended, too. You are free to change the directory names, but be sure to do that in both configuration files (Nagios: nagios.cfg, NagiosQL: settings.ini). The directory structure (e.g. backup dirs below main dir) should never be changed! The Nagios configuration file nagios.cfg must be amended as follows: cfg_file=/etc/nagios/contactgroups.cfg cfg_file=/etc/nagios/contacts.cfg cfg_file=/etc/nagios/timeperiods.cfg cfg_file=/etc/nagios/hostgroups.cfg cfg_file=/etc/nagios/servicegroups.cfg
#cfg_file=/etc/nagios/servicedependencies.cfg #cfg_file=/etc/nagios/serviceescalations.cfg #cfg_file=/etc/nagios/hostdependencies.cfg #cfg_file=/etc/nagios/hostescalations.cfg #cfg_file=/etc/nagios/hostextinfo.cfg #cfg_file=/etc/nagios/serviceextinfo.cfg
cfg_dir=/etc/nagios/hosts cfg_dir=/etc/nagios/services The lines started with # are optional. Permissions The following file permissions are required to let NagiosQL read and write the Nagios configuration files. In our example the Apache runs as user "wwwrun" and the group "www" as well as Nagios runs by the user "nagios" and the group "daemon". The configuration files are located at /etc/nagios. Please amend if this differs from your installation. # chmod 6755 /etc/nagios # chown wwwrun.daemon /etc/nagios # chmod 6755 /etc/nagios/hosts # chown wwwrun.daemon /etc/nagios/hosts # chmod 6755 /etc/nagios/services # chown wwwrun.daemon /etc/nagios/services # chmod 6755 /etc/nagios/backup # chown wwwrun.daemon /etc/nagios/backup # chmod 6755 /etc/nagios/backup/hosts # chown wwwrun.daemon /etc/nagios/backup/hosts # chmod 6755 /etc/nagios/backup/services # chown wwwrun.daemon /etc/nagios/backup/services
# chmod 644 /etc/nagios/*.cfg # chown wwwrun.daemon /etc/nagios/*.cfg
If these directories already have files, amend the permissions for them, too: # chmod 644 /etc/nagios/hosts/*.cfg # chown wwwrun.daemon /etc/nagios/hosts/*.cfg # chmod 644 /etc/nagios/services/*.cfg # chown wwwrun.daemon /etc/nagios/services/*.cfg
The Nagios binary must be executable by the Apache user: # chown nagios.www /usr/sbin/nagios # chmod 750 /usr/sbin/nagios
Be sure the Apache user is able to write the Nagios commandfile. Please check your nagios.cfg for the correct path to the commandfile! # chown nagios.www /usr/local/nagios/var/rw/nagios.cmd # chmod 660 /usr/local/nagios/var/rw/nagios.cmd
Verify Installation and Configuration Please check http://www.domain.tld/nagiosQL/testQL.php for possible errors. Running NagiosQL Now you should be able start NagiosQL: http://www.domain.tld/nagiosQL/index.php The first login can be done with the following user: Username: admin Password: admin SECURITY: The first thing to do is to set a new password for admin!!!
|