Nagios xi Reports

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
J.A.K
Posts: 103
Joined: Wed Aug 05, 2020 11:39 am

Nagios xi Reports

Post by J.A.K »

We've got about 300 hosts and 900 service checks. Anytime I try and generate any report the Nagios Webpage will hang for all users and timeout. I followed the instructions here:

https://support.nagios.com/kb/article.php?id=611

As well as added:

Timeout 600
ProxyTimeout 600

To my httpd.conf file. With the increased timeout some reports will run, but should it take 10+ minutes just to generate an SLA report?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios xi Reports

Post by ssax »

Edit your /etc/php.ini and set these (if they aren't already increased):

Code: Select all

max_execution_time = 300
memory_limit = 1024M
Then restart apache and try again:

Code: Select all

service httpd restart
How large of a report are you running? (meaning how many hosts? how large is the time period?)

Please PM me a copy of your profile, you can download it from Admin > System Profile by clicking the Download Profile button.

Include the output of these commands:

Code: Select all

ls -lh /usr/local/nagios/var/nagios.log
ls -lh /usr/local/nagios/var/archives
J.A.K
Posts: 103
Joined: Wed Aug 05, 2020 11:39 am

Re: Nagios xi Reports

Post by J.A.K »

Yep those PHP settings were what I modified from the optimization page. A little over 300 hosts at the moment and just 24 hours. PM is on its way.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios xi Reports

Post by ssax »

Do the reports work if you only select a single host for 24 hours? If so, then next steps may not be needed, I'm not sure why your group is different on them.

The permissions are off, run these commands and test again:

Code: Select all

chown nagios.nagios /usr/local/nagios/var/nagios.log
chown -R nagios.nagios /usr/local/nagios/var/archives
Please send the logs from this directory:

Code: Select all

/var/log/php-fpm/
Try restarting php-fpm as well to see if that will pick up your changes:

Code: Select all

systemctl restart php-fpm
Attach these files as well:

Code: Select all

/etc/php-fpm.conf
/etc/php-fpm.d/www.conf
J.A.K
Posts: 103
Joined: Wed Aug 05, 2020 11:39 am

Re: Nagios xi Reports

Post by J.A.K »

A singular host comes back immediately with no issue. If I limit it to one hostgroup depending on the report it will work, but usually hang for about 6 minutes. Made the changes and tried all hosts for 24 hours and still timed out. PM'ed you the logs
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios xi Reports

Post by ssax »

Try editing your /etc/httpd/conf.d/php.conf and change this:

Code: Select all

#
# Redirect to local php-fpm (no mod_php in default configuration)
#
<IfModule !mod_php5.c>
  <IfModule !mod_php7.c>
    # Enable http authorization headers
    SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1

    <FilesMatch \.(php|phar)$>
        SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
    </FilesMatch>
  </IfModule>
</IfModule>

To this:

Code: Select all

#
# Redirect to local php-fpm (no mod_php in default configuration)
#
<IfModule !mod_php5.c>
  <IfModule !mod_php7.c>
    # Enable http authorization headers
    SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1

    <FilesMatch \.(php|phar)$>
        SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
        ProxySet timeout=600
    </FilesMatch>
  </IfModule>
</IfModule>
Then restart httpd/php-fpm:

Code: Select all

systemctl httpd restart
systemctl php-fpm restart
Then test, you may want to increase your

Code: Select all

/etc/php.ini
max_execution_time to something like 3600 for testing.
J.A.K
Posts: 103
Joined: Wed Aug 05, 2020 11:39 am

Re: Nagios xi Reports

Post by J.A.K »

Adding the ProxySet causes the service to fail to start

Nov 07 15:38:22 vml1038 systemd[1]: Starting The Apache HTTP Server...
Nov 07 15:38:22 vml1038 httpd[1782544]: AH00526: Syntax error on line 29 of /etc/httpd/conf.d/php.conf:
Nov 07 15:38:22 vml1038 httpd[1782544]: ProxySet can not find 'timeout=600' Worker.
Nov 07 15:38:22 vml1038 systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Nov 07 15:38:22 vml1038 systemd[1]: httpd.service: Failed with result 'exit-code'.
Nov 07 15:38:22 vml1038 systemd[1]: Failed to start The Apache HTTP Server.

I'm guessing this is because the first argument for ProxySet should be a worker or something?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios xi Reports

Post by ssax »

Ok, try changing it from this:

Code: Select all

#
# Redirect to local php-fpm (no mod_php in default configuration)
#
<IfModule !mod_php5.c>
  <IfModule !mod_php7.c>
    # Enable http authorization headers
    SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1

    <FilesMatch \.(php|phar)$>
        SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
        ProxySet timeout=600
    </FilesMatch>
  </IfModule>
</IfModule>
To this:

Code: Select all

#
# Redirect to local php-fpm (no mod_php in default configuration)
#
<IfModule !mod_php5.c>
  <IfModule !mod_php7.c>
    # Enable http authorization headers
    SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1

    Timeout 600
    RequestReadTimeout header=600,minrate=50
    RequestReadTimeout body=600,minrate=50
    <Proxy "unix:/run/php-fpm/www.sock|fcgi://localhost">
        ProxySet timeout=600
    </Proxy>

    <FilesMatch \.(php|phar)$>
        SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
    </FilesMatch>
  </IfModule>
</IfModule>
Then restart apache:

Code: Select all

service httpd restart

Then test again. If it fails again, please create a ticket for this and include a link back to this forum thread so we can get a remote session setup:

https://support.nagios.com/tickets/

Thank you!
J.A.K
Posts: 103
Joined: Wed Aug 05, 2020 11:39 am

Re: Nagios xi Reports

Post by J.A.K »

Yeah that does seem to solve the issue. Not only does the webpage no longer lock up it also finishes in less than a minute or so.

So it was just timing out? How did increasing the timeout give a quicker return?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios xi Reports

Post by ssax »

I don't think they are likely related, I can't think of a reason increasing the timeout would make it go faster, maybe the load is less on the system now that when you ran it before?