Nagios XI - Import config

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
paulconca
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

Nagios XI - Import config

Post by paulconca »

Hi all

Is it possible to use the "Import Config Files" via command line or external commands please?

Thank you
Attachments
2022-04-01 11_24_48-CCM · Nagios XI.png
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Nagios XI - Import config

Post by gormank »

Copy cfg files into the /usr/local/nagios/etc/import dir, and run the reconfigure script.

dir=`pwd`; cd /usr/local/nagiosxi/scripts; ./reconfigure_nagios.sh; cd $dir
paulconca
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

Re: Nagios XI - Import config

Post by paulconca »

Thank you

Doesn't seem to work, unless i misunderstood

For example in my testing, I have two Nagios servers
i removed a service monitor, from one nagios server

i coped the file from the first server to the other one. Is this correct or do I need to out it in a services folder?
/usr/local/nagios/etc/services/localhost.cfg --> /usr/local/nagios/etc/import

I confirm the file is correct on the second server (the service is missing as expected)

Then i run the below. The output says it is successful but the service check remains on the second Nagios server.

cd /usr/local/nagiosxi/scripts/; ./reconfigure_nagios.sh

--- reset_config_perms.sh ------------
> Setting script permissions
> Setting CCM script permissions
> Setting special script permissions
> Setting special component script permissions
> Setting migrate permissions
> Setting configuration file/directory permissions
> Setting perfdata directory and RRD permissions
> Setting libexec directory permissions
> Setting Nagios XI config permissions
> Setting NOM checkpoint user:group permissions
> + Setting Recurring Downtime file user:group permissions
> + Setting BPI configuration file user:group permissions
--------------------------------------

--- ccm_import.php -------------------
> Setting import directory: /usr/local/nagios/etc/import/
> Importing config files into the CCM
- Importing: /usr/local/nagios/etc/import/localhost.cfg .. SUCCESS
--------------------------------------

--- ccm_export.php -------------------
> Writing CCM configuration to Nagios files
Finished writing out configuraton
--------------------------------------

--------------------------------------
> Verifying configuration with Nagios Core
> Output:
Nagios Core 4.4.6
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2020-04-28
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 16 services.
Checked 1 hosts.
Checked 1 host groups.
Checked 0 service groups.
Checked 2 contacts.
Checked 2 contact groups.
Checked 138 commands.
Checked 9 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 9 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
> Return Code: 0
--------------------------------------
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Nagios XI - Import config

Post by gormank »

Go into CCM on the import server and look for the service.
paulconca
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

Re: Nagios XI - Import config

Post by paulconca »

I think i figured out what is happening

When i add a service monitor its works and updates as expected in the CCM and the user interface.

When i remove a service monitor and do the same steps, nothing happens.

Is this a bug or expected?
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Nagios XI - Import config

Post by gormank »

Removing in ccm works fine.
paulconca
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

Re: Nagios XI - Import config

Post by paulconca »

So removing a monitor doesn't work this way? Only works when you add one?

Copy cfg files into the /usr/local/nagios/etc/import dir, and run the reconfigure script.

dir=`pwd`; cd /usr/local/nagiosxi/scripts; ./reconfigure_nagios.sh; cd $dir
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Nagios XI - Import config

Post by gormank »

No, importing won't remove anything. There is a line in the config files that says if the service is active, or enabled that you might be able to set to zero and import. That may set it as inactive in CCM, but I'm not certain.
Locked