nagiosql on nginx

Linux Aug 18, 2018

This tutorial descripes how to config nginx for nagiosql.

NagiosQL is a web based configuration tool for nagios written in PHP and JavaScript.

Features

  • Support for Nagios 2.x/3.x/4.x
  • Support for several configuration sets on different Nagios servers (domains)
  • Common domain for standardized configuration objects
  • Support for local filesystem, FTP and SSH/SCP
  • Support for every known Nagios object definition option
  • Support for template definitions (host, services, contacts)
  • Free variable support
  • Configurations are stored in a MySQL/MariaDB database
  • Scripting interface for automated job processing (import, export, test, restart)
  • Very stable configuration importer for existing configuration files
  • Security system for object based user/group access rights
  • Powerful installer for an easy installation and upgrade
  • Multilingual support
  • Continuous development since 2005
  • Requires a webserver, PHP 5.5 or above and MySQL/MariaDB 5.x or above (PHP 7.x Support added in 3.4.0)

First you need an nginx server configuation like this:

location /nagiosql/ {
        root /var/www;
        index index.php;

        location ~ ^/nagiosql/(.+\.php)$ {
                rewrite ^/nagiosql/admin/(.*)\.php/nagiosql/admin/info.php /nagiosql/admin/info.php permanent;
                rewrite ^/nagiosql/admin/(.*)\.php/nagiosql/admin/mutdialog.php /nagiosql/admin/mutdialog.php permanent;

                include /etc/nginx/fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                fastcgi_param PATH_INFO $fastcgi_script_name;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }
        location ~* ^/nagiosql/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
               root /var/www/;
       }
}

The index is defined to index.php and every php file in nagiosql is parsed by php7.0-fpm.socket the fastcgi_parms are the nginx defaults.
The rewrite rules define that the Javascript calls for help- and change- dialog has to be rewritten to match the locations.
For loading stylesheets and images you need to add the root for these files.

Now reload the nginx service with:

service nginx reload

and start the nagiosql installations on

http://localhost/nagiosql/

Links:
https://sourceforge.net/projects/nagiosql/

Tags

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.