Page 1 of 1

Grafana Integration with Nagios

Posted: Sat May 18, 2019 3:45 am
by Fred Kroeger
I'm evaluating Grafana integration with the latest version of NagiosXI on a CentOS7 VM. This is also where I have installed Grafana.
I've followed the KB Article "nagios-xi-using-grafana-with-existing-performance-data-805" .
I can install the Grafana Server OK and can connect to the console on port 3000.
I run into problems installing the PNP components. They all seem to install OK. I can't however get past the "Grant localhost permission to PNP Nagios" part. After I modify the pnp4nagios.conf file as per the article, I keep getting the following message when I run the curl http://localhost/pnp4nagios command :

Code: Select all

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /pnp4nagios
on this server.</p>
</body></html>
I've even tried to configure pnp4nagios with the following options - "--with-nagios-user=nagios" & "--with-nagios-group=nagios"

Contents of the /etc/httpd/conf.d/pnp4nagios.conf file :

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
        Require ip 127.0.0.1 ::1
        #
        # 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>

Also another issue is that the KB article shows different Grafana Screens for configuration compared to the version I have installed - (Grafana v5.4.2)
Specifically when I try to create a PNP datasource, the KB article shows to select "Access = proxy" In my Grafana version, there are only 2 options I can select for access - " Server (default) & Browser"

Any ideas on how I can progress this installation?

thanks... Fred

Re: Grafana Integration with Nagios

Posted: Mon May 20, 2019 2:06 pm
by cdienger
A small typo needs to be corrected in the pnp4nagios.conf:

Code: Select all

 Require ip 127.0.0.1 ::1
to:

Code: Select all

Allow from 127.0.0.1 ::1
and then restart the httpd service.

I see the same discrency between the GUI and what the KB shows for adding the PNP source. I'll look into getting our KB updated, but using the default option seems to work.

Re: Grafana Integration with Nagios

Posted: Mon May 20, 2019 7:08 pm
by Box293
I've updated the KB article:

https://support.nagios.com/kb/article/n ... a-805.html

Specifically there were some Apache changes for EL7 that require the Order allow,deny to be commented out and the Require all granted line to be added. The existing Require ip 127.0.0.1 ::1 is correct.

Here is my working config of /etc/httpd/conf.d/pnp4nagios.conf:

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
        Require ip 127.0.0.1 ::1
        #
        # Use the same value as defined in nagios.conf
        #
        AuthName "Nagios Access"
        #AuthType Basic
        #AuthUserFile /usr/local/nagios/etc/htpasswd.users
        #Require valid-user
        Require all granted
        <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>

Re: Grafana Integration with Nagios

Posted: Tue May 21, 2019 12:01 am
by Fred Kroeger
Yay - thanks Troy
Yes I figured out that I needed to change to Require IP but it was the other two changes that I missed for EL7
1) to comment out the Order line
2) Add Require all granted

With those changes it now works as expected. Thanks for updating the KB article.

Regrads... Fred

Re: Grafana Integration with Nagios

Posted: Tue May 21, 2019 9:26 am
by scottwilkerson
Fred Kroeger wrote:Yay - thanks Troy
Yes I figured out that I needed to change to Require IP but it was the other two changes that I missed for EL7
1) to comment out the Order line
2) Add Require all granted

With those changes it now works as expected. Thanks for updating the KB article.

Regrads... Fred
Great!

Glad to hear it's working

Locking thread