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

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

Post by billperrotta »

Not sure what the proper way to get rid of a switch I don't want to currently monitor but perhaps reenable to monitor later.
When I did a rename of " mv sw_amct.cfg sw_amct.bak" Nagios crashes so I renamed it back. Is it that only .cfg files can live under /objects/devices/sonicwalls.

Im assuming moving the file to a location that has nothing to do with nagios will remove the monitoring of it without crashing nagios?

or is there an extension I can rename it to to deactivate it? or is there some other way to do this?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

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

Post by lmiltchev »

You can comment the out the "sw_amct.cfg" in the nagios.cfg file, for example:

Code: Select all

# cfg_file=/usr/local/nagios/etc/objects/devices/sonicwalls/sw_amct.cfg
...depending on how you defined it.
Be sure to check out our Knowledgebase for helpful articles and 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 »

Doesn't seem possible because he defined all directories cfg_dir=/etc/nagios/devices

and under that is subdirectory sonicwalls and a .cfg for each sonicwall.

in my experience so far copying one and changing parameters lets me add a device of the same type.

renaming it crashes nagios. would moving it somewhere unrelated remove it from my monitoring grid and everything else still work?

I inherited this setup.

Or it just dawned on me do I add a similar statement to the one you just mentioned to nagios.cfg? That probably wouldn't work unless there was some kind of ignore statement?

To make it clear no such statement exists and I cannot comment out the whole devices directory.
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 »

You should create a folder(s) for disabled configs, and move them there. Do not include this in the nagios.cfg file. This way you can keep old or not needed configs for future reference without causing nagios issues. However yest you really should only keep .cfg files in any directory that nagios.cfg references as a config dir.
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 »

I accidentally 86ed the file instead of copying it to /etc/disabled objects and now my nagios is down and won't start.


Helllllp Please!!!!

I used mv to that path but the file disappeared can't copy it back.

I'm getting "Job for nagios.service failed. See 'systemctl status nagios.service' and 'journalctl -n' for details."

when typing nagios stop start or restart
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 »

Did you try to move it (but removed it) when nagios was running?:

Code: Select all

service nagios stop

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
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 »

maybe just please help me get nagios running
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

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

Post by tmcdonald »

billperrotta wrote:maybe just please help me get nagios running
That is what we are trying to do. "maybe" does not help us. We need you to run the commands slansing posted and provide us with the output.
Former Nagios employee
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 »

my nagios directory is /etc/nagios/objects then subdirectories. I am a little confused sorry
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 »

Then you will need to alter the above verification command to your nagios bin location, and your nagios cfg location, just don't forget the "-v" for verification.
Locked