Page 1 of 2

Hosts still showing up after "restore_defaults.sh"

Posted: Thu Nov 08, 2018 3:51 am
by MattXI
Hello,

Nagios XI manually installed on RedHat 7

I am trying to clean up a Nagios XI server from all its hosts so I can reconfigure from ground up.
I ran /usr/local/nagiosxi/scripts/restore_defaults.sh and it went okay. Now the CCM only shows "localhost" which is what I want.

Problem is that I still have all my 500+ hosts showing up in Nagios XI dashboard.

If I try to delete a host, I get the following error :
Could not find a unique id for this host
Host cannot be deleted using this method

I have no idea of what's going on here, did I miss something or is my Nagios broken ?
Could you please help me removing all these hosts ?

Regards.

Re: Hosts still showing up after "restore_defaults.sh"

Posted: Thu Nov 08, 2018 8:30 am
by scottwilkerson
This should remove all the old configs

CCM -> Tools -> Config File Management
Delete Files
Write Configs
Verify Files
Restart Nagios Core

Re: Hosts still showing up after "restore_defaults.sh"

Posted: Thu Nov 08, 2018 9:14 am
by MattXI
Thanks for the answer. I did just that and it went fine but my 500+ hosts are still there.

Note that I went to "system status" and the line "Monitoring Engine" has red status : no lock file found in /usr/local/nagios/var/nagios.lock
This file exists on the server and inside there's nagios PID (the process is up and running)

Action -> start on this service says that my request did not process in a timely manner.

I rebooted the server but everything stays the same. Something is wrong but I don't know what it is.

Here's an extract from nagios.log :

Code: Select all

[1541685393] Nagios 4.2.4 starting... (PID=1775)
[1541685393] Local time is Thu Nov 08 14:56:33 CET 2018
[1541685393] LOG VERSION: 2.0
[1541685393] qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
[1541685393] qh: core query handler registered
[1541685393] nerd: Channel hostchecks registered successfully
[1541685393] nerd: Channel servicechecks registered successfully
[1541685393] nerd: Channel opathchecks registered successfully
[1541685393] nerd: Fully initialized and ready to rock!
[1541685393] wproc: Successfully registered manager as @wproc with query handler
[1541685393] wproc: Registry request: name=Core Worker 1780;pid=1780
[1541685393] wproc: Registry request: name=Core Worker 1783;pid=1783
[1541685393] wproc: Registry request: name=Core Worker 1782;pid=1782
[1541685393] wproc: Registry request: name=Core Worker 1781;pid=1781
[1541685393] ndomod: NDOMOD 2.1.2 (11-14-2016) Copyright (c) 2009 Nagios Core Development Team and Community Contributors
[1541685393] ndomod: Could not open data sink!  I'll keep trying, but some output may get lost...
[1541685393] ndomod registered for process data
[1541685393] ndomod registered for log data'
[1541685393] ndomod registered for system command data'
[1541685393] ndomod registered for event handler data'
[1541685393] ndomod registered for notification data'
[1541685393] ndomod registered for comment data'
[1541685393] ndomod registered for downtime data'
[1541685393] ndomod registered for flapping data'
[1541685393] ndomod registered for program status data'
[1541685393] ndomod registered for host status data'
[1541685393] ndomod registered for service status data'
[1541685393] ndomod registered for adaptive program data'
[1541685393] ndomod registered for adaptive host data'
[1541685393] ndomod registered for adaptive service data'
[1541685393] ndomod registered for external command data'
[1541685393] ndomod registered for aggregated status data'
[1541685393] ndomod registered for retention data'
[1541685393] ndomod registered for contact data'
[1541685393] ndomod registered for contact notification data'
[1541685393] ndomod registered for acknowledgement data'
[1541685393] ndomod registered for state change data'
[1541685393] ndomod registered for contact status data'
[1541685393] ndomod registered for adaptive contact data'
[1541685393] Event broker module '/usr/local/nagios/bin/ndomod.o' initialized successfully.
[1541685399] Successfully launched command file worker with pid 2061
[1541686294] ndomod: Still unable to connect to data sink.  1032 items lost, 5000 queued items to flush.

Re: Hosts still showing up after "restore_defaults.sh"

Posted: Thu Nov 08, 2018 9:28 am
by scottwilkerson
Lets run the following

Code: Select all

service nagios stop
service ndo2db stop
killall -9 nagios
rm -f /usr/local/nagios/var/ndo* /usr/local/nagios/var/nagios.lock
service ndo2db start
service nagios start

Re: Hosts still showing up after "restore_defaults.sh"

Posted: Thu Nov 08, 2018 9:43 am
by MattXI
The dashboard looks much better indeed ! Only localhost is displayed there.

For some reason the system status still complains about the lockfile and my nagios commands (force check for example) are still not processed.

Re: Hosts still showing up after "restore_defaults.sh"

Posted: Thu Nov 08, 2018 9:53 am
by scottwilkerson
What is the output of the following commands:

Code: Select all

grep nagios.lock /etc/init.d/nagios
grep nagios.lock /usr/local/nagios/etc/nagios.cfg
ls -al /usr/local/nagios/var/rw/

Re: Hosts still showing up after "restore_defaults.sh"

Posted: Mon Nov 12, 2018 3:12 am
by MattXI
Sorry I was ooo last Friday. Here's the output :

Code: Select all

# grep nagios.lock /etc/init.d/nagios
# pidfile: /usr/local/nagios/var/nagios.lock
NagiosRunFile=${prefix}/var/nagios.lock

# grep nagios.lock /usr/local/nagios/etc/nagios.cfg
lock_file=/usr/local/nagios/var/nagios.lock

# ls -al /usr/local/nagios/var/rw/
total 8
drwsrwsr-x. 2 nagios nagcmd 4096 Nov  8 15:33 .
drwxrwxr-x. 6 nagios nagios 4096 Nov 12 09:10 ..
prw-rw----  1 nagios nagcmd    0 Nov  8 15:33 nagios.cmd
srw-rw----  1 nagios nagcmd    0 Nov  8 15:33 nagios.qh

# cat /usr/local/nagios/var/nagios.lock
8719

Re: Hosts still showing up after "restore_defaults.sh"

Posted: Mon Nov 12, 2018 3:35 pm
by tgriep
Can you run a Nagios verification command and a process commands and post the output to the ticket?
Run these as root.

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ps -ef --cols=300
Also, what version of XI is the server running and can you post the full error message you are receiving?
Thanks

Re: Hosts still showing up after "restore_defaults.sh"

Posted: Wed Nov 14, 2018 2:37 am
by MattXI
Here's the output :

Code: Select all

#     /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.2.4
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 12-07-2016
License: GPL

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
        Checked 14 services.
        Checked 1 hosts.
        Checked 1 host groups.
        Checked 0 service groups.
        Checked 2 contacts.
        Checked 2 contact groups.
        Checked 124 commands.
        Checked 8 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 1 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 8 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check

Code: Select all

#     ps -ef --cols=300
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 Nov08 ?        00:02:04 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
root         2     0  0 Nov08 ?        00:00:00 [kthreadd]
root         3     2  0 Nov08 ?        00:00:00 [ksoftirqd/0]
root         5     2  0 Nov08 ?        00:00:00 [kworker/0:0H]
root         7     2  0 Nov08 ?        00:00:01 [migration/0]
root         8     2  0 Nov08 ?        00:00:00 [rcu_bh]
root         9     2  0 Nov08 ?        00:00:20 [rcu_sched]
root        10     2  0 Nov08 ?        00:00:00 [lru-add-drain]
root        11     2  0 Nov08 ?        00:00:01 [watchdog/0]
root        12     2  0 Nov08 ?        00:00:01 [watchdog/1]
root        13     2  0 Nov08 ?        00:00:01 [migration/1]
root        14     2  0 Nov08 ?        00:00:01 [ksoftirqd/1]
root        16     2  0 Nov08 ?        00:00:00 [kworker/1:0H]
root        18     2  0 Nov08 ?        00:00:00 [kdevtmpfs]
root        19     2  0 Nov08 ?        00:00:00 [netns]
root        20     2  0 Nov08 ?        00:00:00 [khungtaskd]
root        21     2  0 Nov08 ?        00:00:00 [writeback]
root        22     2  0 Nov08 ?        00:00:00 [kintegrityd]
root        23     2  0 Nov08 ?        00:00:00 [bioset]
root        24     2  0 Nov08 ?        00:00:00 [kblockd]
root        25     2  0 Nov08 ?        00:00:00 [md]
root        26     2  0 Nov08 ?        00:00:00 [edac-poller]
root        32     2  0 Nov08 ?        00:00:00 [kswapd0]
root        33     2  0 Nov08 ?        00:00:00 [ksmd]
root        34     2  0 Nov08 ?        00:00:01 [khugepaged]
root        35     2  0 Nov08 ?        00:00:00 [crypto]
root        43     2  0 Nov08 ?        00:00:00 [kthrotld]
root        45     2  0 Nov08 ?        00:00:00 [kmpath_rdacd]
root        46     2  0 Nov08 ?        00:00:00 [kaluad]
root        48     2  0 Nov08 ?        00:00:00 [kpsmoused]
root        62     2  0 Nov08 ?        00:00:00 [deferwq]
root        92     2  0 Nov08 ?        00:00:01 [kauditd]
root       228     2  0 Nov08 ?        00:00:00 [scsi_eh_0]
root       229     2  0 Nov08 ?        00:00:00 [ata_sff]
root       230     2  0 Nov08 ?        00:00:00 [scsi_tmf_0]
root       231     2  0 Nov08 ?        00:00:00 [scsi_eh_1]
root       232     2  0 Nov08 ?        00:00:00 [scsi_tmf_1]
root       233     2  0 Nov08 ?        00:00:00 [scsi_eh_2]
root       234     2  0 Nov08 ?        00:00:00 [scsi_tmf_2]
root       237     2  0 Nov08 ?        00:00:00 [vmw_pvscsi_wq_0]
root       241     2  0 Nov08 ?        00:00:00 [scsi_eh_3]
root       242     2  0 Nov08 ?        00:00:00 [scsi_tmf_3]
root       243     2  0 Nov08 ?        00:00:00 [scsi_eh_4]
root       244     2  0 Nov08 ?        00:00:00 [scsi_tmf_4]
root       245     2  0 Nov08 ?        00:00:00 [scsi_eh_5]
root       246     2  0 Nov08 ?        00:00:00 [scsi_tmf_5]
root       247     2  0 Nov08 ?        00:00:00 [scsi_eh_6]
root       248     2  0 Nov08 ?        00:00:00 [scsi_tmf_6]
root       249     2  0 Nov08 ?        00:00:00 [scsi_eh_7]
root       250     2  0 Nov08 ?        00:00:00 [scsi_tmf_7]
root       251     2  0 Nov08 ?        00:00:00 [scsi_eh_8]
root       252     2  0 Nov08 ?        00:00:00 [scsi_tmf_8]
root       253     2  0 Nov08 ?        00:00:00 [scsi_eh_9]
root       254     2  0 Nov08 ?        00:00:00 [scsi_tmf_9]
root       255     2  0 Nov08 ?        00:00:00 [scsi_eh_10]
root       256     2  0 Nov08 ?        00:00:00 [scsi_tmf_10]
root       257     2  0 Nov08 ?        00:00:00 [scsi_eh_11]
root       258     2  0 Nov08 ?        00:00:00 [scsi_tmf_11]
root       259     2  0 Nov08 ?        00:00:00 [scsi_eh_12]
root       260     2  0 Nov08 ?        00:00:00 [scsi_tmf_12]
root       261     2  0 Nov08 ?        00:00:00 [scsi_eh_13]
root       262     2  0 Nov08 ?        00:00:00 [scsi_tmf_13]
root       263     2  0 Nov08 ?        00:00:00 [scsi_eh_14]
root       264     2  0 Nov08 ?        00:00:00 [scsi_tmf_14]
root       265     2  0 Nov08 ?        00:00:00 [scsi_eh_15]
root       266     2  0 Nov08 ?        00:00:00 [scsi_tmf_15]
root       267     2  0 Nov08 ?        00:00:00 [scsi_eh_16]
root       268     2  0 Nov08 ?        00:00:00 [scsi_tmf_16]
root       269     2  0 Nov08 ?        00:00:00 [scsi_eh_17]
root       270     2  0 Nov08 ?        00:00:00 [scsi_tmf_17]
root       271     2  0 Nov08 ?        00:00:00 [scsi_eh_18]
root       272     2  0 Nov08 ?        00:00:00 [scsi_tmf_18]
root       273     2  0 Nov08 ?        00:00:00 [scsi_eh_19]
root       274     2  0 Nov08 ?        00:00:00 [scsi_tmf_19]
root       275     2  0 Nov08 ?        00:00:00 [scsi_eh_20]
root       276     2  0 Nov08 ?        00:00:00 [scsi_tmf_20]
root       277     2  0 Nov08 ?        00:00:00 [scsi_eh_21]
root       278     2  0 Nov08 ?        00:00:00 [scsi_tmf_21]
root       279     2  0 Nov08 ?        00:00:00 [scsi_eh_22]
root       280     2  0 Nov08 ?        00:00:00 [scsi_tmf_22]
root       281     2  0 Nov08 ?        00:00:00 [scsi_eh_23]
root       282     2  0 Nov08 ?        00:00:00 [scsi_tmf_23]
root       283     2  0 Nov08 ?        00:00:00 [scsi_eh_24]
root       284     2  0 Nov08 ?        00:00:00 [scsi_tmf_24]
root       285     2  0 Nov08 ?        00:00:00 [scsi_eh_25]
root       286     2  0 Nov08 ?        00:00:00 [scsi_tmf_25]
root       287     2  0 Nov08 ?        00:00:00 [scsi_eh_26]
root       288     2  0 Nov08 ?        00:00:00 [scsi_tmf_26]
root       289     2  0 Nov08 ?        00:00:00 [scsi_eh_27]
root       290     2  0 Nov08 ?        00:00:00 [scsi_tmf_27]
root       291     2  0 Nov08 ?        00:00:00 [scsi_eh_28]
root       292     2  0 Nov08 ?        00:00:00 [scsi_tmf_28]
root       293     2  0 Nov08 ?        00:00:00 [scsi_eh_29]
root       294     2  0 Nov08 ?        00:00:00 [scsi_tmf_29]
root       295     2  0 Nov08 ?        00:00:00 [scsi_eh_30]
root       296     2  0 Nov08 ?        00:00:00 [scsi_tmf_30]
root       297     2  0 Nov08 ?        00:00:00 [scsi_eh_31]
root       299     2  0 Nov08 ?        00:00:00 [scsi_tmf_31]
root       300     2  0 Nov08 ?        00:00:00 [scsi_eh_32]
root       301     2  0 Nov08 ?        00:00:00 [scsi_tmf_32]
root       372     2  0 Nov08 ?        00:00:01 [kworker/0:1H]
root       424     2  0 Nov08 ?        00:00:00 [kdmflush]
root       425     2  0 Nov08 ?        00:00:00 [bioset]
root       435     2  0 Nov08 ?        00:00:00 [kdmflush]
root       436     2  0 Nov08 ?        00:00:00 [bioset]
root       450     2  0 Nov08 ?        00:00:00 [jbd2/dm-0-8]
root       451     2  0 Nov08 ?        00:00:00 [ext4-rsv-conver]
root       480     2  0 Nov08 ?        00:00:10 [jbd2/dm-1-8]
root       481     2  0 Nov08 ?        00:00:00 [ext4-rsv-conver]
root       513     1  0 Nov08 ?        00:01:08 /usr/lib/systemd/systemd-journald
root       540     1  0 Nov08 ?        00:00:00 /usr/lib/systemd/systemd-udevd
root       541     1  0 Nov08 ?        00:00:00 /usr/sbin/lvmetad -f
root       560     2  0 Nov08 ?        00:00:00 [ttm_swap]
root       561     2  0 Nov08 ?        00:00:00 [irq/16-vmwgfx]
root       565     2  0 Nov08 ?        00:00:00 [nfit]
root       644     2  0 Nov08 ?        00:00:00 [bioset]
root       645     2  0 Nov08 ?        00:00:00 [xfsalloc]
root       646     2  0 Nov08 ?        00:00:00 [xfs_mru_cache]
root       647     2  0 Nov08 ?        00:00:00 [xfs-buf/sda1]
root       648     2  0 Nov08 ?        00:00:00 [xfs-data/sda1]
root       649     2  0 Nov08 ?        00:00:00 [xfs-conv/sda1]
root       650     2  0 Nov08 ?        00:00:00 [xfs-cil/sda1]
root       651     2  0 Nov08 ?        00:00:00 [xfs-reclaim/sda]
root       652     2  0 Nov08 ?        00:00:00 [xfs-log/sda1]
root       653     2  0 Nov08 ?        00:00:00 [xfs-eofblocks/s]
root       654     2  0 Nov08 ?        00:00:00 [xfsaild/sda1]
root       656     2  0 Nov08 ?        00:00:00 [kdmflush]
root       657     2  0 Nov08 ?        00:00:00 [bioset]
root       658     2  0 Nov08 ?        00:00:00 [kdmflush]
root       660     2  0 Nov08 ?        00:00:00 [bioset]
root       661     2  0 Nov08 ?        00:00:00 [kdmflush]
root       663     2  0 Nov08 ?        00:00:00 [bioset]
root       665     2  0 Nov08 ?        00:00:00 [kdmflush]
root       668     2  0 Nov08 ?        00:00:00 [bioset]
root       671     2  0 Nov08 ?        00:00:00 [kdmflush]
root       672     2  0 Nov08 ?        00:00:00 [bioset]
root       698     2  0 Nov08 ?        00:00:00 [jbd2/dm-5-8]
root       699     2  0 Nov08 ?        00:00:00 [ext4-rsv-conver]
root       702     2  0 Nov08 ?        00:00:10 [jbd2/dm-6-8]
root       704     2  0 Nov08 ?        00:00:00 [ext4-rsv-conver]
root       714     2  0 Nov08 ?        00:00:00 [jbd2/dm-4-8]
root       715     2  0 Nov08 ?        00:00:00 [ext4-rsv-conver]
root       724     2  0 Nov08 ?        00:00:00 [jbd2/dm-3-8]
root       725     2  0 Nov08 ?        00:00:00 [ext4-rsv-conver]
root       727     2  0 Nov08 ?        00:00:00 [jbd2/dm-2-8]
root       728     2  0 Nov08 ?        00:00:00 [ext4-rsv-conver]
root       734     1  0 Nov08 ?        00:00:05 /sbin/auditd
polkitd    758     1  0 Nov08 ?        00:00:03 /usr/lib/polkit-1/polkitd --no-debug
dbus       759     1  0 Nov08 ?        00:00:21 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
root       765     1  0 Nov08 ?        00:00:00 /usr/bin/VGAuthService -s
root       766     1  0 Nov08 ?        00:05:29 /usr/bin/vmtoolsd
root       768     1  0 Nov08 ?        00:00:00 /usr/sbin/smartd -n -q never
root       769     1  0 Nov08 ?        00:00:21 /usr/sbin/irqbalance --foreground
root       776     1  0 Nov08 ?        00:00:08 /usr/lib/systemd/systemd-logind
root       783     1  0 Nov08 ?        00:00:00 /usr/sbin/gpm -m /dev/input/mice -t exps2
root       786     1  0 Nov08 ?        00:00:21 /usr/sbin/crond -n
root       790     1  0 Nov08 ?        00:00:00 /usr/sbin/atd -f
chrony     806     1  0 Nov08 ?        00:00:01 /usr/sbin/chronyd
root       841     2  0 Nov08 ?        00:00:00 [kworker/1:1H]
root       988     1  0 Nov08 ?        00:00:21 /usr/sbin/httpd -DFOREGROUND
root       991     1  0 Nov08 ?        00:13:58 python /usr/bin/goferd --foreground
root       994     1  0 Nov08 ?        00:00:52 /usr/sbin/rsyslogd -n
root      1005     1  0 Nov08 ?        00:00:00 /usr/sbin/sshd -D
root      1007     1  0 Nov08 ?        00:00:48 /usr/bin/python -Es /usr/sbin/tuned -l -P
root      1008     1  0 Nov08 ?        00:00:00 /usr/bin/rhsmcertd
root      1011     1  0 Nov08 ?        00:00:00 /usr/sbin/xinetd -stayalive -pidfile /var/run/xinetd.pid
mysql     1091     1  0 Nov08 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
mysql     1419  1091  0 Nov08 ?        00:08:09 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock
root      1504     1  0 Nov08 ?        00:00:03 /usr/libexec/postfix/master -w
postfix   1515  1504  0 Nov08 ?        00:00:01 qmgr -l -t unix -u
nagios    1551     1  0 Nov08 ?        00:00:00 /usr/local/ncpa/ncpa_listener --start
nagios    1553     1  0 Nov08 ?        00:01:11 /usr/local/ncpa/ncpa_passive --start
nagios    1557     1  0 Nov08 ?        00:00:30 /usr/local/nagios/bin/npcd -d -f /usr/local/nagios/etc/pnp/npcd.cfg
ajaxterm  1575     1  0 Nov08 ?        00:02:14 python /usr/share/ajaxterm/ajaxterm.py --daemon --port=8022 --uid=ajaxterm
root      1735     1  0 Nov08 tty1     00:00:00 /sbin/agetty --noclear tty1 linux
root      8313     2  0 07:05 ?        00:00:00 [kworker/0:2]
nagios    8672     1  0 Nov08 ?        00:00:00 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg -f
nagios    8719     1  0 Nov08 ?        00:01:11 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios    8721  8719  0 Nov08 ?        00:00:01 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    8722  8719  0 Nov08 ?        00:00:01 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    8723  8719  0 Nov08 ?        00:00:01 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    8724  8719  0 Nov08 ?        00:00:01 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios    8728  8672  0 Nov08 ?        00:00:08 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg -f
nagios    8729  8728  0 Nov08 ?        00:00:51 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg -f
nagios    8782  8719  0 Nov08 ?        00:00:28 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
root     12760     2  0 07:50 ?        00:00:00 [kworker/1:0]
root     15820     2  0 08:20 ?        00:00:00 [kworker/u128:0]
root     15948     2  0 08:21 ?        00:00:00 [kworker/1:2]
postfix  16295  1504  0 08:25 ?        00:00:00 pickup -l -t unix -u
root     16297     2  0 08:25 ?        00:00:00 [kworker/0:0]
root     16298     2  0 08:25 ?        00:00:00 [kworker/u128:2]
apache   16869   988  0 08:29 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
root     16884  1005  0 08:29 ?        00:00:00 sshd: admin [priv]
admin    16888 16884  0 08:29 ?        00:00:00 sshd: admin@pts/0
root     16889  1005  0 08:29 ?        00:00:00 sshd: admin [priv]
admin    16893 16889  0 08:29 ?        00:00:00 sshd: admin@notty
admin    16894 16893  0 08:29 ?        00:00:00 /usr/libexec/openssh/sftp-server
admin    16910 16888  0 08:29 pts/0    00:00:00 -bash
root     16949 16910  0 08:29 pts/0    00:00:00 sudo -s
root     16953 16949  0 08:29 pts/0    00:00:00 /bin/bash
root     17054     2  0 08:30 ?        00:00:00 [kworker/1:1]
root     17238     2  0 08:31 ?        00:00:00 [kworker/u128:1]
root     17243 16953  0 08:31 pts/0    00:00:00 ps -ef --cols=300
apache   18366   988  0 Nov12 ?        00:00:03 /usr/sbin/httpd -DFOREGROUND
apache   19233   988  0 Nov12 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
apache   46956   988  0 Nov12 ?        00:01:23 /usr/sbin/httpd -DFOREGROUND
apache   46995   988  0 Nov12 ?        00:00:50 /usr/sbin/httpd -DFOREGROUND
apache   49119   988  0 Nov12 ?        00:01:16 /usr/sbin/httpd -DFOREGROUND
apache   56307   988  0 Nov12 ?        00:00:27 /usr/sbin/httpd -DFOREGROUND
apache   56926   988  0 Nov12 ?        00:00:26 /usr/sbin/httpd -DFOREGROUND
apache   57523   988  0 Nov12 ?        00:00:37 /usr/sbin/httpd -DFOREGROUND
apache   61472   988  0 Nov12 ?        00:00:17 /usr/sbin/httpd -DFOREGROUND

For every command I submit through the Nagios XI interface I get the following error :
Capture.PNG
And systat shows :
Capture2.PNG
Regards.

Re: Hosts still showing up after "restore_defaults.sh"

Posted: Wed Nov 14, 2018 9:33 am
by tgriep
One thing I see is that the cron daemon is not running the processes that Nagios needs to run so to start them, login as root and run this command.

Code: Select all

service crond stop
killall -9 crond
service nagios start

To see if they are running, wait a few minutes and run this.

Code: Select all

ps -ef |grep cron
You should see something similar to this.

Code: Select all

nagios    5908  5904  0 08:26 ?        00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/event_handler.php >> /usr/local/nagiosxi/var/event_handler.log 2>&1
nagios    5911  5906  0 08:26 ?        00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php >> /usr/local/nagiosxi/var/cmdsubsys.log 2>&1
nagios    5912  5903  0 08:26 ?        00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/feedproc.php >> /usr/local/nagiosxi/var/feedproc.log 2>&1
nagios    5913  5902  0 08:26 ?        00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/perfdataproc.php >> /usr/local/nagiosxi/var/perfdataproc.log 2>&1
nagios    5914  5905  0 08:26 ?        00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/eventman.php >> /usr/local/nagiosxi/var/eventman.log 2>&1
nagios    5916  5907  0 08:26 ?        00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/sysstat.php >> /usr/local/nagiosxi/var/sysstat.log 2>&1
nagios    5917  5908  0 08:26 ?        00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/event_handler.php
nagios    5922  5911  0 08:26 ?        00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php
nagios    5923  5912  0 08:26 ?        00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/feedproc.php
nagios    5924  5913  0 08:26 ?        00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/perfdataproc.php
nagios    5925  5914  0 08:26 ?        00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/eventman.php
nagios    5927  5916  0 08:26 ?        00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/sysstat.php
nagios    8076  8063  0 Nov09 ?        00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php >> /usr/local/nagiosxi/var/cmdsubsys.log 2>&1
nagios    8086  8076  0 Nov09 ?        00:00:00 /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php
nagios    9131  9128  0 Nov09 ?        00:00:00 /bin/sh -c /usr/bin/php -q /usr/local/nagiosxi/cron/cmdsubsys.php >> /usr/local/nagiosxi/var/cmdsubsys.log 2>&1
If not, then something is not allowing the cron daemon to run. Usually it is a security policy.

Check the cron logs by running the following and posting the output here.

Code: Select all

tail -50 /var/log/cron
Next is the missing nagios.lock file.
To fix this, we will need to know which version of XI that is installed and the following 2 files from the server uploaded to the post.

Code: Select all

/etc/init.d/nagios
/usr/local/nagios/etc/nagios.cfg
Thanks.