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.

Advertisement

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

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 START INSTALLATION

nagiosql-1

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 Next

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 Next

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 Next

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

Congratulation’s You have successfully installed Nagios with NagiosQL3.

References:
http://www.nagios.org/about

Share.

68 Comments

  1. while installing nagiosql, it is giving error in mysql extension.

    ”Mysql not available’

    Although ia have installed mysql and all its extensions for php.

  2. 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.

  3. avraham shir-el on

    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

  4. 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?

  5. 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

  6. 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/

  7. 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/

  8. 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

  9. 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!

      • 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 🙁

  10. 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 .

  11. 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!

  12. 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.

  13. 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?

  14. 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 Tomasz.

      Are you using correct MySQL root credentials under “Administrative Database User” and “Administrative Database Password ? Verify mysql login through command line.

  15. 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

  16. 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

      • 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

  17. 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

  18. Balkishan Singh on

    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/

  19. 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.

  20. 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?

  21. 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?

  22. Pradeep Kumar on

    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

      • “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.

  23. 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

  24. 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

  25. 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

  26. 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.

  27. 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

  28. 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

  29. 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:

  30. 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.

    • Sandeep Kumar Patial on

      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.

  31. 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

  32. 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 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

Exit mobile version