I want a script to kick off "Apply Configuration" so I can make changes or updates and some time in the early morning have the configurations updated automatically. I have looked at /usr/local/nagiosxi/scripts/reconfigure_nagios.sh, but I am encountering a number of problems with it. Is there a more reliable script or way to do it?
The main error I get is "HTTP request sent, awaiting response... 500 Internal Server Error". I have already extended the php execute time, but it still fails often enough to not be reliable.
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 120
; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time = 120
Hello, @chicjo01. In XI web interface go to the Help section, then under API docs click on System Reference. You can copy the POST system/applyconfig CURL command and use it. However, I think that pretty much everything uses the ./reconfigure_nagios script, and if yours errors out with HTTP 500 error, then I'd like to seee the apache error log:
curl -XPOST -k "https://<Nagios Server>/nagiosxi/api/v1/system/applyconfig?apikey=<API Key>"
{"success":"Apply config command has been sent to the backend."}
Below is what I get from the error log when I executed the curl.
[Wed Feb 21 15:53:45.790031 2018] [:error] [pid 46236] [client X.X.X.X:54190] PHP Notice: Array to string conversion in /usr/local/nagiosxi/html/includes/components/graphexplorer/templates/multistack.inc.php on line 464, referer: https://alpnagios.risk.regn.net/nagiosx ... ain.php?&=
[Wed Feb 21 15:53:45.790127 2018] [:error] [pid 46236] [client X.X.X.X:54190] PHP Notice: Array to string conversion in /usr/local/nagiosxi/html/includes/components/graphexplorer/templates/multistack.inc.php on line 601, referer: https://alpnagios.risk.regn.net/nagiosx ... ain.php?&=
[Wed Feb 21 15:53:45.851471 2018] [:error] [pid 48209] [client X.X.X.X:54191] PHP Notice: Array to string conversion in /usr/local/nagiosxi/html/includes/components/graphexplorer/templates/multistack.inc.php on line 464, referer: https://alpnagios.risk.regn.net/nagiosx ... ain.php?&=
[Wed Feb 21 15:53:45.851603 2018] [:error] [pid 48209] [client X.X.X.X:54191] PHP Notice: Array to string conversion in /usr/local/nagiosxi/html/includes/components/graphexplorer/templates/multistack.inc.php on line 601, referer: https://alpnagios.risk.regn.net/nagiosx ... ain.php?&=
[Wed Feb 21 15:54:06.883264 2018] [:error] [pid 63347] [client X.X.X.X:54092] PHP Fatal error: Maximum execution time of 120 seconds exceeded in /usr/local/nagiosxi/html/includes/utils.inc.php on line 1294, referer: https://alpnagios.risk.regn.net/nagiosx ... le=summary
@chicjo01, Can you run the repair_databases.sh script from /usr/local/nagiosxi/scripts/ folder?
Have you made any changes to the XI frontend files recently?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
What is the point of running the script, when I am trying to find information if there is a better way to write out the configuration files through a script?
I think that pretty much everything uses the ./reconfigure_nagios script
Based on the output you provided earlier it looks like you have errors that prevent the configuration script from running. We should work on fixing the current issues and you'll be able to trigger the script however you want.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.