Page 1 of 2

Autodiscovery Issue

Posted: Thu May 05, 2016 3:28 pm
by haile711
Hey guys,

I have added an autodiscovery for one IP, the job keep spinning and never completes and when I check the error_log i got the following msg

Code: Select all

[Thu May 05 16:20:59 2016] [error] [client 11.248.18.84] PHP Notice:  Undefined variable: scan_delay in /usr/local/nagiosxi/html/includes/components/autodiscovery/autodiscovery.inc.php on line 189, referer: http://esu4v187/nagiosxi//includes/components/autodiscovery/?mode=newjob

Re: Autodiscovery Issue

Posted: Thu May 05, 2016 3:37 pm
by tgriep
What version of Nagios XI are you running?
Can you login to the XI server as root, run the following command and post the output?

Code: Select all

ls -lR /usr/local/nagiosxi/html/includes/components/autodiscovery/

Re: Autodiscovery Issue

Posted: Thu May 05, 2016 3:54 pm
by haile711
hey tgriep,

thanks for the fast respond

Here is the output from the command

Code: Select all

ls -lR /usr/local/nagiosxi/html/includes/components/autodiscovery/
/usr/local/nagiosxi/html/includes/components/autodiscovery/:
total 84
-rwxr-xr-x 1 apache nagios 12639 May  5 16:19 autodiscovery.inc.php
-rwxr-xr-x 1 apache nagios  1983 May  5 16:08 CHANGES.TXT
drwxr-xr-x 2 apache nagios  4096 Nov 11 15:08 images
-rwxr-xr-x 1 apache nagios 39190 May  5 16:19 index.php
-rw-r--r-- 1 apache nagios     0 May  5 16:20 installed
-rwxr-xr-x 1 apache nagios   420 May  5 16:19 install.sh
drwxrwsr-x 2 apache nagios  4096 May  5 16:20 jobs
-rwxr-xr-x 1 apache nagios  1381 May  5 16:19 sanity.sh
drwxr-xr-x 2 apache nagios  4096 Nov 11 15:08 scripts
-rwxr-xr-x 1 apache nagios     0 May  5 15:41 setup.done
-rwxr-xr-x 1 apache nagios   340 May  5 16:19 setup.sh

/usr/local/nagiosxi/html/includes/components/autodiscovery/images:
total 36
-rwxr-xr-x 1 apache nagios  2318 Nov 11 15:08 autodiscovery1.png
-rwxr-xr-x 1 apache nagios  2333 Nov 11 15:08 autodiscovery2.png
-rwxr-xr-x 1 apache nagios  1703 Nov 11 15:08 autodiscovery3.png
-rwxr-xr-x 1 apache nagios  2349 Nov 11 15:08 autodiscovery4.png
-rwxr-xr-x 1 apache nagios 20048 Apr  8 14:57 autodiscovery.png

/usr/local/nagiosxi/html/includes/components/autodiscovery/jobs:
total 4
-rw-r--r-- 1 apache nagios 405 May  5 16:21 qh4ots.out
-rw-r--r-- 1 apache nagios   0 May  5 16:20 qh4ots.watch

/usr/local/nagiosxi/html/includes/components/autodiscovery/scripts:
total 156
-rwxr-xr-x 1 apache nagios 144596 Apr  8 14:57 autodiscover_new.php
-rwxr-xr-x 1 apache nagios    140 Apr  8 14:57 run_fping
-rwxr-xr-x 1 apache nagios     81 Apr  8 14:57 run_traceroute.php
I have version 5.2.7

Re: Autodiscovery Issue

Posted: Thu May 05, 2016 4:50 pm
by tgriep
Can you post this file so we can review it?

Code: Select all

/usr/local/nagiosxi/html/includes/components/autodiscovery/jobs/qh4ots.out

Re: Autodiscovery Issue

Posted: Fri May 06, 2016 7:58 am
by haile711
tgriep,

everytime I add a new discovery job i got a different file, that file is no longer, but the content are the same in every files. Below is the content of a new file

Code: Select all

cat ivvis0.out

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

sudo: no tty present and no askpass program specified
1516.3 PAM failed to authenticate [Authentication failure]
Request rejected by Privilege Manager
Thanks

Re: Autodiscovery Issue

Posted: Fri May 06, 2016 8:52 am
by lmiltchev
Can you run the following commands and show the output?

Code: Select all

ls /etc/sudoers.d
sudo -U nagios -l
grep -i "requiretty\|nagiosxi" /etc/sudoers
Are you by chance using LDAP sudoers?

Re: Autodiscovery Issue

Posted: Fri May 06, 2016 9:41 am
by vy3734
Defaults:nagios !requiretty
Defaults:apache !requiretty
User_Alias NAGIOSXI=nagios
User_Alias NAGIOSXIWEB=apache
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/nagios checkconfig
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/ndo2db status
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd start
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd stop
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd restart
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd reload
NAGIOSXI ALL = NOPASSWD:/etc/init.d/npcd status
NAGIOSXI ALL = NOPASSWD:/usr/bin/nmap *
NAGIOSXI ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/html/includes/components/autodiscovery/scripts/autodiscover_new.php *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/html/includes/components/profile/getprofile.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/upgrade_to_latest.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/change_timezone.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/reset_config_perms.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/messages
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/httpd/error_log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/mysqld.log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/nmap *
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/html/includes/components/autodiscovery/scripts/autodiscover_new.php *
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/html/includes/components/profile/getprofile.sh
NAGIOSXIWEB ALL = NOPASSWD:/etc/init.d/snmptt restart
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/repair_databases.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *

NOT using ldap sudoer

Re: Autodiscovery Issue

Posted: Fri May 06, 2016 11:00 am
by rkennedy
It looks like there is still some permission issue going on. For the record, the nmap will run as root if you're using the 'OS Detection' setting. If you turn that off, do you see a different result?

Code: Select all

root     27863 27692 18 10:38 ?        00:00:00 /usr/bin/nmap -O -oX /usr/local/nagiosxi/tmp/nmapmXiSnk -F --min-parallelism 20
What is the output of find /usr/local/nagiosxi/html/includes/components/autodiscovery -name *install*? Do you know what version you initially started XI with?

Re: Autodiscovery Issue

Posted: Fri May 06, 2016 11:17 am
by tgriep
Is the following line in the /etc/sudoers file?

Code: Select all

root    ALL=(ALL)       ALL
If not, can you add it and see if that resolves the issue.

Re: Autodiscovery Issue

Posted: Fri May 06, 2016 12:48 pm
by vy3734
yes, root ALL=(ALL) ALL is in /etc/sudoers file.

[root@******* jobs]# find /usr/local/nagiosxi/html/includes/components/autodiscovery -name *install*
/usr/local/nagiosxi/html/includes/components/autodiscovery/install.sh
/usr/local/nagiosxi/html/includes/components/autodiscovery/installed

- Turning OS detection off still having same error.

- FYI: i'm able to run nmap command as ROOT or NAGIOS user on the box just fine. Just doesn't work through nagiosxi.