Cannot Apply Configuration after upgrade to NagiosXI R2.6

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
vincheesel
Posts: 30
Joined: Fri Jan 11, 2013 5:33 am

Cannot Apply Configuration after upgrade to NagiosXI R2.6

Post by vincheesel »

Hi all,

I was previously on NagiosXI R2.0 and upgraded to R2.6, everything went well during the upgrade (So I thought!) but when I attempt to apply the configuration I get the following error

(tick) Command submitted for processing...
(!) Waiting for configuration verification........
(!) Nagios restart command failed.

When I click Show Config Changes - everything checks out ok

Code: Select all

Write host configurations ...
Host configuration files successfully written!

Write service configurations ...
Service configuration files successfully written!

Configuration file: hostgroups.cfg successfully written!
Configuration file: servicegroups.cfg successfully written!
Configuration file: hosttemplates.cfg successfully written!
Configuration file: servicetemplates.cfg successfully written!
Configuration file: timeperiods.cfg successfully written!
Configuration file: commands.cfg successfully written!
Configuration file: contacts.cfg successfully written!
Configuration file: contactgroups.cfg successfully written!
Configuration file: contacttemplates.cfg successfully written!
Configuration file: servicedependencies.cfg successfully written!
Configuration file: hostdependencies.cfg successfully written!
Configuration file: serviceescalations.cfg successfully written!
Configuration file: hostescalations.cfg successfully written!
Configuration file: serviceextinfo.cfg successfully written!
Configuration file: hostextinfo.cfg successfully written!
The hosts and service configuration are all successfully written,

Then I click Show Errors

Code: Select all

Error: The description string for service 'Check Registrar is Go Daddy, INC' on host 'example.com' contains one or more illegal characters.
I believe the comma is to blame, but the problem is I didn't see this service appear in my CCM services list after the upgrade!
So I cannot delete or rename the service!

How do I remove this service entry? it must be still resident on the system somewhere?

Could someone please help!

Thanks
vincheesel
Posts: 30
Joined: Fri Jan 11, 2013 5:33 am

Re: Cannot Apply Configuration after upgrade to NagiosXI R2.

Post by vincheesel »

Just to clear up a few things...

What version of Nagios XI are you using? Nagios XI 2014 R2.6
Linux Distribution and version? Centos 6.6
Kernel? 2.6.32-504.12.2.el6.i686
Virtual? Yes - Hosted on Windows Server 2012R2 with Hyper-V
No Proxy
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Cannot Apply Configuration after upgrade to NagiosXI R2.

Post by lmiltchev »

You can temporarily deactivate the 'Check Registrar is Go Daddy, INC' service until you clear things out. Go to the CCM->Services->Check Registrar is Go Daddy, INC->and click on the "Yes" active button to deactivate the service. Don't apply configuration yet. Run the Write Config Tool to make sure you don't have any more config errors as nagios cannot start/restart with config errors.

CCM->Tools->Write Config Files->Write (check the output for errors)->Verify (check the output for errors)

If there are no config errors, apply configuration. If everything is OK, go back to the CCM, and take care of the "illegal characters" issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
vincheesel
Posts: 30
Joined: Fri Jan 11, 2013 5:33 am

Re: Cannot Apply Configuration after upgrade to NagiosXI R2.

Post by vincheesel »

ok, the "check registrar" doesn't appear in the Nagios CCM therefore I cannot disable it.
When I attempt to verify, here are the results.
There were a whole bunch of Warnings: Duplicate definition found for service - I just copied one below (there are at least 12, all for different hosts)

Code: Select all

Nagios Core 4.0.8 
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors 
Copyright (c) 1999-2009 Ethan Galstad 
Last Modified: 08-12-2014 
License: GPL 

Website: http://www.nagios.org 
Reading configuration data... 
Read main config file okay... 
Warning: Duplicate definition found for service 'Print Spooler' on host 'server' (config file '/usr/local/nagios/etc/services/server.cfg', starting on line 305) 

Running pre-flight check on configuration data... 
Checked 2984 services. 
Checked 324 hosts. 
Checked 16 host groups. 
Checked 13 service groups. 
Checked 34 contacts. 
Checked 13 contact groups. 
Checked 148 commands. 
Checked 47 time periods. 
Checked 0 host escalations. 
Checked 0 service escalations. 
Checking for circular paths... 
Checked 324 hosts 
Checked 0 service dependencies 
Checked 0 host dependencies 
Checked 47 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 
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Cannot Apply Configuration after upgrade to NagiosXI R2.

Post by Box293 »

What is the output of?

Code: Select all

grep -R Registrar /usr/local/nagios/etc/
Also, run these commands and send back the output:

Code: Select all

cd /usr/local/nagiosxi/scripts/
./reconfigure_nagios.sh > /tmp/reconfigure_output.txt 2>&1
Please send us the file /tmp/reconfigure_output.txt.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
vincheesel
Posts: 30
Joined: Fri Jan 11, 2013 5:33 am

Re: Cannot Apply Configuration after upgrade to NagiosXI R2.

Post by vincheesel »

What is the output of? grep -R Registrar /usr/local/nagios/etc/
ok, due to privacy reasons I'm going to alter the name
I had an output of 259 files - they were all around the lines of this - just with different names and registrars

Code: Select all

/usr/local/nagios/etc/services/example.co.uk.cfg:        service_description             Check Registrar: is TPP Internet
Please send us the file /tmp/reconfigure_output.txt.

Code: Select all

URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data '<REMOVED>' -O nagiosql.login--2015-04-01 14:47:54--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.login”

     0K ..........                                              589K=0.02s

2015-04-01 14:47:54 (589 KB/s) - “nagiosql.login” saved [10377]

LOGIN SUCCESSFUL!
IMPORTING CONFIG FILES...URL: http://localhost/nagiosxi/includes/components/ccm/
Array
(
)
RESETTING PERMS
SETUID ROOT OK
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE
/usr/bin/wget --save-cookies nagiosql.cookies --keep-session-cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data '<REMOVED>' -O nagiosql.login--2015-04-01 14:47:55--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.login”

     0K ..........                                              490K=0.02s

2015-04-01 14:47:55 (490 KB/s) - “nagiosql.login” saved [10377]

LOGIN SUCCESSFUL!
URL: http://localhost/nagiosxi/includes/components/ccm/
CMDLINE:
/usr/bin/wget --load-cookies=nagiosql.cookies http://localhost/nagiosxi/includes/components/ccm/ --no-check-certificate --post-data '<REMOVED>' -O nagiosql.export.monitoring
--2015-04-01 14:47:55--  http://localhost/nagiosxi/includes/components/ccm/
Resolving localhost... ::1, 127.0.0.1
Connecting to localhost|::1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “nagiosql.export.monitoring”

     0K .......... ..                                          7.06K=1.8s

2015-04-01 14:47:57 (7.06 KB/s) - “nagiosql.export.monitoring” saved [13233]

WRITE CONFIGS SUCCESSFUL!
OUTPUT:
Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://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 2084 services.
        Checked 634 hosts.
        Checked 1 host groups.
        Checked 14 service groups.
        Checked 30 contacts.
        Checked 12 contact groups.
        Checked 135 commands.
        Checked 44 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 634 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 44 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
RET: 0
sudo: >>> /etc/sudoers: Alias `NAGIOSXI' already defined near line 112 <<<
sudo: parse error in /etc/sudoers near line 112
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Cannot Apply Configuration after upgrade to NagiosXI R2.

Post by Box293 »

OK so we need to deal with this first:
sudo: >>> /etc/sudoers: Alias `NAGIOSXI' already defined near line 112 <<<
sudo: parse error in /etc/sudoers near line 112
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Can you attach your /etc/sudoers file here as well as any files in /etc/sudoers.d/

It's important that you attach them so we can see them in their original format.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
vincheesel
Posts: 30
Joined: Fri Jan 11, 2013 5:33 am

Re: Cannot Apply Configuration after upgrade to NagiosXI R2.

Post by vincheesel »

Hi,

As requested...

Code: Select all

## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.
##
## Examples are provided at the bottom of the file for collections
## of related commands, which can then be delegated out to particular
## users or groups.
##
## This file must be edited with the 'visudo' command.

## Host Aliases
## Groups of machines. You may prefer to use hostnames (perhaps using
## wildcards for entire domains) or IP addresses instead.
# Host_Alias     FILESERVERS = fs1, fs2
# Host_Alias     MAILSERVERS = smtp, smtp2

## User Aliases
## These aren't often necessary, as you can use regular groups
## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname
## rather than USERALIAS
# User_Alias ADMINS = jsmith, mikem


## Command Aliases
## These are groups of related commands...

## Networking
# Cmnd_Alias NETWORKING = /sbin/route, /sbin/ifconfig, /bin/ping, /sbin/dhclient, /usr/bin/net, /sbin/iptables, /usr/bin/rfcomm, /usr/bin/wvdial, /sbin/iwconfig, /sbin/mii-tool

## Installation and management of software
# Cmnd_Alias SOFTWARE = /bin/rpm, /usr/bin/up2date, /usr/bin/yum

## Services
# Cmnd_Alias SERVICES = /sbin/service, /sbin/chkconfig

## Updating the locate database
# Cmnd_Alias LOCATE = /usr/bin/updatedb

## Storage
# Cmnd_Alias STORAGE = /sbin/fdisk, /sbin/sfdisk, /sbin/parted, /sbin/partprobe, /bin/mount, /bin/umount

## Delegating permissions
# Cmnd_Alias DELEGATING = /usr/sbin/visudo, /bin/chown, /bin/chmod, /bin/chgrp

## Processes
# Cmnd_Alias PROCESSES = /bin/nice, /bin/kill, /usr/bin/kill, /usr/bin/killall

## Drivers
# Cmnd_Alias DRIVERS = /sbin/modprobe

# Defaults specification

#
# Disable "ssh hostname sudo <cmd>", because it will show the password in clear.
#         You have to run "ssh -t hostname sudo <cmd>".
#
######################Defaults    requiretty

#
# Preserving HOME has security implications since many programs
# use it when searching for configuration files.
#
Defaults    always_set_home

Defaults    env_reset
Defaults    env_keep =  "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS"
Defaults    env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"
Defaults    env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"
Defaults    env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"
Defaults    env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"

#
# Adding HOME to env_keep may enable a user to run unrestricted
# commands via sudo.
#
# Defaults   env_keep += "HOME"

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin

## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
##      user    MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL

## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS

## Allows people in group wheel to run all commands
# %wheel        ALL=(ALL)       ALL

## Same thing without a password
# %wheel        ALL=(ALL)       NOPASSWD: ALL

## Allows members of the users group to mount and unmount the
## cdrom as root
# %users  ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom

## Allows members of the users group to shutdown this system
# %users  localhost=/sbin/shutdown -h now

# Include files in /etc/sudoers.d
#includedir /etc/sudoers.d


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/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 *
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:/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 *
vincheesel
Posts: 30
Joined: Fri Jan 11, 2013 5:33 am

Re: Cannot Apply Configuration after upgrade to NagiosXI R2.

Post by vincheesel »

Ha,

I also have this in my sudoers.d

They seem a little different but conflicting, what do you suggest I do here?

Code: Select all

####################################################################
# NAGIOSXI
####################################################################

User_Alias      NAGIOSXI=nagios

# Nagios Core
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

# NDO2DB
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

# PNP
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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Cannot Apply Configuration after upgrade to NagiosXI R2.

Post by Box293 »

vincheesel wrote: Ha,

I also have this in my sudoers.d

They seem a little different but conflicting, what do you suggest I do here?
I'm pretty sure this is the source of your problem. Let's move it to /tmp

Code: Select all

mv /etc/sudoers.d/filename /tmp/
Obviously change "filename" to the name of the file in /etc/sudoers.d

Now run this and see if your problem is fixed:

Code: Select all

cd /usr/local/nagiosxi/scripts/
./reconfigure_nagios.sh
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked