mv .cfg for switch I don't want to monitor crashes Nagios

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.
billperrotta
Posts: 115
Joined: Fri Feb 21, 2014 11:44 am

Re: mv .cfg for switch I don't want to monitor crashes Nagio

Post by billperrotta »

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Processing object config file '/etc/nagios/objects/commands.cfg'...
Processing object config file '/etc/nagios/objects/contacts.cfg'...
Processing object config file '/etc/nagios/objects/timeperiods.cfg'...
Processing object config file '/etc/nagios/objects/templates.cfg'...
Processing object config file '/etc/nagios/objects/localhost.cfg'...
Processing object config file '/etc/nagios/objects/groups.cfg'...
Processing object config directory '/etc/nagios/objects/computers'...
Processing object config directory '/etc/nagios/objects/computers/corporate'...
Processing object config file '/etc/nagios/objects/computers/corporate/ahgserver2.cfg'...
Processing object config file '/etc/nagios/objects/computers/corporate/ahgserver2003.cfg'...
Processing object config file '/etc/nagios/objects/computers/corporate/grey.cfg'...
Processing object config file '/etc/nagios/objects/computers/corporate/mail.cfg'...
Processing object config directory '/etc/nagios/objects/computers/hotels'...
Processing object config file '/etc/nagios/objects/computers/hotels/bentley.cfg'...
Processing object config file '/etc/nagios/objects/computers/hotels/amcourt.cfg'...
Processing object config file '/etc/nagios/objects/computers/hotels/ameritania.cfg'...
Processing object config file '/etc/nagios/objects/computers/hotels/moderne.cfg'...
Processing object config file '/etc/nagios/objects/computers/hotels/berkeley.cfg'...
Processing object config file '/etc/nagios/objects/computers/hotels/empire.cfg'...
Processing object config file '/etc/nagios/objects/computers/hotels/empire2.cfg'...
Processing object config file '/etc/nagios/objects/computers/hotels/marcel.cfg'...
Processing object config file '/etc/nagios/objects/computers/excsvc.cfg'...
Processing object config file '/etc/nagios/objects/computers/winsvc.cfg'...
Processing object config directory '/etc/nagios/objects/devices'...
Processing object config file '/etc/nagios/objects/devices/antsvc.cfg'...
Processing object config file '/etc/nagios/objects/devices/fwsvc.cfg'...
Processing object config directory '/etc/nagios/objects/devices/inngates'...
Processing object config file '/etc/nagios/objects/devices/inngates/ant_berk.cfg'...
Processing object config file '/etc/nagios/objects/devices/inngates/ant_bent.cfg'...
Processing object config file '/etc/nagios/objects/devices/inngates/ant_amcourt.cfg'...
Processing object config file '/etc/nagios/objects/devices/inngates/ant_mar.cfg'...
Processing object config file '/etc/nagios/objects/devices/inngates/ant_amer.cfg'...
Processing object config file '/etc/nagios/objects/devices/inngates/ant_emp.cfg'...
Processing object config file '/etc/nagios/objects/devices/inngates/ant_mod.cfg'...
Processing object config directory '/etc/nagios/objects/devices/sonicwalls'...
Processing object config file '/etc/nagios/objects/devices/sonicwalls/sw_berk.cfg'...
Processing object config file '/etc/nagios/objects/devices/sonicwalls/sw_mod.cfg'...
Processing object config file '/etc/nagios/objects/devices/sonicwalls/sw_emp.cfg'...
Processing object config file '/etc/nagios/objects/devices/sonicwalls/sw_mar.cfg'...
Processing object config file '/etc/nagios/objects/devices/sonicwalls/sw_amer.cfg'...
Processing object config file '/etc/nagios/objects/devices/sonicwalls/sw_corp.cfg'...
Processing object config file '/etc/nagios/objects/devices/sonicwalls/sw_bent.cfg'...
Warning: Duplicate definition found for service 'C:\ Drive Space' on host 'ahgserver2003' (config file '/etc/nagios/objects/computers/corporate/ahgserver2.cfg', starting on line 10)
Read object config files okay...

Running pre-flight check on configuration data...

Checking services...
Checked 163 services.
Checking hosts...
Error: 'AH-AMCourt' is not a valid parent for host 'AMCourt innGate'!
Error: 'AH-AMCourt' is not a valid parent for host 'Amsterdam Court'!
Checked 27 hosts.
Checking host groups...
Checked 6 host groups.
Checking service groups...
Checked 2 service groups.
Checking contacts...
Checked 2 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 32 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 26 commands.
Checking time periods...
Checked 6 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 2

***> One or more problems was encountered while running the pre-flight check...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
What do I make of this please help?


I fixed it by copying another sonicwall .cfg file because I luckilly remembered the settings.
Last edited by billperrotta on Fri Mar 14, 2014 7:44 am, edited 1 time in total.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: mv .cfg for switch I don't want to monitor crashes Nagio

Post by sreinhardt »

Looks like:
Error: 'AH-AMCourt' is not a valid parent for host 'AMCourt innGate'!
Error: 'AH-AMCourt' is not a valid parent for host 'Amsterdam Court'!
Are the only errors you are seeing, was AH-AMCourt part of the config that was removed?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
billperrotta
Posts: 115
Joined: Fri Feb 21, 2014 11:44 am

Re: mv .cfg for switch I don't want to monitor crashes Nagio

Post by billperrotta »

yes sort of tried to recreated it before. but redeleted it when it still failed to start. need suggestions.

I inherited this configuratation. I did not stop nagios before attempting to move the file.

didn't think about it because with copying to make another host it worked and didn't break it.

Now I'm pretty much stuck after getting it working perfectly.

i used mv sw_amct.cfg /etc/disabled objects. did ls in directory. it was 86ed instead of moved.

yes each node has its own .cfg file all in sonicwalls folder.

This file sw_amct.cfg stands for sonicwall. my goal was to just remove the sonicwall node but it broke everything, and
now nagios won't start. i've tried cp sw_amerit.cfg sw_amct.cfg and edit config to try and match the old one but services still won't start.


It was pointed at AH-Amcourt but the file was really sw_amct.cfg which stands for sonicwall.
I wish I knew where to disable a check for it the file was 86ed to there is no way to get it back.


I

Yes those are the only two errors. Please help me fix it!!! :(

I was trying to get rid of the file that monitored ah-amcourt ip 184.75.56.142. it was in the sw_amct.cfg file.
is there a way to recreate it to fix nagios or is there some way I can tell nagios not to look for it?

Please when it was working I loved using it. Now I'm going to have to consider another solution.


fixed it by copying a template of another Sonicwall because luckilly I remembered the Config. 8-)
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: mv .cfg for switch I don't want to monitor crashes Nagio

Post by sreinhardt »

By far the simplest route to correct this will be to just remove the invalid parent settings on 'Amsterdam Court' and 'AMCourt innGate'. This should allow nagios to start without issue. Then you can begin rewriting the config that was removed. I would also note, that while its not recommended, moving\removing configs while nagios is running shouldn't cause an issue, as it only loads them in on startup and uses objects.cache from there, freeing you to modify the flat file configs as you need.

As for your mv command, doing "mv /path/to/file.cfg /path/to/store" will actually rename file.cfg to store and attempt to make the folder into a file, which likely will fail. If you are going to move into a directory and not specify a name, you need to be sure to include a trailing / such as: "mv /path/to/file.cfg /path/to/store/"
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
billperrotta
Posts: 115
Joined: Fri Feb 21, 2014 11:44 am

Re: mv .cfg for switch I don't want to monitor crashes Nagio

Post by billperrotta »

Can you go into a better explanation on removing settings from parent.

I am considering making an image of this server a must before trying again.

those other files most likely call this file? I most likely need to # comment the lines out?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: mv .cfg for switch I don't want to monitor crashes Nagio

Post by slansing »

Well, you could comment them out, yes, however that is probably not the best approach. The best approach would be to actually go into your configurations and properly remove the dependencies then re-verify your configurations as you did above, and then restart nagios. This will just serve to keep your configurations cleaner.
billperrotta
Posts: 115
Joined: Fri Feb 21, 2014 11:44 am

Re: mv .cfg for switch I don't want to monitor crashes Nagio

Post by billperrotta »

Not to sound stupid. But can you elaborate on what those configuration files are.

Adding a node is so easy.

trying to remove one scares me that I might crash Nagios.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: mv .cfg for switch I don't want to monitor crashes Nagio

Post by slansing »

Sure, so you need to find the services, or the hosts that are dependent on others, and they should be located somewhere in the directory tree you created:

Code: Select all

/etc/nagios/objects/
I can't say for sure where, since there are a number of subdirectories that you have created, but you will eventually find the .cfg files you created for this switch (as an example).

If you created actual dependencies you will see lines similar to:

Code: Select all

define servicedependency{
	dependent_host_name	host_name
	dependent_hostgroup_name	hostgroup_name
	dependent_service_description	service_description
	host_name	host_name
	hostgroup_name	hostgroup_name
	service_description	service_description
	inherits_parent	[0/1]
	execution_failure_criteria	[o,w,u,c,p,n]
	notification_failure_criteria	[o,w,u,c,p,n]
	dependency_period	timeperiod_name
   	}
You can either comment these lines out, or remove them completely, just be sure to verify what you are removing is actually assigned to the host/service you are trying to effect.

If you simply set up parent - child relationships you should see lines in the actual service/host config files similar to:

Code: Select all

parents	host_names
Which once again, can be commented out, or removed. Then, re-verify your configurations with the command you ran a bit earlier, be sure there are no errors, and restart nagios.
billperrotta
Posts: 115
Joined: Fri Feb 21, 2014 11:44 am

Re: mv .cfg for switch I don't want to monitor crashes Nagio

Post by billperrotta »

I don't want to remove the parent but I don't want it calling the child object that I remove the .cfg for.
If I ever get a chance to clone the nagios box by friday I will try again. I have to vi all cfg files to look for these
statements because I wasn't the one who set it up.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: mv .cfg for switch I don't want to monitor crashes Nagio

Post by sreinhardt »

Well you certainly don't want to remove the entire parent configuration, just the line that has a bad parent relationship(presumably for the removed config file 'AH-AMCourt') in the two configurations mentioned. Probably the easiest route is to grep for the names, then only look at those files.

Code: Select all

grep -R 'AMCourt innGate' /etc/nagios/objects/* | grep -i 'host_name'
grep -R 'Amsterdam Court' /etc/nagios/objects/* | grep -i 'host_name'
This should hopefully leave you with a much smaller and exact list of files that contain those two hosts, that you then need to look for a line like:

Code: Select all

parents AH-AMCourt
and comment out with a # or preferably remove entirely until you recreate that host.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked