Page 1 of 1

AutoDiscovery fails to complete

Posted: Wed Apr 22, 2020 1:08 pm
by rseiwert
When running Autodiscovery the jobs never reach completion.
Nagios XI 5.6.7
Config Wiz ver. 1.4.2 up to date
Core Component 2.2.6
nmap.x86_64 6.47

When I look at the out file in /usr/local/nagiosxi/html/includes/components/autodiscovery/jobs/ I see
sudo: no tty present and no askpass program specified

Attempting to discover one host. Running nmap manually for the host works.

Re: AutoDiscovery fails to complete

Posted: Wed Apr 22, 2020 1:40 pm
by jbrunkow
Have you elevated the user doing the autodiscovery jobs to sudoer? It sounds like this could likely be a permissions issue.

It looks like other people have found that this error is resolved for them by commenting out the requiretty line in the /etc/sudoers file. You may want to try that as well. I believe you could also change the permissions with visudo, depending on which operating system you are using.

Re: AutoDiscovery fails to complete

Posted: Wed Apr 22, 2020 4:59 pm
by rseiwert
It looks like the user running the sudo job is apache. I'm wondering if it's a good idea to allow apache to sudo.

Apr 22 17:53:34 nagios sudo: pam_unix(sudo:auth): auth could not identify password for [apache]
Apr 22 17:53:34 nagios sudo: apache : command not allowed ; TTY=unknown ; PWD=/usr/local/nagiosxi/html/includes/components/autodi
scovery ; USER=root ; COMMAND=/usr/bin/php /usr/local/nagiosxi/scripts/components/autodiscover_new.php --addresses=132.157.1.0/24 -
-exclude= --output=/usr/local/nagiosxi/html/includes/components/autodiscovery/jobs/GX7bH8.xml --watch=/usr/local/nagiosxi/html/incl
udes/components/autodiscovery/jobs/GX7bH8.watch --onlynew=0 --debug=1 --detectos=1 --detecttopo=1 on

Re: AutoDiscovery fails to complete

Posted: Wed Apr 22, 2020 5:17 pm
by rseiwert
FYI, I did have requiretty commented out already.

using visudo I see

User_Alias NAGIOSXIWEB=apache
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/html/includes/components/autodiscovery/scripts/autodiscover_new.php *

Looks OK but it Took me a min to realize that is was executing something different.

/usr/bin/php /usr/local/nagiosxi/scripts/components/autodiscover_new.php
Added that to sudoers and it seems to work now

Re: AutoDiscovery fails to complete

Posted: Thu Apr 23, 2020 2:45 pm
by jbrunkow
Excellent! I'm glad to hear that it is working for you now.

Is it okay if we close this topic now?