Page 1 of 1

Auto-Discovery stuck on Waiting

Posted: Wed Jun 05, 2019 10:06 am
by jimdurr
I just ran an auto-discovery wizard, but I'm just getting Waiting for the status and have been for at least 15 minutes. It looks like the last time it worked was May 3rd, I have a Finished status from a job I ran then . I checked /var/log/httpd/error_log and I'm seeing this kind of error:

[Wed Jun 05 10:51:13 2019] [error] [client xxx.xxx.xxx.xxx] PHP Warning: Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/components/nagiosim/nagiosim.inc.php on line 491, referer: http://monitor.testing.edu/nagiosxi/inc ... discovery/

Checking the nagiosim.inc.php file for line 491 shows me this:

function nagiosim_db_init($im_current_version)
{
global $cfg;

if ($cfg['db_info']['nagiosxi']['dbtype'] == 'pgsql') {
$sql = "SELECT COUNT(relname) FROM pg_class WHERE relname = 'xi_incidents'";
$rs = exec_sql_query(DB_NAGIOSXI, $sql, true);

foreach ($rs as $row) {
if ($row['count'] == 0) {

// Create sequence
$sql = "
CREATE SEQUENCE xi_incidents_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1";
exec_sql_query(DB_NAGIOSXI, $sql, true);

Specifically the "foreach ($rs as $row) {" line

I've never changed anything with that file, but I have done two upgrades since the last successful auto-discovery, one to 5.6.1 and one to 5.6.2. Anyone else running in to any trouble?

Re: Auto-Discovery stuck on Waiting

Posted: Wed Jun 05, 2019 11:50 am
by lmiltchev
I wonder if there are some permissions issues that are causing the auto-discovery to fail (get "stuck")... Can you run the following command?

Code: Select all

chmod 775 /usr/local/nagiosxi/html/includes/components/autodiscovery/jobs
After this, remove the old auto-discovery jobs, and start a new one. Is it working now?

Re: Auto-Discovery stuck on Waiting

Posted: Wed Jun 05, 2019 12:38 pm
by jimdurr
That was exactly it! Auto-discovery jobs are running, and completing in a timely fashion now. Thanks.

Re: Auto-Discovery stuck on Waiting

Posted: Wed Jun 05, 2019 1:09 pm
by lmiltchev
Great! I am glad I was able to help!

Let us know if it is OK to close this topic and mark it as resolved.

Thank you!

Re: Auto-Discovery stuck on Waiting

Posted: Wed Jun 05, 2019 1:45 pm
by jimdurr
Absolutely! Thanks again.

Re: Auto-Discovery stuck on Waiting

Posted: Wed Jun 05, 2019 2:07 pm
by lmiltchev
Sure, no problem.