php4nagios doesn't work on fresh install

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
davide.bonicelli
Posts: 134
Joined: Thu Feb 13, 2014 5:12 am

php4nagios doesn't work on fresh install

Post by davide.bonicelli »

hi, i've just tried to install php4nagios on a new nagios installation on a centos 7 x64.
i followed the official guide
https://support.nagios.com/kb/article/n ... nd_Config)
but i stuck at the check of the page http://nagios_server/pnp4nagios/ that resolv in a not found page (of course i changed nagios_server with the correct ip)
any idea on this?
i don't see nothing in logs...
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: php4nagios doesn't work on fresh install

Post by tgriep »

Go to the /var/log/httpd folder and look at the error_log file or if you enabled SSL the ssl_error_log file while you are trying to access the pnp4nagios link.
If you find any errors, post them here.

Can you get the Apache config file for PNP4Nagios and post it here?

Code: Select all

/etc/httpd/conf.d/pnp4nagios.conf
Thanks
Be sure to check out our Knowledgebase for helpful articles and solutions!
davide.bonicelli
Posts: 134
Joined: Thu Feb 13, 2014 5:12 am

Re: php4nagios doesn't work on fresh install

Post by davide.bonicelli »

Hi Tom, in i see only this in the error_log when i try to reach the webpage:

172.16.17.82 - - [27/Dec/2018:13:33:33 +0100] "GET /php4nagios HTTP/1.1" 404 208 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko"

the conf is this:

Code: Select all

# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER

Alias /pnp4nagios "/usr/local/pnp4nagios/share"

<Directory "/usr/local/pnp4nagios/share">
        AllowOverride None
        Order allow,deny
        Allow from all
        #
        # Use the same value as defined in nagios.conf
        #
        AuthName "Nagios Access"
        AuthType Basic
        AuthUserFile /usr/local/nagios/etc/htpasswd.users
        Require valid-user
        <IfModule mod_rewrite.c>
                # Turn on URL rewriting
                RewriteEngine On
                Options symLinksIfOwnerMatch
                # Installation directory
                RewriteBase /pnp4nagios/
                # Protect application and system files from being viewed
                RewriteRule "^(?:application|modules|system)/" - [F]
                # Allow any files or directories that exist to be displayed directly
                RewriteCond "%{REQUEST_FILENAME}" !-f
                RewriteCond "%{REQUEST_FILENAME}" !-d
                # Rewrite all other URLs to index.php/URL
                RewriteRule "^.*$" "index.php/$0" [PT]
        </IfModule>
</Directory>
Thanks
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: php4nagios doesn't work on fresh install

Post by tgriep »

The config file looks stock but thanks for posting it.

Here is a couple of things to look for.
When you access the pnp4nagios URL, it is accessing the following folder.
Check it to see if the permissions are set so the nagios user and and the nagcmd group can read it.

Code: Select all

/usr/local/pnp4nagios/share
When you go to the GUI, does it prompt for a username and password?
If not, check the /usr/local/nagios/etc/htpasswd.users file to see if there is an account created in it.

Also, there are some steps you can do to troubleshoot this on the PNP4Nagios web site.
https://docs.pnp4nagios.org/pnp-0.6/verify
Be sure to check out our Knowledgebase for helpful articles and solutions!
davide.bonicelli
Posts: 134
Joined: Thu Feb 13, 2014 5:12 am

Re: php4nagios doesn't work on fresh install

Post by davide.bonicelli »

Thanks Tom, the permissions look good for me..

Code: Select all

ls -la /usr/local/pnp4nagios/share
totale 20
drwxr-xr-x  8 nagios nagios  155 21 dic 11.22 .
drwxr-xr-x  9 root   root     89 21 dic 11.06 ..
drwxr-xr-x 12 nagios nagios  144 21 dic 11.06 application
drwxr-xr-x  6 nagios nagios   60 21 dic 11.06 documents
-rw-r--r--  1 nagios nagios 4785 21 dic 11.22 index.php
-rw-r--r--  1 nagios nagios 7310 21 dic 11.22 install.php
drwxr-xr-x  5 nagios nagios   41 21 dic 11.06 media
drwxr-xr-x  2 nagios nagios    6 21 dic 11.06 templates
drwxr-xr-x  2 nagios nagios 4096 21 dic 11.22 templates.dist
drwxr-xr-x  2 nagios nagios  100 21 dic 11.22 templates.special
No user and pw asked when i go to the gui homepage..only 404
in htpasswd i see only nagiosadmin..is it correct?

in the link you send me i didn't found anything useful for my problem..
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: php4nagios doesn't work on fresh install

Post by tgriep »

If you did not add any other users to the htpasswd file, then the nagiosadmin user should be in there.

Lets try and reinstall pnp4nagios but specify the user and group in the configure command.
Go to the folder that you downloaded pnp4nagios and run the following commands as root to reinstall it.

Code: Select all

./configure --with-nagios-user=nagios --with-nagios-group=nagios
make all
make install
make install-webconf
make install-config
make install-init
service httpd restart
Then see if you can login.


If it fails, try stopping the firewall of the system if it is enabled.

Try running the install script to see if that opens in the browser.

Code: Select all

http://nagios_server/pnp4nagios/install.php
Other than that, there has to be more information in the Apache Error logs on why it is not running.
Be sure to check out our Knowledgebase for helpful articles and solutions!
davide.bonicelli
Posts: 134
Joined: Thu Feb 13, 2014 5:12 am

Re: php4nagios doesn't work on fresh install

Post by davide.bonicelli »

Thanks Tom, as usually you solved my problem : )
the

Code: Select all

configure --with-nagios-user=nagios --with-nagios-group=nagios
did the trick
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: php4nagios doesn't work on fresh install

Post by tgriep »

Your Welcome. Glad it worked.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked