Page 1 of 2
Nagios XI Reports
Posted: Wed Nov 04, 2020 10:35 am
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?
Re: Nagios XI Reports
Posted: Wed Nov 04, 2020 6:51 pm
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:
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
Re: Nagios XI Reports
Posted: Thu Nov 05, 2020 11:04 am
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.
Re: Nagios XI Reports
Posted: Thu Nov 05, 2020 7:34 pm
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:
Try restarting php-fpm as well to see if that will pick up your changes:
Attach these files as well:
Code: Select all
/etc/php-fpm.conf
/etc/php-fpm.d/www.conf
Re: Nagios XI Reports
Posted: Fri Nov 06, 2020 8:48 am
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
Re: Nagios XI Reports
Posted: Fri Nov 06, 2020 5:33 pm
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
max_execution_time to something like 3600 for testing.
Re: Nagios XI Reports
Posted: Sat Nov 07, 2020 3:47 pm
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?
Re: Nagios XI Reports
Posted: Mon Nov 09, 2020 5:06 pm
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:
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!
Re: Nagios XI Reports
Posted: Wed Nov 11, 2020 1:07 pm
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?
Re: Nagios XI Reports
Posted: Thu Nov 12, 2020 5:54 pm
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?