How to install NagiosQL on CentOS

How to install NagiosQL on CentOS

NagiosQL is a tool manage Nagios configuration through Web browser. It is a web administration tool designed for Nagios and works with PHP, MySQL and local file or remote access to the Nagios configuration files. This tutorail covers the installation procedure of NagiosQL on CentOS.

Installation procedure

To begin with the installation procedure, first install the Nagios in the system. Install the following required packages for NagiosQL by running the following command and press y to continue with the installation.

[root@node1 ~]# yum install libssh2 libssh2-devel mysql mysql-server php-mysql php-pear php-devel -y
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.mirror.net.in
 * extras: centos.mirror.net.in
 * updates: centos.mirror.net.in
Package libssh2-1.4.2-2.el6_7.1.x86_64 already installed and latest version
Package mysql-5.1.73-8.el6_8.x86_64 already installed and latest version
Package mysql-server-5.1.73-8.el6_8.x86_64 already installed and latest version
Package php-mysql-5.3.3-49.el6.x86_64 already installed and latest version
Resolving Dependencies
-->  Running transaction check
--->  Package libssh2-devel.x86_64 0:1.4.2-2.el6_7.1 will be installed
.
.
.
Dependency Updated:
  e2fsprogs.x86_64 0:1.41.12-23.el6       e2fsprogs-libs.x86_64 0:1.41.12-23.el6       krb5-libs.x86_64 0:1.10.3-65.el6       krb5-workstation.x86_64 0:1.10.3-65.el6       libcom_err.x86_64 0:1.41.12-23.el6     
  libss.x86_64 0:1.41.12-23.el6           openssl.x86_64 0:1.0.1e-57.el6 
Complete!

Install the SSH2 package using pecl php extension by running the following command.

[root@node1 ~]# pecl install ssh2
downloading ssh2-0.13.tgz ...
Starting to download ssh2-0.13.tgz (28,984 bytes)
.........done: 28,984 bytes
6 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
libssh2 prefix? [autodetect] :
building in /var/tmp/pear-build-root1KTaHv/ssh2-0.13
running: /var/tmp/ssh2/configure --with-ssh2
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
.
.
.
Build process completed successfully
Installing ' /usr/lib64/php/modules/ssh2.so' 
install ok: channel://pecl.php.net/ssh2-0.13
configuration option " php_ini"  is not set to php.ini location
You should add " extension=ssh2.so"  to php.ini

Go to below mentioned directory and download the package for NagiosQL and execute the following commands.

[root@node1 ~]# cd /usr/local/nagios/share
[root@node1 share]# wget http://sourceforge.net/projects/nagiosql/files/nagiosql/NagiosQL%203.2.0/nagiosql_320.tar.gz
--2017-05-26 19:43:11--  http://sourceforge.net/projects/nagiosql/files/nagiosql/NagiosQL%203.2.0/nagiosql_320.tar.gz
Resolving sourceforge.net... 216.34.181.60
.
.
.
HTTP request sent, awaiting response... 200 OK
Length: 1417124 (1.4M) [application/x-gzip]
Saving to: “ nagiosql_320.tar.gz” 
100%[==========================================================================================================================================================================> ] 1,417,124   1.04M/s   in 1.3s   
2017-05-26 19:43:17 (1.04 MB/s) - “ nagiosql_320.tar.gz”  saved [1417124/1417124]

Extract the downloaded package using the following tar command.

[root@node1 share]# tar -xzvf nagiosql_320.tar.gz
nagiosql32/
nagiosql32/admin/
nagiosql32/admin/contacts.php
nagiosql32/admin/monitoring.php
nagiosql32/admin/helpedit.php
nagiosql32/admin/delconfig.php
nagiosql32/admin/index.html
nagiosql32/admin/verify.php
nagiosql32/admin/group.php
.
.
.
nagiosql32/functions/yui/build/json/
nagiosql32/functions/yui/build/json/json-min.js
nagiosql32/functions/prepend_scripting.php
nagiosql32/functions/mysql_class.php
nagiosql32/functions/data_class.php
nagiosql32/favicon.ico

Rename the extracted directory as “ webadmin” and set user and group ownership and also file permissions by extracting the following command.

[root@node1 share]# mv nagiosql32 webadmin
[root@node1 share]# chown -R apache:apache .
[root@node1 share]# chmod -R 775 .

Next set the Timezone on php.ini configuration file. Save and exit from the file.

[root@node1 share]# vim /etc/php.ini
Timezone = Asia/Kolkata

Restart the apache service by executing the following command.

[root@node1 share]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

Now open the browser and start NagiosQL installation by using below URL http://192.168.7.171/nagios/webadmin/install/index.php and enter the link.

The NagiosQL installation wizard page appears. Click start installation to continue with the process.

Check the settings, system permissions and available database interfaces and click next.

Enter the database details by entering the required information to create the database and click next.

An error may occur stating the NagiosQL config path is not writable. So to remove this error, return to the terminal.

The terminal is opened and execute the below set of commands to clear the impending config path issue.

[root@node1 share]# cd /etc/
[root@node1 etc]# mkdir nagiosql
[root@node1 etc]# chmod -R 775 nagiosql/
[root@node1 etc]# chown -R nagios.apache nagiosql/
[root@node1 etc]# mkdir nagios
[root@node1 etc]# chmod -R 775 nagios
[root@node1 etc]# chown -R nagios.apache nagios

After executing the set of commands, click reload on the browser and the issue will be resolved. Click next.

The installation process is completed. The NagiosQL login page appears, enter the required credentials and login to the NagiosQL.

The NagiosQL is running and now the user can use the tool for various database administration purposes.

Wasn' t that an easy installation procedure? NagiosQL supports the auto backup of configuration files and does consistency checks periodically.

Comment
nirmal
Dec 03 2020
I have tried to install NagiosQL but page is not opening. Anyone can help?

This page isn’t working right now149.20.187.188 can't currently handle this request.
HTTP ERROR 500
mikewillson
Sep 03 2018
Hi, I got this error and I want to know how to fix it. Please help me. invalid Write test on settings directory (config/): failed
parthiban
Jun 11 2018
Hi @anderson how you installed Nagios on your machine, what is the default installation location of your Nagios setup (for example the default is /usr/local/nagios) so we can find the nagios binary here /usr/local/nagios/bin/nagios so please check with your installation location it might be changed or something else
andersonporfirio
Jun 06 2018
Hi! I've installed well on CentOS7, but when I try execute the Nagios Control functions I have a message "nagiosql Cannot find the Nagios binary". I've tried change the permissions, but the message keep the same, any help? Thanks.
anishroila
May 13 2018
once you follow the above procedure , as @mikehomee said u will be stuck on 'apache'@'localhost' error.For that we need to install mysql-server (yum -y install mysql-server) .if already installed then remove (yum -y remove mysql-server) and reinstall .configure mysql installatioin (mysql_secure_installaton).then you will be able to successfully login .Be Careful while creating a user in database because it is case sensitive,password must be given carefully eg. password123#.
Add a comment
FAQ
Q
What are the Nagiosql Backup files?
A
NagiosQL backup configuration

sudo chmod 6755 /etc/nagiosql/backup
sudo chown www-data.nagios /etc/nagiosql/backup
sudo chmod 6755 /etc/nagiosql/backup/hosts
Q
What are the configuration file fpr Nagiosql?
A
Nagios main configuration files

sudo chgrp www-data /etc/nagios
sudo chgrp www-data /etc/nagios/nagios.cfg
sudo chgrp www-data /etc/nagios/cgi.cfg
Q
What is Nagios?
A
Nagios has a lot to offer, though the setup and administration of the network monitoring tool can be a challenge. Even once this powerful system is up and running, you have to manually configure flat text files to add hosts, domains, alerts, and more.
Q
What are the main features in Nagios?
A
NagiosQL's features include these capabilities:

Build complex configurations
Manage and use all of your configurations
Create, delete, modify, and copy settings
Create and export configuration files
Q
What are the requirements in Nagisql
A
NagiosQL's installation requirements

Web server (Apache 2.x or greater preferred)
MySQL 5.x or greater
Nagios 2.x/3.x (local or remote)
PHP 5.2.0 or greater including: