Page 1 of 2
Error applying configuration
Posted: Wed Jun 10, 2015 2:03 pm
by SavaSC
Hello,
I am having difficulties applying the configuration on one of my NagiosXI instances (2014R2.7). We retired a device and I am trying to remove it from Nagios. I renamed it then removed it from all Hostgroups, Templates and Parents. I then removed the dependencies and set it to Inactive. After that I deleted it. All of that went fine with no errors. When I went to apply the changes, however, I got this error:
Code: Select all
Error: Invalid max_check_attempts value for host 'Die'
Error: Could not register host (config file '/usr/local/nagios/etc/hosts/Die.cfg', starting on line 16)
All of the Configuration changes show "successfully written!"
I checked and the file "/usr/local/nagios/etc/hosts/Die.cfg" does not exist.
Any ideas about what I might be missing?
Thanks for your help!
Re: Error applying configuration
Posted: Wed Jun 10, 2015 2:10 pm
by ssax
After you have a failed apply configuration it reverts to a last good configuration.
If you want to check out that file to see what is wrong with it (and post it here) you can:
Go to Configure > Core Config Manager > Tools > Write Config Files
- Click Delete (it's safe, they get rebuilt)
- Click Write
- Now go look at the file
If you go into the CCM and search for that host under hosts, do you see it?
Re: Error applying configuration
Posted: Wed Jun 10, 2015 2:23 pm
by SavaSC
Thank you for your quick response.
I have followed your directions (delete and write the config files) and all the config files show that they were successfully written. That file still doesn't show up under /usr/local/nagios/etc/hosts. I tried to apply the config again with the same error.
That Host does not show up in CCM. I have restarted the server knowing that if it hasn't been properly applied then it will show back up, but it's not there. If it wasn't for the thrown error I couldn't tell that it failed.
Re: Error applying configuration
Posted: Wed Jun 10, 2015 2:40 pm
by tgriep
Can you check the mysql log for errors? Run the following and post back the results.
Re: Error applying configuration
Posted: Thu Jun 11, 2015 11:06 am
by SavaSC
Sorry about the delay getting back to you. Here is what looks like the relevant information.
Code: Select all
150610 13:57:30 mysqld started
150610 13:57:31 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
150610 13:57:31 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
150610 13:57:31 InnoDB: Started; log sequence number 0 43655
150610 13:57:31 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.0.77' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
I'm not sure what this "unsigned value" is supposed to be.
Re: Error applying configuration
Posted: Thu Jun 11, 2015 12:03 pm
by abrist
SavaSC wrote:
I'm not sure what this "unsigned value" is supposed to be.
It is fine.
Your issues with apply config on 2.7 could be related to sudoers. What is the output of:
Code: Select all
visudo -c
grep manage_service /usr/local/nagiosxi/scripts/restart_nagios_with_export.sh
And the output of running a reconfigure:
Code: Select all
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh
And finally, can you post the file:
Re: Error applying configuration
Posted: Thu Jun 11, 2015 2:39 pm
by SavaSC
abrist wrote:
Your issues with apply config on 2.7 could be related to sudoers. What is the output of:
Code: Select all
visudo -c
grep manage_service /usr/local/nagiosxi/scripts/restart_nagios_with_export.sh
Here you go.
Code: Select all
sudo $BASEDIR/manage_services.sh restart nagios
abrist wrote:
And the output of running a reconfigure:
Code: Select all
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh
Here's the output.
Code: Select all
Things look okay - No serious problems were detected during the pre-flight check
RET: 0
>>> /etc/sudoers: syntax error near line 97 <<<
>>> /etc/sudoers: syntax error near line 98 <<<
>>> /etc/sudoers: syntax error near line 100 <<<
>>> /etc/sudoers: syntax error near line 102 <<<
sudo: parse error in /etc/sudoers near line 97
sudo: no valid sudoers sources found, quitting
abrist wrote:
And finally, can you post the file:
And the file.
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 (perhap 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
Defaults env_reset
Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \
LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \
LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC \
LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \
_XKB_CHARSET XAUTHORITY"
## 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
####################################################################
####################################################################
# Nagios Core
# NDO2DB
# PNP
# NEEDED TO ALLOW NAGIOS TO CHECK SERVICE STATUS
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_init_service
# ASTERISK-SPECIFIC CHECKS
# NOTE: You can uncomment these lines if you are monitoring Asterisk on the local machine
#nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_asterisk_sip_peers.sh
#nagios ALL=NOPASSWD: /usr/local/nagios/libexec/nagisk.pl
#nagios ALL=NOPASSWD: /usr/sbin/asterisk
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 *
Thanks for your help!
Re: Error applying configuration
Posted: Thu Jun 11, 2015 3:01 pm
by tgriep
Is there a file called nagiosxi in the /etc/sudoers.d folder?
If so, is needs to be moved out of that folder. Try doing this in a shell on the system.
Code: Select all
cd /etc/sudoers.d
mv nagiosxi /tmp/
After this, try to apply your configuration.
Re: Error applying configuration
Posted: Thu Jun 11, 2015 3:08 pm
by SavaSC
I don't have a /etc/sudoer.d folder. I have the following folders under /etc/
sudoers
sudoers.rpmnew
Re: Error applying configuration
Posted: Thu Jun 11, 2015 3:20 pm
by tgriep
Try removing the following from the sudoers file
After removing them, run the following and post back if there are anymore sudoers syntax errors
Code: Select all
cd /usr/local/nagiosxi/scripts
./reconfigure_nagios.sh