Firstly, make sure you have installed Nagios core service. Else use our previous articles for installation steps of Nagios core service on Redhat based systems or Debian based system. Now read this article to install NagiosQL3 web interface for Administration of Nagios server using web interface. If you have installed Nagios core service with some other type. Please be careful with directories and files path and configuration files.
We have successfully configured and integrated NagiosQL with Nagios using below steps. But we can not sure that it will 100% work for you. You may get few errors during setup. Feel free to ask related to any issues on comments for our question/answers section.
Step 1 – Install Required Packages
First, we need to install required packages, Use the following commands to install them.
RedHat Based Systems:
yum install libssh2 libssh2-devel mysql mysql-server php-mysql php-pear php-devel pecl install ssh2 ##if above command not worked use below else skip it pecl install channel://pecl.php.net/ssh2-0.12
Debian Based Systems:
sudo apt-get install libssh2-1 libssh2-1-dev mysql mysql-server sudo apt-get install php-mysql php-pear php-devel php-ssh2 php-gettxt
Step 2 – Download NagiosQL3 Archive
Download the latest available nagiosql3 archive and extract in Nagios document root using commands.
cd /usr/local/nagios/share wget http://sourceforge.net/projects/nagiosql/files/nagiosql/NagiosQL%203.2.0/nagiosql_320.tar.gz tar xzf nagiosql_320.tar.gz mv nagiosql32 webadmin chown -R apache:apache . chmod -R 775 .
Step 3 – Setup PHP Timezone
Edit php.ini file and update following variable with required timezone. Click here to get list of available timezone
1 2 3 4 5 | [Date] ; Defines the default timezone used by the date functions ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone date.timezone = 'Asia/Kolkata' |
Restart Apache web server after editing PHP configuration.
service httpd restart
Step 4 – Start NagiosQL3 Web Installer
NagiosQL3 provides web installer to install package. Open below URL to start web installer for nagiosql. follow steps as shown in URL. Web installer will help you about for any changes required.
http://svr1.tecadmin.net /nagios/webadmin/install/index.php
4.1: Start Installation Wizzard
Open the above url and click the button
4.2: Verify Requirements
At this screen, installer will check the required packages are installed or not. If you see any error on this screen, fix that manually and click
4.3: NagiosQL Setup
In this step installer will input the database details to be used for nagiosql. Also update the nagiosql path values as per given screenshots. Click
If you have installed Nagios at some other place, only then change the values of the path.
4.4: Finishing Setup
This screen showing that all the steps has successfully completed. You just need to click
4.5: NagiosQL Login
After completing installation, you will be redirected to NagiosQL login screen.
Step 5 – Access NagiosQL3 Web UI
After completing web installer, it will automatically redirect you to the nagiosql3 admin panel. To open it later using URL.
http://svr1.tecadmin.net /nagios/webadmin
Step 6 – Integrate NagiosQL3 with Nagios
This is the most important part of NagiosQL setup, It may be your setup is different than me, so be careful with below step. I am trying my best to write to complete integration.
6.1 – Edit NagiosQL Configuration
Login to NagiosQL administrator section and navigate to Administration -> Administration -> Config targets and click on Modify button for Local installation.
At the below screen, you will find configuration file path, make sure all folder exists in the first section and check the file’s path with Nagios core configuration file.
6.2 – Edit Nagios Core Configuration File
Now edit nagios configuration file /usr/local/nagios/etc/nagios.cfg and commend all earlier cfg_file and cfg_dir configuration settings and add new cfg_dir with /usr/local/nagios/nagiosql only.
cfg_file=/usr/local/nagios/nagiosql/commands.cfg cfg_file=/usr/local/nagios/nagiosql/contactgroups.cfg cfg_file=/usr/local/nagios/nagiosql/contacts.cfg cfg_file=/usr/local/nagios/nagiosql/contacttemplates.cfg cfg_file=/usr/local/nagios/nagiosql/hostdependencies.cfg cfg_file=/usr/local/nagios/nagiosql/hostescalations.cfg cfg_file=/usr/local/nagios/nagiosql/hostextinfo.cfg cfg_file=/usr/local/nagios/nagiosql/hostgroups.cfg cfg_file=/usr/local/nagios/nagiosql/hosttemplates.cfg cfg_file=/usr/local/nagios/nagiosql/servicedependencies.cfg cfg_file=/usr/local/nagios/nagiosql/serviceescalations.cfg cfg_file=/usr/local/nagios/nagiosql/serviceextinfo.cfg cfg_file=/usr/local/nagios/nagiosql/servicegroups.cfg cfg_file=/usr/local/nagios/nagiosql/servicetemplates.cfg cfg_file=/usr/local/nagios/nagiosql/timeperiods.cfg cfg_dir=/usr/local/nagios/nagiosql/hosts cfg_dir=/usr/local/nagios/nagiosql/services
Step 7 – Restart Nagios Core Service
Finally, verify Nagios core configuration file and restart service using commands.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If above command shows no errors on screen, restart Nagios core service
service nagios restart
References:
http://www.nagios.org/about
68 Comments
while installing nagiosql, it is giving error in mysql extension.
”Mysql not available’
Although ia have installed mysql and all its extensions for php.
Hi Rahul, im facing this problem:
Access denied for user ‘mysqladmin’@’localhost’ to database ‘db_nagiosql_v34’
Database server connection (privileged user) passed (mysqli)
Database server version 5.7.24-0ubuntu0.18.04.1
Database server support supported
Delete existing NagiosQL database done (db_nagiosql_v34)
Creating new database done (db_nagiosql_v34)
Installing NagiosQL database tables done
Create NagiosQL database user failed
i tried with root user and mysqladmin but its the same error.
Thanks in advance.
Please!
How to fix error: Write test on settings directory (config/): failed
i have a question related to step 6.2 of u’r instuctions.
after confirming that all dirs exist and all file listed in the 2nd section r consistent with the pathnames in
nagios.cfg, step 6.2 tells me to comment out all the cfg_dir and cfg_file defs and change to the pathnames you list. (/usr/local/nagios/nagiosql…)
won’t this render the settings in step 6.1?
what am i misunderstanding here?
tnx
ams
Hi! I’m having error after successfully finishing the guide. It always prompt me an invalid login.
And one question more, is it okay if the Database Type is set to mysqli? In this guide, it only shows mysql.
Thnks!
– MD
Yes, its fine. MySQLi is the improved version of mysql php module.
Are you facing issue on NagiosQL admin login? or web server basic authentication configured with Nagios core?
Hi Rahul,
Yes, I’m having problem logging in. It always say “login failed’ even though my login credentials is correct.
Can you help me, fix my issue? 🙁
Thank you!
Hi Rahul,
Yes I’m still having issues upon login. I always gets a ‘Login Failed!’ error.
Anther thing, if anyone is having issue when trying to set the time zone then just copy and past this CLI in. when you locate the time zone and add your time zone in, remember to remove the # or it will not work.
nano /etc/php5/apache2/php.ini
Also, if anyone is having this issue then enter in this CLI (maybe not recommend but is a work around then spending hours and hours)
if you get this error then this should be the fix.
cd /etc/
mkdir nagiosql
chmod -R 775 nagiosql/
chown -R nagios.apache nagiosql/
mkdir nagios
chmod -R 775 nagios
chown -R nagios.apache Nagios
chmod -R 777 /etc/
Write failed error, then just copy and past this in
(Write test on settings directory (config/): failed)
The below command resolved the issue for me
chmod -R 777 /usr/local/nagios/share/nagiosql32/
Dear Brother Rahul,
As I installed packet ssh2 completed, but I can’t use command for install it.
[root@centos ~]# pecl install ssh2
bash: pecl: command not found…
[root@centos ~]# pecl install channel://pecl.php.net/ssh2-0.12
bash: pecl: command not found…
Help assist me.
Best Regards.
Sreyny
Hi Sreyny, Please install php-pear package to get pecl command. I have updated in the tutorial as well.
Dear Brother,
After test again, it show the result like this
ERROR: `phpize’ failed
Thank you for assisted me
Best Regards
Sreyny
Hi Sreyny,
Please install php-devel package. I have updated tutorial accordingly.
Hi,
I followed the instructions and successfully finished the setup. But when I click the “finish” button, I’m back to the first page of installation. I did repeat the installation but still looping back to first page.
Please help!
Hi, I think you didn’t removed “install” directory.
Yeah, I thought it’s okay not to remove the directory.
Now that I completed the installation, I can’t login to NagiosQL. 🙁
There’s a red text below login…
Error while selecting data from database
:Access denied for user ‘apache’@’localhost’ (using password: NO)
Already gave privileges to apache user. Not sure what to do next. Please help 🙁
installing SE linux enforcing, I had to do these to get green for everything on the page “NagiosQL Installation: Checking requirements”
After this step: # mv nagiosql32 webadmin
# touch /usr/local/nagios/share/webadmin/config/settings.php
# semanage fcontext -a -t httpd_nagios_rw_content_t /usr/local/nagios/share/webadmin/config/settings.php
# restorecon -v /usr/local/nagios/share/webadmin/config/settings.php
and before this step: # chown -R apache:apache .
Hello everybody I hope you can help me, I actually installed everything but when try to setup Nagiosql via browser I have an error message ” Settings file not found or not readable (config/settings.php). Upgrade not available! ”
what do I have to do? I had other issues that I fixed by myself. But with this I need assistance.
Thank you!
Hi,
I just installed nagios core 4.x, then when about to install nagiosQL, error on requirement “Write test on settings directory (config/): failed”. Is it because I used nagios 4.x? I even change the dir to 777 but no luck.
I ran into this problem “Write test on settings directory (config/): failed” and can’t figure out how to fix it even though I tried to chmod the config folder at /usr/local/nagios/webadmin/config to 777 and other random permissions.
Is there another config file at a different location I should be dinking with?
Everything work, the installations. But after a restart from nagiosql, the config file is not getting reloaded. Forced to do a restart from command line. Any comments?
Hi
I did everything like in intructions but get that error ;/
http://imgur.com/a/GbUCz
Any idea why? What do?
Hi Tomasz.
Are you using correct MySQL root credentials under “Administrative Database User” and “Administrative Database Password ? Verify mysql login through command line.
Please write down here how can i resolve sql database problem with command line and how can i connect sql on command line , please write all steps
I am stuck in this step, please help
NagiosQL Installation: Finishing Setup
Create new NagiosQL database
Error while connecting to database:
Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
Database server connection (privileged user) failed
Hi Sandeep,
Issue looks on database. Make sure you can connect to mysql using command line with same credentials.
how can i check my sql server? i dont have any idea about it? please elaborate my problem solution
Let you start mysql by command:
# service mysqld start
Then set password login mysql for root.
I am not getting “php.ini” file, how to fix this problem, where to add timezone??
Try following command to find file
php -i | grep “php.ini”
Thanks rahul, it was helpful, but i stuck in next step, please help to resolve
NagiosQL Installation: Finishing Setup
Create new NagiosQL database
Error while connecting to database:
Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
Database server connection (privileged user) failed
Good doc, some more info can be added for an L board like us, like permission, do and donts will help too.
Thanks for the doc
Hello guys,
Please refer to the following commands to set up the nagiosql.
step 1: installing nagios on centos
http://tecadmin.net/install-nagios-core-service-on-centos-rhel/
http://tecadmin.net/install-nagiosql-with-nagios-core-on-centos-rhel/
prob1: Setting up variable of date.timeZone=Asia/kolkata(Note: Remove semi collan before date.timezone)
prb2: Setting SSH2 Not availabe issue:
soln: http://programster.blogspot.in/2013/06/centos-64-install-ssh2-extension-for-php.html
prob3: Write test on settings directory(config/):failed
soln 1st: # echo 0 >/selinux/enforce
# sed -i ‘s/SELINUX=enforcing/SELINUX=disable/’ /etc/selinux/config
soln 2nd: # service iptables stop
# chkconfig iptables off
# gedit /etc/selinux/config
edit selinux=Disabled and Save.
#reboot
Prob4: NagiosQL Installation Setup Finishing
mysql.sock error or something
DB creation Permission is denied for root@localhost
Soln:
# service mysqld start
# chkconfig mysqld on
# mysql_secure_installation
# mkdir /etc/nagiosql
#chown apache.apache /etc/nagiosql/
heyy Rahul
I think i am facing problem in Step 4.3 Nagiosql Setup.
After clicking next it shows
Error while connecting to database:
Access denied for user ‘root’@’localhost’ (using password: YES)
Database server connection (privileged user) failed
I tried everything still no success. If u can help me out it would of great help.
Well everything is fine, some inconsistency here (permissions to nagios and not including apache) but fine…
My issue is that when I try to save configurations or any other stuff by clicking on the SAVE button, it makes nothing, zero, nada. If I click on Abort or any other part of the menu its fine… so I think it has to be something with saving permsissionsmore than with a JS….
Any idea?
I have spent all day trying to get this to work. I have got as far as the Installation page. For my NagiosQL config path I have /usr/local/nagios
For my Nagios config path I have /usr/local/nagios/etc. This is where Nagios seems to be installed on my Centos 6.6
But the problem is, when I click in to the next screen, I get “NagiosQL config path is not writeable – only database values updated”
My eyes are now sore from Googling and I am so tired from trying to get past this stage all day where I nearly feel like giving up 🙁
I assume this is some permissions problem, but how can I fix it?
Hi,
Can you show me what permissions do you have on nagiosql directories ?
Hi Rahul,
While running below command I am getting three errors
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Nagios Core 4.0.7
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 06-03-2014
License: GPL
Website: http://www.nagios.org
Reading configuration data…
Read main config file okay…
Read object config files okay…
Running pre-flight check on configuration data…
Checking objects…
Error: There are no services defined!
Checked 0 services.
Error: There are no hosts defined!
Checked 0 hosts.
Checked 0 host groups.
Checked 0 service groups.
Error: There are no contacts defined!
Checked 0 contacts.
Checked 0 contact groups.
Checked 0 commands.
Checked 0 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths…
Checked 0 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 0 timeperiods
Checking global event handlers…
Checking obsessive compulsive processor commands…
Checking misc settings…
Total Warnings: 0
Total Errors: 3
***> One or more problems was encountered while running the pre-flight check…
Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
‘Whats New’ section to find out what has changed.
Thanks
Pradeep
Hi Pradeep,
Please add host, service and contact in nagios.
“Add host, service and contact in nagios” Can you detail a little bit? I have the same issue. You mean to add host, service and contact folder in nagios folder or create some properties in nagios.cfg? If yes may you post them? Thx a lot for the support
please give detail to add host, service and contact to fix this issue. I get same error like this one. Thanks alot for your support.
Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
Hi,
Please check that MySQL service is running properly.
after step 6.2: Edit Nagios Core Configuration File step 7 gives below error
Nagios Core 4.0.7
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 06-03-2014
License: GPL
Website: http://www.nagios.org
Reading configuration data…
Read main config file okay…
Read object config files okay…
Running pre-flight check on configuration data…
Checking objects…
Error: There are no services defined!
Checked 0 services.
Error: There are no hosts defined!
Checked 0 hosts.
Checked 0 host groups.
Checked 0 service groups.
Error: There are no contacts defined!
Checked 0 contacts.
Checked 0 contact groups.
Checked 0 commands.
Checked 0 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths…
Checked 0 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 0 timeperiods
Checking global event handlers…
Checking obsessive compulsive processor commands…
Checking misc settings…
Total Warnings: 0
Total Errors: 3
***> One or more problems was encountered while running the pre-flight check…
Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
‘Whats New’ section to find out what has changed.
when uncommitted error 0
please help
You run this command: # chown -R apache:apache nagiosql
Then run: # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
hello, i have an issue when i try to restart nagios from nagiosql it seems that nagios was restarted because it says Reset command sent to Nagios successfully but its not true because any change takes effect, please help me i’am using nagios core 4.0.7 and nagiosql 3.2.0
hello, i have an issue when i try to restart nagios from nagiosql it seems that nagios was restarted because it says Reset command sent to Nagios successfully but its not true because any change takes effect, please help me i’am using nagios core 4.0.7 and nagiosql 3.2.0
Hi Rahul,
Your article helped me to install Nagios and NagiosQL successfully. Thanks for your article. I am having an issue, I can add host on NagiosQL successfully, and can see it on Hosts panel and database also. But the information in not updating in Nagios. As I heard, If I add any host in NagiosQL, it will show on Nagios automatically. Could please help me on this?? Can you please tell me from which file Nagios get the host information from NagiosQL. Thanks once again.
I am still getting came.
Where do i place this folder i give rights to.
Please please i need help on this part. I am desperate. Real newbe here
when running the web gui and it does it checks i get write test on settings directory (config/):failed
Thanks
Thanks i will try again today
Thanks so much for the fine work but i think i need to give up on this one.
there is some step somewhere missing on this how to.
i get when running the web gui and it does it checks i get write test on settings directory (config/):failed
no getting around it and 2 days is enough time thanks
when running the web gui and it does it checks i get write test on settings directory (config/):failed
how can i fix this?
Thanks!
What I did to get around it was to create the /etc/nagios directory as it did not exist. Then set the rights to 777. You will change the config path later anyways. This will just get you buy that error so you can keep going. Probably not the way it should be done but it got me working. Hth.
still get Write test on settings directory (config/): failed
What can i do to correct this. ugggg i suck a Linux.
I made the dir as suggested
mkdir /etc/nagios
chown -R apache:apache /etc/nagios
[root@localhost share]# chmod -R 777 /etc/nagios
[root@localhost share]#
here is the solution:
# echo 0 >/selinux/enforce
# sed -i ‘s/SELINUX=enforcing/SELINUX=disable/’ /etc/selinux/config
from:
Thanks for the tut, very helpful so far.
On step 4.3, i get
“NagiosQL config path is not writeable – only database values updated”
I have everything just like the screenshot. Everything is “pass” or “done” but for “Create and/or store NagiosQL path settings.” It reports fail and the above error message is displayed at the top.
Thanks again for the help!
Hi Lyall,
Give full permission to nagios configuration files and try. It worked for me guess it should help u.
How
I have done all I know to do and still same error that config is not writable
My Name is Sandeep Fix for this error.
“NagiosQL config path is not writeable – only database values updated”
This error is occurred when there is no directory in the path given for Nagios Config file, so create dir and grant permissions. Here we go.
[root@guinagios ~]# cd /etc/
[root@guinagios etc]# mkdir nagiosql
[root@guinagios etc]# chmod -R 775 nagiosql/
[root@guinagios etc]# chown -R nagios.apache nagiosql/
[root@guinagios etc]# mkdir nagios
[root@guinagios etc]# chmod -R 775 nagios
[root@guinagios etc]# chown -R nagios.apache nagios
Retry again for QL installation. This should fix the issue.
Hi Folks,
I couldn’t find that php.ini file any where in my machine so i couldn’t enter the time zone, which eventually throws an error. My machine configuration is Centos -6.4 with 8 Gb ram i5 processor.
Thanks
Vijay
Hi Vijay,
It should be at /etc/php.ini
Hello,
did’t work for me , I guess something is missing
The requested URL /nagios/webadmin/install/index.php was not found on this server.
hi,
Thanks for article. This worked fine but do you have any idea if how to configure monitoring for Dell powerconnect switch (which is a stack) via plugin (script) in nagiosQL? I have found plugin here http://exchange.nagios.org/directory/Plugins/Hardware/Network-Gear/Dell/PowerConnect-Switches/details but dont know how to proceed..
Regards,
Kim
Hi Kim,
First confirm if plugin is working properly from nagios server.
1. Download plugin file to server
2. Run following command and check results.
./check_powerconnect -H REMOTE-IP -t uptime
Hi Rahul,
I am using Nagios Version 4.2.0 & OS,PHP version are as given below.
OS : Red Hat Enterprise Linux Server release 6.8 (Santiago)
PHP : PHP 5.3.3
Now due to cyber security issue, we have a requirement to upgrade PHP version from 5.3.3 to 7.0. But my concern is about PHP compatibility issue. Does Nagios 4.2 supports PHP 7.0? Please treat this text on priority & give me a reply.
HI Sanjin,
Yes Nagios 4.2 will work with PHP 7. If you are also using NagiosQL3, make sure to upgrade it to latest version 3.3.0.
https://sourceforge.net/projects/nagiosql/files/nagiosql/NagiosQL%203.3.0/