We've moved to a new support system!

The Nagios Answer Hub is a place where you can get help with technical questions from our experts. There, you can quickly open tickets and join discussion boards.

Request Nagios Answer Hub access here: https://info.nagios.com/answer-hub-access-new-users

After completing the access form, you will be given access to a portal where new tickets can be created. We will keep the old customer forum sections and ticket system available for current cases to be resolved.

Go to the Answer Hub

Nagios XI - Import config

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

Nagios XI - Import config

Postby paulconca » Fri Apr 01, 2022 5:26 am

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
paulconca
 
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

Re: Nagios XI - Import config

Postby gormank » Fri Apr 01, 2022 11:58 am

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: 992
Joined: Tue Dec 02, 2014 12:00 pm

Re: Nagios XI - Import config

Postby paulconca » Tue Apr 05, 2022 10:52 am

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
--------------------------------------
paulconca
 
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

Re: Nagios XI - Import config

Postby gormank » Tue Apr 05, 2022 1:28 pm

Go into CCM on the import server and look for the service.
gormank
 
Posts: 992
Joined: Tue Dec 02, 2014 12:00 pm

Re: Nagios XI - Import config

Postby paulconca » Thu Apr 07, 2022 5:46 am

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?
paulconca
 
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

Re: Nagios XI - Import config

Postby gormank » Thu Apr 07, 2022 1:45 pm

Removing in ccm works fine.
gormank
 
Posts: 992
Joined: Tue Dec 02, 2014 12:00 pm

Re: Nagios XI - Import config

Postby paulconca » Fri Apr 08, 2022 6:11 am

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
paulconca
 
Posts: 31
Joined: Tue Jan 16, 2018 7:05 am

Re: Nagios XI - Import config

Postby gormank » Fri Apr 08, 2022 9:36 am

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.
gormank
 
Posts: 992
Joined: Tue Dec 02, 2014 12:00 pm


Return to Community Support

Who is online

Users browsing this forum: Google [Bot] and 24 guests

cron