Apply Configuration to use cfg_dir

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
chicjo01
Posts: 194
Joined: Tue Jul 28, 2015 2:52 pm

Apply Configuration to use cfg_dir

Post by chicjo01 »

I have 2 questions about Apply Configuration

Version: Nagios XI 5.2.7

Question 1) Is there a way to convert contactgroups.cfg file to contactgroups directory and have apply configuration create the individual files vs put them into one file.

Reason 1) When I use the apply configuration button. I get the below error, but it is not consistence except for Unexpected EOF. The cfg file is reference are contacts.cfg, hostgroups.cfg, and contactgroups.cfg. I am guessing that a timeout gets reached before the whole file can be written to, but the file looks to have completed fine.
[root@<Nagios Server> etc]# grep { contactgroups.cfg | wc -l
299
[root@<Nagios Server> etc]# grep } contactgroups.cfg | wc -l
299

[root@<Nagios Server> etc]# tail contactgroups.cfg
alias windows+wpscitrix
}

###############################################################################
#
# Contact Group configuration file
#
# END OF FILE
#
###############################################################################
Error: Unexpected EOF in file '/usr/local/nagios/etc/contactgroups.cfg' on line 1443 - check for a missing closing bracket.

Nagios Core 4.1.1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-19-2015
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Unexpected EOF in file '/usr/local/nagios/etc/contactgroups.cfg' on line 1443 - check for a missing closing bracket.
Error processing object config files!


Question 2) For large environments, it is better to use one cfg file or separated cfg files inside a directory like Hosts or Services?

Reason 2)
We have the below setup so far and that is just Ping, CPU, Memory. We still are working to add Disk Space and Services. I am guessing we may have double or three the number of services, hostgroups, contactgroups from what we currently have.
6377 services.
1960 hosts.
298 host groups.
0 service groups.
135 contacts.
299 contact groups.

Active Service Checks
1-min 659
5-min 3966
15-min 6354
User avatar
chicjo01
Posts: 194
Joined: Tue Jul 28, 2015 2:52 pm

Re: Apply Configuration to use cfg_dir

Post by chicjo01 »

I checked the /var/log/httpd/error_log and found this:
[Mon Apr 18 11:24:55.930341 2016] [:error] [pid 112497] [client xx.xx.xx.xx:64417] PHP Warning: include_once(/usr/local/nagiosxi/html/includes/configwizards/sla/../components/componenthelper.inc.php): failed to open stream: No such file or directory in /usr/local/nagiosxi/html/includes/configwizards/sla/sla.inc.php on line 9, referer: https://<Nagios Server>/nagiosxi/config/
[Mon Apr 18 11:24:55.930383 2016] [:error] [pid 112497] [client xx.xx.xx.xx:64417] PHP Warning: include_once(): Failed opening '/usr/local/nagiosxi/html/includes/configwizards/sla/../components/componenthelper.inc.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /usr/local/nagiosxi/html/includes/configwizards/sla/sla.inc.php on line 9, referer: https://<Nagios Server>/nagiosxi/config/
[Mon Apr 18 11:25:16.086335 2016] [:error] [pid 45488] [client xx.xx.xx.xx:64424] PHP Notice: Undefined index: background in /usr/local/nagiosxi/html/includes/page-home-main.php on line 55, referer: https://<Nagios Server>/nagiosxi/
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Apply Configuration to use cfg_dir

Post by tmcdonald »

Core could do this, but the way that XI is going to write the configs is to put all of the contact groups in a single file. Changing this behavior would need to be a feature request, and I couldn't guarantee if/when that would make it in.

For your section question, it would really only apply to Core since direct config file manipulation in XI is a bad idea, but really it shouldn't matter. It all gets read into memory on service startup, so on a small scale it might save a few open() and close() calls to have it all in one long file, but that's pretty negligible.
Former Nagios employee
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Apply Configuration to use cfg_dir

Post by rkennedy »

Question 1) Is there a way to convert contactgroups.cfg file to contactgroups directory and have apply configuration create the individual files vs put them into one file.
At this time, XI only organizes into the individual file. I haven't seen this issue this far, and a few customers have much more going on. Could you PM over a profile for us to look at, and see if we can figure out why it's not validating?
Question 2) For large environments, it is better to use one cfg file or separated cfg files inside a directory like Hosts or Services?
Are you using a static directory then? Honestly, the powerful thing about Nagios is you can organize these however you'd like. I'm sure in a HUGE core environment (100k+ checks), this would matter, but for the sake of XI I believe you'll be fine. Generally, once hosts / services hit a combined 20K then it's time to optimize.
Former Nagios Employee
User avatar
chicjo01
Posts: 194
Joined: Tue Jul 28, 2015 2:52 pm

Re: Apply Configuration to use cfg_dir

Post by chicjo01 »

Thank you for the information. We are not using static, we are using active checks and apply configuration.

Then what could be causing the Apply Configuration to EOF if there is nothing wrong in the current config?
Apply Configuration:
Error: Unexpected EOF in file '/usr/local/nagios/etc/contacts.cfg' on line 900 - check for a missing closing bracket.
[root@<Nagios Server> scripts]# tail /usr/local/nagios/etc/contacts.cfg
use maint
}

###############################################################################
#
# Contact configuration file
#
# END OF FILE
#
###############################################################################
Line 900 in contacts.cfg is:
define contact {
contact_name GLO TAS-DIGS
alias GLO TAS-DIGS
email GLO.TAS-DIGS@<Domain>
_useScript ADScanner <-- Line 900
use maint
}
User avatar
chicjo01
Posts: 194
Joined: Tue Jul 28, 2015 2:52 pm

Re: Apply Configuration to use cfg_dir

Post by chicjo01 »

So after much trail and error I have resolved the issue.

Problem 1) I found the disk space was at 100% due to /usr/local/nagios/var/spool/perfdata filling it up.
Fix 1) I fixed that by starting up NCPD which was not running, it took a few hours to clear the disk space down to a reasonable size.

Problem 2) The Apply Configuration Button in the Website continued to report problems.
Fix 2) Used the command line version /usr/local/nagiosxi/scripts/reconfigure_nagios.sh

That resolved my Apply Configuration issue. This can be closed.
Locked