remove a Device via command line

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
dmrholloway
Posts: 2
Joined: Mon Sep 24, 2012 9:58 am

remove a Device via command line

Post by dmrholloway »

new to nagios, what is the command to remove a device.

No web interface
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: remove a Device via command line

Post by jsmurphy »

Nagios stores its configuration in flat files, which are by default in /usr/local/nagios/etc/ you will find a whole lot of .cfg files. Inside these files will be a whole bunch of different object definitions, you need to find the host definition and remove that. It will look something like:

define host {
host_name <my hostname>
...
}
User avatar
inventsekar
Posts: 37
Joined: Fri Jul 20, 2012 11:29 am

Re: remove a Device via command line

Post by inventsekar »

i do had the same question at first...
As said above, Nagios just uses flat files.. We can add / remove hosts from the config file and the change takes effect, restarting/reloading is nececessary when you modify your configuration files and want those changes
to take effect.
ChrisWilli
Posts: 1
Joined: Tue Dec 11, 2012 12:22 am

Re: remove a Device via command line

Post by ChrisWilli »

Hi,
i am able to remove the <hostname>.cfg file however when i restart the Nagios service i get the following error > "Configuration validation failed"

If i re-enter the <hostname>.cfg file with all the contects then the service starts again.

It must be something simple but it means i am unable to remove devices.

I am new to Nagios , so any advice would be appreciated.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: remove a Device via command line

Post by jsmurphy »

If you run a "/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg" it will tell you exactly why validation has failed. It's probably because another host object is dependent on or parented to that host. If you have trouble working it out, post the validation output :)
Locked