Nagvis: The compile directory must be writable, chmod "/usr/local/nagvis/var/tmpl/compile/" to make it writablearray

nagvis
(Diego) #1

Hi,

I’m trying to install NagVis in my Nagios Core but I have some problems. To install Nagvis, I follow the next:

[root@nagios Nagios_Packages_Repository]# cd /tmp/Nagios_Packages_Repository/nagvis-1.9.16
[root@nagios nagvis-1.9.16]# chmod +x install.sh
[root@nagios nagvis-1.9.16]# ./install.sh
[root@nagios nagvis-1.9.16]# ./install.sh
±-----------------------------------------------------------------------------+
| Welcome to NagVis Installer 1.9.16 |
±-----------------------------------------------------------------------------+
| This script is built to facilitate the NagVis installation and update |
| procedure for you. The installer has been tested on the following systems: |
| - Debian, since Etch (4.0) |
| - Ubuntu, since Hardy (8.04) |
| - SuSE Linux Enterprise Server 10 and 11 |
| |
| Similar distributions to the ones mentioned above should work as well. |
| That (hopefully) includes RedHat, Fedora, CentOS, OpenSuSE |
| |
| If you experience any problems using these or other distributions, please |
| report that to the NagVis team. |
±-----------------------------------------------------------------------------+
| Do you want to proceed? [y]:
±-----------------------------------------------------------------------------+
| Starting installation of NagVis 1.9.16 |
±-----------------------------------------------------------------------------+
| |
±-- Checking for tools -------------------------------------------------------+
| Using packet manager /usr/bin/rpm found |
| |
±-- Checking paths -----------------------------------------------------------+
| Please enter the path to the nagios base directory [/usr/local/nagios]:
| nagios path /usr/local/nagios found |
| Please enter the path to NagVis base [/usr/local/nagvis]:
| |
±-- Checking prerequisites ---------------------------------------------------+
| PHP 7.2 found |
| PHP Module: gd php found |
| PHP Module: mbstring php found |
| PHP Module: gettext compiled_in found |
| PHP Module: session compiled_in found |
| PHP Module: xml php found |
| PHP Module: pdo php found |
| Apache mod_php found |
| WARNING: The Graphviz package was not found. |
| This may not be a problem if you installed it from source |
| Graphviz Module dot MISSING |
| Graphviz Module neato MISSING |
| Graphviz Module twopi MISSING |
| Graphviz Module circo MISSING |
| Graphviz Module fdp MISSING |
| WARNING: The SQLite package was not found. |
| This may not be a problem if you installed it from source |
| |
±-- Trying to detect Apache settings -----------------------------------------+
| Please enter the web path to NagVis [/nagvis]:
| Please enter the name of the web-server user [apache]:
| Please enter the name of the web-server group [apache]:
| create Apache config file [y]:
| |
±-- Checking for existing NagVis ---------------------------------------------+
| |
±-----------------------------------------------------------------------------+
| Summary |
±-----------------------------------------------------------------------------+
| NagVis home will be: /usr/local/nagvis |
| Owner of NagVis files will be: apache |
| Group of NagVis files will be: apache |
| Path to Apache config dir is: /etc/httpd/conf.d |
| Apache config will be created: yes |
| |
| Installation mode: install |
| |
| Do you really want to continue? [y]:
±-----------------------------------------------------------------------------+
| Starting installation |
±-----------------------------------------------------------------------------+
| Creating directory /usr/local/nagvis… done |
| Creating directory /usr/local/nagvis/var… done |
| Creating directory /usr/local/nagvis/var/tmpl/cache… done |
| Creating directory /usr/local/nagvis/var/tmpl/compile… done |
| Creating directory /usr/local/nagvis/share/var… done |
| Copying files to /usr/local/nagvis… done |
| Creating directory /usr/local/nagvis/etc/profiles… done |
| Creating main configuration file… done |
| Adding webserver group to file_group… done |
| Creating web configuration file… done |
| Setting permissions for web configuration file… done |
| |
| |
| |
±-- Setting permissions… ---------------------------------------------------+
| /usr/local/nagvis/etc/nagvis.ini.php-sample done |
| /usr/local/nagvis/etc done |
| /usr/local/nagvis/etc/maps done |
| /usr/local/nagvis/etc/maps/* done |
| /usr/local/nagvis/etc/geomap done |
| /usr/local/nagvis/etc/geomap/* done |
| /usr/local/nagvis/etc/profiles done |
| /usr/local/nagvis/share/userfiles/images/maps done |
| /usr/local/nagvis/share/userfiles/images/maps/* done |
| /usr/local/nagvis/share/userfiles/images/shapes done |
| /usr/local/nagvis/share/userfiles/images/shapes/* done |
| /usr/local/nagvis/var done |
| /usr/local/nagvis/var/* done |
| /usr/local/nagvis/var/tmpl done |
| /usr/local/nagvis/var/tmpl/cache done |
| /usr/local/nagvis/var/tmpl/compile done |
| /usr/local/nagvis/share/var done |
| |
±-----------------------------------------------------------------------------+
| Installation complete |
| |
| You can safely remove this source directory. |
| |
| For later update/upgrade you may use this command to have a faster update: |
| ./install.sh -n /usr/local/nagios -p /usr/local/nagvis -u apache -g apache -w /etc/httpd/conf.d -a y
| |
| What to do next? |
| - Read the documentation |
| - Maybe you want to edit the main configuration file? |
| Its location is: /usr/local/nagvis/etc/nagvis.ini.php |
| - Configure NagVis via browser |
| http://localhost/nagvis/config.php |
| - Initial admin credentials: |
| Username: admin |
| Password: admin |
±-----------------------------------------------------------------------------+

After it, I set the correct permissions:
[root@nagios nagvis-1.9.16]# chown apache:apache /usr/local/nagvis -R
[root@nagios nagvis-1.9.16]# chmod 664 /usr/local/nagvis/etc/nagvis.ini.php
[root@nagios nagvis-1.9.16]# chmod 775 /usr/local/nagvis/etc/maps
[root@nagios nagvis-1.9.16]# chmod 664 /usr/local/nagvis/etc/maps/*
[root@nagios nagvis-1.9.16]# chmod 775 /usr/local/nagvis/etc/geomap
[root@nagios nagvis-1.9.16]# chmod 664 /usr/local/nagvis/etc/geomap/*
[root@nagios nagvis-1.9.16]# chmod 775 /usr/local/nagvis/share/userfiles/images/maps
[root@nagios nagvis-1.9.16]# chmod 664 /usr/local/nagvis/share/userfiles/images/maps/*
[root@nagios nagvis-1.9.16]# chmod 775 /usr/local/nagvis/var
[root@nagios nagvis-1.9.16]# chmod 664 /usr/local/nagvis/var/*
[root@nagios nagvis-1.9.16]# chmod 775 /usr/local/nagvis/var/tmpl/cache

I restart nagios and apache service, but when I try to go to nagvis web page, I have the following error:
Error (Dwoo_Exception): The compile directory must be writable, chmod “/usr/local/nagvis/var/tmpl/compile/” to make it writablearray(1) { [0]=> array(2) { [“function”]=> string(15) “nagvisException” [“args”]=> array(1) { [0]=> object(Dwoo_Exception)#19 (7) { [“message”:protected]=> string(103) “The compile directory must be writable, chmod “/usr/local/nagvis/var/tmpl/compile/” to make it writable” [“string”:“Exception”:private]=> string(0) “” [“code”:protected]=> int(0) [“file”:protected]=> string(66) “/usr/local/nagvis/share/frontend/nagvis-js/ext/dwoo-1.1.0/Dwoo.php” [“line”:protected]=> int(686) [“trace”:“Exception”:private]=> array(6) { [0]=> array(6) { [“file”]=> string(66) “/usr/local/nagvis/share/frontend/nagvis-js/ext/dwoo-1.1.0/Dwoo.php” [“line”]=> int(258) [“function”]=> string(13) “setCompileDir” [“class”]=> string(4) “Dwoo” [“type”]=> string(2) “->” [“args”]=> array(1) { [0]=> string(34) “/usr/local/nagvis/var/tmpl/compile” } } [1]=> array(6) { [“file”]=> string(77) “/usr/local/nagvis/share/frontend/nagvis-js/classes/FrontendTemplateSystem.php” [“line”]=> int(37) [“function”]=> string(11) “__construct” [“class”]=> string(4) “Dwoo” [“type”]=> string(2) “->” [“args”]=> array(2) { [0]=> string(34) “/usr/local/nagvis/var/tmpl/compile” [1]=> string(32) “/usr/local/nagvis/var/tmpl/cache” } } [2]=> array(6) { [“file”]=> string(70) “/usr/local/nagvis/share/frontend/nagvis-js/classes/NagVisLoginView.php” [“line”]=> int(41) [“function”]=> string(11) “__construct” [“class”]=> string(22) “FrontendTemplateSystem” [“type”]=> string(2) “->” [“args”]=> array(0) { } } [3]=> array(6) { [“file”]=> string(77) “/usr/local/nagvis/share/frontend/nagvis-js/classes/FrontendModLogonDialog.php” [“line”]=> int(48) [“function”]=> string(5) “parse” [“class”]=> string(15) “NagVisLoginView” [“type”]=> string(2) “->” [“args”]=> array(0) { } } [4]=> array(6) { [“file”]=> string(55) “/usr/local/nagvis/share/server/core/functions/index.php” [“line”]=> int(120) [“function”]=> string(12) “handleAction” [“class”]=> string(22) “FrontendModLogonDialog” [“type”]=> string(2) “->” [“args”]=> array(0) { } } [5]=> array(4) { [“file”]=> string(52) “/usr/local/nagvis/share/frontend/nagvis-js/index.php” [“line”]=> int(53) [“args”]=> array(1) { [0]=> string(55) “/usr/local/nagvis/share/server/core/functions/index.php” } [“function”]=> string(7) “require” } } [“previous”:“Exception”:private]=> NULL } } } }

My linux distribution is CentOs 8. I have disabled SELinux and firewalld service and I have followed the next page to install it:
http://docs.nagvis.org/1.9/en_US/index.html
http://docs.nagvis.org/1.9/en_US/index.html

So, what’s wrong?

Thanks!

(Rui Silva) #2

Hi!
I had the same problem, and I had to disable the SELINUX and reboot.

cat /etc/sysconfig/selinux

This file controls the state of SELinux on the system.

SELINUX= can take one of these three values:

enforcing - SELinux security policy is enforced.

permissive - SELinux prints warnings instead of enforcing.

disabled - No SELinux policy is loaded.

SELINUX=disabled

SELINUXTYPE= can take one of three values:

targeted - Targeted processes are protected,

minimum - Modification of targeted policy. Only selected processes are protected.

mls - Multi Level Security protection.

SELINUXTYPE=targeted

BR,
RS

(Diego) #3

Hi,

I have the same configuration, but it doesn’t work for me.

[root@nagios ~]# cat /etc/sysconfig/selinux

This file controls the state of SELinux on the system.

SELINUX= can take one of these three values:

enforcing - SELinux security policy is enforced.

permissive - SELinux prints warnings instead of enforcing.

disabled - No SELinux policy is loaded.

SELINUX=disabled

SELINUXTYPE= can take one of these three values:

targeted - Targeted processes are protected,

minimum - Modification of targeted policy. Only selected processes are protected.

mls - Multi Level Security protection.

SELINUXTYPE=targeted

Any more ideas?

Thanks!

BR,
DR

#4

Looking at your list the “compile” directory is not mentioned so I’d look at the permissions and fix them (if applicable).

(Diego) #5

Hi,

I have set 777 permissions to /usr/local/nagvis/var/tmpl/compile/ but it doesn’t work. I have the same problem.

Any more ideas?

Thanks!

BR,
DR

#6

Please check which user is owner of the web server processes. This user should be able to access all directories down to /usr/local/nagvis/tmp/compile.

BTW: Why have you set permissions manually? It should’ve been done by the install script…

(Diego) #7

The user that runs apache server is apache, and the owner of this folder is the same (apache).

[root@nagios ~]# ps -fea | grep httpd
root 938 1 0 08:35 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 994 938 0 08:35 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 995 938 0 08:35 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 996 938 0 08:35 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
apache 997 938 0 08:35 ? 00:00:00 /usr/sbin/httpd -DFOREGROUND
root 1607 1565 0 09:17 pts/0 00:00:00 grep --color=auto httpd
[root@nagios ~]# ls -l /usr/local/nagvis/var/tmpl/
total 8
drwxrwxr-x 2 apache apache 4096 Oct 29 15:52 cache
drwxrwxr-x 2 apache apache 4096 Oct 29 15:52 compile

Sorry, I misunderstood you about the folder permissions.

#8

Most actions are via the GUI so the web process must have permissions to several directories below /usr/local/nagvis. Please login as “apache” and check whether you are able to create a temporary file in the “compile” folder. Check if there are any files belonging to other users which can’t be overwritten/replaced/deleted by “apache”.

Pardon?

(Diego) #9

The apache user bash is /sbin/nologin. Is it neccesary to change to other bash?

#10

I don’t know other solutions than altering the shell temporarily.

(Diego) #11

I check with apache user that permission to /usr/local/nagvis/var/tmpl is denied because permissions are 664. I have tried to change this permissions to 764 and I solve the problem, but I don’t know if it is correct or not.

When I solve this problem, I have another one:
Error (Error): Call to undefined function json_encode()array(1) { [0]=> array(2) { [“function”]=> string(15) “nagvisException” [“args”]=> array(1) { [0]=> object(Error)#19 (7) { [“message”:protected]=> string(40) “Call to undefined function json_encode()” [“string”:“Error”:private]=> string(0) “” [“code”:protected]=> int(0) [“file”:protected]=> string(61) “/usr/local/nagvis/share/server/core/classes/GlobalMainCfg.php” [“line”:protected]=> int(2225) [“trace”:“Error”:private]=> array(4) { [0]=> array(6) { [“file”]=> string(70) “/usr/local/nagvis/share/frontend/nagvis-js/classes/NagVisLoginView.php” [“line”]=> int(56) [“function”]=> string(22) “parseGeneralProperties” [“class”]=> string(13) “GlobalMainCfg” [“type”]=> string(2) “->” [“args”]=> array(0) { } } [1]=> array(6) { [“file”]=> string(77) “/usr/local/nagvis/share/frontend/nagvis-js/classes/FrontendModLogonDialog.php” [“line”]=> int(48) [“function”]=> string(5) “parse” [“class”]=> string(15) “NagVisLoginView” [“type”]=> string(2) “->” [“args”]=> array(0) { } } [2]=> array(6) { [“file”]=> string(55) “/usr/local/nagvis/share/server/core/functions/index.php” [“line”]=> int(120) [“function”]=> string(12) “handleAction” [“class”]=> string(22) “FrontendModLogonDialog” [“type”]=> string(2) “->” [“args”]=> array(0) { } } [3]=> array(4) { [“file”]=> string(52) “/usr/local/nagvis/share/frontend/nagvis-js/index.php” [“line”]=> int(53) [“args”]=> array(1) { [0]=> string(55) “/usr/local/nagvis/share/server/core/functions/index.php” } [“function”]=> string(7) “require” } } [“previous”:“Error”:private]=> NULL } } } }

(Diego) #12

I solve the new problem, I’d need to install php-json package.

Thanks for your support!

Best regards,
Diego

#13

That might be a problem when using current distros :-/.

Still the question: Why have you set permissions manually?

(Diego) #14

I don’t know why, I follow NagVis Installer and Installation instructions sections in the http://docs.nagvis.org/1.9/en_US/index.html page.

#15

So I guess it should be clearer to execute “NagVis Installer” OR “Manual Installation”.