Issues with Icingaweb and Nagvis integration after moving to root

I have successfully installed Icinga, Icingaweb2 and Director on freshly installed Debian9. Althought there were a couple problems along the process, everything worked fine.
I installed NagVis and NagVis Icinga module. It also worked fine.

But then I’ve decide to move Icingaweb2 from /icingaweb2 to the root directory of my server. Now the whole system available at

The problem is that NagVis no more seems to be working when one try to open a map in the Icingaweb interface.
Server returns an error:

Not Found
The requested URL /nagvis/show/map was not found on this server.

But the Nagvis itself is working if I open /nagvis, I believe there may be possible problems with nagvis module.

I haven’t found any options to change, except this one in nagvis.ini.php:


I tried to change this to “/” but no luck.

I’ve found this thread
TS had same problem, then he figured it out. But obviously he thought this is too simple problem not worth to post a solution.

I’ll be grateful if anyone help me with that.

Did you set the cookie path inside the config.ini, logged out, cleared all cookies, restart the browser and login again?

The cookie path is set to “/” since I’ve installed the nagvis.
Yes, I did all of that. I also have tried from another PC - same result

Can you share your Apache configuration for NagVis please?

Hi! No problem.
I did not change anything here.

> Alias /nagvis "/usr/local/nagvis/share"
> <Directory "/usr/local/nagvis/share">
>   Options FollowSymLinks
>   AllowOverride None
>   <IfModule mod_authz_core.c>
>     # Apache >= 2.4
>     Require all granted
>   </IfModule>
>   <IfModule !mod_authz_core.c>
>     # Apache < 2.4
>     Order allow,deny
>     Allow from all
>   </IfModule>
>   # To enable Nagios basic auth on NagVis use the following options
>   # Just uncomment it. Maybe you need to adjust the path to the
>   # Auth user file.
>   #
>   # If you use the NagVis internal auth mechanism based on the web
>   # for you won't need this.
>   #
>   #AuthName "NagVis Access"
>   #AuthType Basic
>   #AuthUserFile /etc/icinga2/etc/htpasswd.users
>   #Require valid-user
>   # With installed and enabled mod_rewrite there are several redirections
>   # available to fix deprecated and/or wrong urls. None of those rules is
>   # mandatory to get NagVis working.
>   <IfModule mod_rewrite.c>
>     RewriteEngine On
>     RewriteBase /nagvis
>     # Use mod_rewrite for old url redirection even if there are php files which
>     # redirect the queries itselfs. In some cases the mod_rewrite redirect
>     # is better than the php redirect.
>     #
>     # Using the php redirect seems to be better in some cases where https/http servers
>     # are mixed. For example in OMD setups where using apache own mode and https in the
>     # frontend and http in the backend apache servers.
>     #
>     # Disabling this redirect by default in the hope that the php direct works better.
>     #RewriteCond %{REQUEST_URI} ^/nagvis(/config\.php|/index\.php|/|)(\?.*|)$
>     #RewriteRule ^(.*)$ /nagvis/frontend/nagvis-js/%1%2 [R=301,L]
>     # Redirect old regular map links
>     RewriteCond %{REQUEST_URI} ^/nagvis/frontend/(wui|nagvis-js)
>     RewriteCond %{QUERY_STRING} map=(.*)
>     RewriteRule ^(.*)$ /nagvis/frontend/nagvis-js/index.php?mod=Map&act=view&show=%1 [R=301,L]
>     # Without map= param
>  RewriteCond %{REQUEST_URI} ^/nagvis/frontend(/wui)?/?(index.php)?$
>   RewriteRule ^(.*)$ /nagvis/frontend/nagvis-js/index.php [R=301,L]
> #Redirect old rotation calls
> RewriteCond %{REQUEST_URI} ^/nagvis/frontend/nagvis-js
> RewriteCond %{QUERY_STRING} !mod
> RewriteCond %{QUERY_STRING} rotation=(.*)
>  RewriteRule ^(.*)$ /nagvis/frontend/nagvis-js/index.php?mod=Rotation&act=view&show=%1 [R=301,L]
> </IfModule>
> </Directory>

I think you’ve created a collision here.

  • /icingaweb2/<modulename> is the default entry endpoint for routing requests

You’ve changed that to

  • /<modulename>.

In your example, Icinga Web 2 runs on / and expects the NagVis module being routed to /nagvis from inside Icinga Web 2.

Apache comes first, and routes /nagvis to the addon instead. This results in a 404 as this route is not known by the addon.

In order to avoid that collision, I suggest to rename the NagVis setup path in your Apache configuration to “/nagvis-addon” or similar, and adopt the entry path in the corresponding Icinga Web 2 module configuration.

Thanks, I’ll have a look.


Well, I think you’re right. When I’ve changed icingaweb url to / it started to look for nagvis module at nagvis url.
So I moved nagvis into /nagvis-sys. That made nagvis unavailable.
I found this in nagvis.ini.php:
I’ve changed path to /nagvis-sys

Nagvis started to work again and available at /nagvis-sys

But in icingaweb when trying to open nagvis map I’m getting this output:


Fatal error: Uncaught ErrorException: Undefined variable: messages in zend.view:///usr/share/icingaweb2/application/views/scripts/error/error.phtml:15 Stack trace: #0 zend.view:///usr/share/icingaweb2/application/views/scripts/error/error.phtml(15): Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(8, 'Undefined varia...', 'zend.view:///us...', 15, Array) #1 /usr/share/php/Icinga/Web/View.php(270): include('zend.view:///us...') #2 /usr/share/icingaweb2/library/vendor/Zend/View/Abstract.php(877): Icinga\Web\View->_run('/usr/share/icin...') #3 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(904): Zend_View_Abstract->render(NULL) #4 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(925): Zend_Controller_Action_Helper_ViewRenderer->renderScript('error/error.pht...', NULL) #5 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action/Helper/ViewRenderer.php(964): Zend_Controller_Action_Helper_ViewRenderer->render() #6 /usr/share/icingawe in /usr/share/icingaweb2/library/vendor/Zend/Controller/Plugin/Broker.php on line 332

I thought I may have to specify new nagvis location somewhere in module config. But I did not found anything like this in the configuration.php

You’re right, the error you’ve got masked the 404 not found error that actually occurred. (Known and fixed issue in the latest master)

The file configuration.php is actually nothing that should be edited by an user. There are usually INI files located under /etc/icingaweb2/modules/<module-name>/. These may also be adjusted by a module’s configuration form in the UI located where you’ve initially enabled the module: /icingaweb2/config/modules

Or you take simply a look at the documentation :smiley: :

1 Like

Well, I didn’t change anything in configuration.php.

/etc/icingaweb2/modules/nagvis/config.ini has not much to look at:

default-map = City
# Map ID = Alias
city = City

And I see no options in web interface except enabling/disabling the module.

Maybe, I should re-install nagvis and nagvis module and try again.

Just took a look into the source and noticed that the nagvis location is pulled from a option called baseurl in section global.

Try this:

baseurl = /nagvis-sys

It’s of course not mentioned in the documentation, would be nice if you’d create an issue over there at github, if it works.

1 Like

Now Nagvis returns Error:
Unknown value baseurl used in section global in main configuration file.

Icingaweb integration still doesn’t work

Summarize this I see 2 options here:

  1. I made mistakes in the configs somehow in the process of investigation. Then it probably would be easier if I just re-install nagvis and nagvis module to start again from clean install.
  2. The Nagvis module by default doesnt support set ups where nagvis sits in URL different from “/nagvis”. Then it requires some modifications of module configuration.

Did you put that into the module’s configuration file? Doesn’t seem like a error Icinga Web 2 would produce. :thinking: Sorry if that wasn’t clear enough. My suggestion above needs to go into /etc/icingaweb2/modules/nagvis/config.ini

1 Like

nagvis.ini.php has a global section, too, but this time the Icinga2 configuration file is meant.

Finally, it works!

Yep, I did put this in the global section of nagvis config.
Now I’ placed baseurl = /nagvis-sys in the module config.

Well, it’s as simple as not obvious. I think I must find some time to ask module developers to include corresponding comment into module config file and also include this into readme.

PS After all of this started working well, I was not able to open object’s page in icingaweb2 when click on this object on the map. After all, it was easy to figure out. In the nagvis.ini.php under [paths] section htmlcgi path must contain FQDN as icingaweb placed int the root directory. In my case htmlcgi=“

My big thanks to all of you!

Hello there, i meet same problem.

I’ve read all above but still can’t fix this. Can you clearly tell me how to fix this problem?

Meaning you moved your files to the root directory?
Please take the time to open a new thread and explain what you did and which problem occurs.

Wolfgang, yes. Just moved it out from root and all works fine now.