Autodiscovery Issue

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
haile711
Posts: 197
Joined: Thu May 28, 2015 7:36 am

Autodiscovery Issue

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Autodiscovery Issue

Post 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/
Be sure to check out our Knowledgebase for helpful articles and solutions!
haile711
Posts: 197
Joined: Thu May 28, 2015 7:36 am

Re: Autodiscovery Issue

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Autodiscovery Issue

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
haile711
Posts: 197
Joined: Thu May 28, 2015 7:36 am

Re: Autodiscovery Issue

Post 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
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Autodiscovery Issue

Post 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?
Be sure to check out our Knowledgebase for helpful articles and solutions!
vy3734
Posts: 109
Joined: Tue Sep 29, 2015 4:48 pm

Re: Autodiscovery Issue

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Autodiscovery Issue

Post 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?
Former Nagios Employee
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Autodiscovery Issue

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
vy3734
Posts: 109
Joined: Tue Sep 29, 2015 4:48 pm

Re: Autodiscovery Issue

Post 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.
Locked