Nagios Wizards no longer creating hosts

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
mmestnik
Posts: 972
Joined: Mon Feb 15, 2010 2:23 pm

Re: Nagios Wizards no longer creating hosts

Post by mmestnik »

Try this command:
http://go.nagios.com/forum/134/506

Also in the Core Config Manager try the "write out config" node under tools.
spasq01
Posts: 17
Joined: Fri Jun 04, 2010 3:47 pm

Re: Nagios Wizards no longer creating hosts

Post by spasq01 »

The link you provided does not work. The forum is saying the requested topic does not exist.

I also tried writing the config files. That doesn't work either. One thing that does work is that I manually created a cfg file for a host and another cfg file for it's services. When I log back into Nagios the host and services are there. This host is a windows server with agent. NAgios must not be seeing he agent though because services list disk usage and CPU/Memory utilizaion have a status of "could not fetch information from server."

I know this is not the proper way about adding new hosts but I was curious to see if it would work.
mmestnik
Posts: 972
Joined: Mon Feb 15, 2010 2:23 pm

Re: Nagios Wizards no longer creating hosts

Post by mmestnik »

The URL thing is odd.
http://support.nagios.com/forum/viewtop ... p=506#p506

That doesn't work? Well that tool is designed to produce low level output that describes the problem. If you are getting the output, then it's doing it's job. Is there anything about your problem that you could tell me that perhaps previously you omitted, truly feel free to tell me anything that you may feel unimportant and let me be the judge of that.

You can start another topic about NSClient++ installation, if you are having problems.
cczcp1
Posts: 11
Joined: Wed Jan 06, 2010 8:47 am

Re: Nagios Wizards no longer creating hosts

Post by cczcp1 »

mmestnik wrote:There is a delay, try waiting several minutes(2 to 3) prior to checking the status page.
mmestnik wrote:I believe that we still haven't ruled out a naming conflict issue. Could you try with a vary new hostname?
I'd like to get a feeling what what values you are using for "<host>". Could you try creating a host called "mmestnik" no spaces or dashes, ect , ect... Just those 8 lower case letters, in any order you prefer.
I've tried creating a new host with a totally different hostname and given it 20minutes before checking the status page and still no sign of it.
I then tried creating a new host (generic network device) waited another 20 minutes and still no sign of that host.

As for the script you suggested:
chmod -R 775 /usr/local/nagios/etc
chown nagios.nagios /usr/local/nagios/etc/*.cfg

This made no change to the /usr/local/nagios/etc directory (as it already had these rights) however the ./cfg files in the directory have rights set to apache:nagios not nagios:nagios. So using the second command I changed them.
Again I waited 15 minutes still no sign of the host so I tried the "Write Config Files" and waited another 15minutes and still nothing.

At the moment, I've been creating new hosts is simply by the "Add New" option under hosts, etc. which works fine.

I hope this helps us get to the bottom of the problem
cczcp1
Posts: 11
Joined: Wed Jan 06, 2010 8:47 am

Re: Nagios Wizards no longer creating hosts

Post by cczcp1 »

Hi - just thought I better throw this in the mix...

I've taken a snapshot of the VM and upgraded to Nagios XI 2009 R1.2 - whilst this appears to have resolved the problem with new hosts not being applied to the config (via the Nagios Wizard), he has brought another new (although somewhat minor) problem. Once completing the wizard and clicking on apply the process will get as far as "Waiting for configuration verification...." and then continue to leave the icon spinning whilst "....." are slowly marching across the screen.

If I go directly to the Host Detail page - I can see that the host has been added and (usually) responding as expected.
I've tried this with approximately 4 new hosts and and the problem every time. I will continue to experiment and report back my findings however I would like a fix to this if possible.

Cheers
CP
mmestnik
Posts: 972
Joined: Mon Feb 15, 2010 2:23 pm

Re: Nagios Wizards no longer creating hosts

Post by mmestnik »

We have seen this in testing. It's related to the cron jobs run from the user nagios crontab.

Code: Select all

crontab -u nagios -l
You might try running these commands like so: EDIT removed a '<' that was wrong.

Code: Select all

crontab -u nagios /dev/null; # clears out the crontab, perhaps you should save a backup.
rpm -i -p http://libslack.org/daemon/download/daemon-0.6.3-1.i386.rpm
stdserv="sysstat cmdsubsys eventman feedproc nom cleaner"
	for ech in $stdserv; do true
		daemon -n $ech -r --start \
			-u nagios.nagios -a 45 \
			-o /usr/local/nagiosxi/var/${ech}.log -- \
			/usr/bin/php -q /usr/local/nagiosxi/cron/${ech}.php
	done
	daemon -n dbmaint -r --start \
		-u nagios.nagios -A 1 -L $(( 60 * 5 )) \
		-o /usr/local/nagiosxi/var/dbmaint.log -- \
		/usr/bin/php -q /usr/local/nagiosxi/cron/dbmaint.php
One thing that happens as a result of doing it this way is that the log files can get quite large, this should fix them:

Code: Select all

# Note: we have started to use bzr, but this code still uses rcs.
yum -y install rcs

# I don't like some of the default options provided by redhat, you might want more then the default 4 copies for daily rotation.
ci -l /etc/logrotate.conf <<< "For NagiosXI"
sed -i 's/weekly/daily/g' /etc/logrotate.conf
sed -i 's/#compress/compress/g' /etc/logrotate.conf
ci -l -m"Changes from form post." /etc/logrotate.conf

# This is the part that matters, we need to create this file describing that files to rotate.
touch /etc/logrotate.d/nagiosxi
ci -l /etc/logrotate.d/nagiosxi <<< "For NagiosXI"
cat > /etc/logrotate.d/nagiosxi <<'EOF'
/usr/local/nagiosxi/var/*log {
    missingok
    notifempty
}
EOF
ci -l -m"Changes from form post." /etc/logrotate.d/nagiosxi
logrotate -f /etc/logrotate.conf
We are attempting to move these into an init script. Here is an example, though I can't vouch for it being syntactically correct... don't use it unless you can debug and fix it.

Code: Select all

#!/bin/sh
#
# chkconfig: 345 99 01
# description: NagiosXI subtasks
#
# $Id$
#

PATH=/usr/local/bin:$PATH
stdserv="sysstat cmdsubsys eventman feedproc nom cleaner"

# See how we were called.
case "$1" in
    start)
	RETVAL=0
	for ech in $stdserv; do true
		daemon -n $ech -r \
			-u nagios.nagios -a 45 \
			-o /usr/local/nagiosxi/var/${ech}.log -- \
			/usr/bin/php -q /usr/local/nagiosxi/cron/${ech}.php
		RETVAL=$(( RETVAL || $? ))
	done
	daemon -n dbmaint -r \
		-u nagios.nagios -A 1 -L $(( 60 * 5 )) \
		-o /usr/local/nagiosxi/var/dbmaint.log -- \
		/usr/bin/php -q /usr/local/nagiosxi/cron/dbmaint.php
	RETVAL=$(( RETVAL || $? ))	
	;;
    stop)
	RETVAL=0
	for ech in $stdserv dbmaint; do true
		daemon -n $ech -r --stop \
			-u nagios.nagios
		RETVAL=$(( RETVAL || $? ))
	done
	;;
    status)
	RETVAL=0
	for ech in $stdserv dbmaint; do true
		daemon -n $ech -r --status \
			-u nagios.nagios
		RETVAL=$(( RETVAL || $? ))
	done
	;;
    *)
	echo "Usage: $0 {start|stop|status}"
	RETVAL=1
	;;
esac
exit $RETVAL
This file should be called nagiosxi, if you don't know where to put it then please don't attempt to use it. There might be a proper release as part of a future upgrade, if we decide to use it at all.
spasq01
Posts: 17
Joined: Fri Jun 04, 2010 3:47 pm

Re: Nagios Wizards no longer creating hosts

Post by spasq01 »

Ok so I tried chmod and chown commands you directed me to in another post. No dice. So, I went off of what cczcp1 tried by upgrading to R1.2. This did not fix my issue either. I still go successfully through the wizard thinking my new host will be created just fine but it never shows up in the web interface nor do I see a cfg file created in /usr/local/nagios/etc/hosts. I would really like to get to the bottom of this because this is effecting my evaluation time of Nagios.
spasq01
Posts: 17
Joined: Fri Jun 04, 2010 3:47 pm

Re: Nagios Wizards no longer creating hosts

Post by spasq01 »

I should note that if I go into the Core config manager and then Hosts under Monitoring and click Add New I can successfully create a new host this way.
cczcp1
Posts: 11
Joined: Wed Jan 06, 2010 8:47 am

Re: Nagios Wizards no longer creating hosts

Post by cczcp1 »

I think solved a little more of the puzzle.

I've reverted back to the snapshot before I performed the upgrade and tried again only this time carefully checking for any errors.
The first was the import process after the package upgrades, it apparently was failing as it was unable to connect via wget to its config files back.

Code: Select all

IMPORTING /usr/local/nagios/etc/import/xiwzardtemplates.cfg
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosql/admin/import.php --post-data 'chbOverwrite=1&selImportFile[]=/usr/local/nagios/etc/import/xiwzardtemplates.cfg' -O nagiosql.import.monitoring
--2010-06-09 07:43:03--  http://localhost/nagiosql/admin/import.php
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:80... Timeout
I subsequently added no_proxy to my environment variables so that the proxies are not used for content from the localhost and the local network.

After this, the only other issue (which I'm still fighting with) is; after every yum package update I get the error:-

Code: Select all

./1-prereqs: line 15: rpmdev-vercmp: command not found
./1-prereqs: line 15: rpmdev-vercmp: command not found
./1-prereqs: line 15: rpmdev-vercmp: command not found
./1-prereqs: line 15: rpmdev-vercmp: command not found
There doesn't appear to be any errors after this so I hope its safe to ignore it, but thought I better post it just incase.

Now that I've re-completed the update, (for the moment) the wizards seem to be working along the verifying config checks at the end. Fingers crossed this will be the end of my problems. If there is anything I can do to help or any further testing you'd like me to do - please just say ;)

Thanks guys.
CP
mmestnik
Posts: 972
Joined: Mon Feb 15, 2010 2:23 pm

Re: Nagios Wizards no longer creating hosts

Post by mmestnik »

cczp1, so I would have had to configure tsocks to duplicate your problem? or are you just using the environment variables that AFAIK most of the check commands will ignore?

spasq01, Does disabling any proxy also fix this problem for you? Try and be vary informative, then provide details that an English speaking person(not leaving out any important details with this description) might ask for. On top of that you could try and use any technical ability you have to fill out even more details.
Locked