Auto-Discovery stuck on Waiting

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jimdurr
Posts: 11
Joined: Thu Jul 25, 2013 7:11 am

Auto-Discovery stuck on Waiting

Post 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?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Auto-Discovery stuck on Waiting

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
jimdurr
Posts: 11
Joined: Thu Jul 25, 2013 7:11 am

Re: Auto-Discovery stuck on Waiting

Post by jimdurr »

That was exactly it! Auto-discovery jobs are running, and completing in a timely fashion now. Thanks.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Auto-Discovery stuck on Waiting

Post 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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
jimdurr
Posts: 11
Joined: Thu Jul 25, 2013 7:11 am

Re: Auto-Discovery stuck on Waiting

Post by jimdurr »

Absolutely! Thanks again.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Auto-Discovery stuck on Waiting

Post by lmiltchev »

Sure, no problem.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked