Page 2 of 2

Re: Cannot remove "winserver" from Host Detail

Posted: Wed Jun 17, 2015 10:09 am
by abrist
If you just comment out the host and related service from the config, does that solve your woes?

Code: Select all

#define host{
#use windows-server ; Inherit default values from a template
#host_name winserver ; The name we're giving to this host
#alias My Windows Server ; A longer name associated with the host
#address xxx.xxx.xxx.xxx ; IP address of the host
#}



define hostgroup{
hostgroup_name windows-servers ; The name of the hostgroup
alias Windows Servers ; Long name of the group
}

#define service{
#use generic-service
#host_name winserver
#service_description NSClient++ Version
#check_command check_nt!CLIENTVERSION
#}

Re: Cannot remove "winserver" from Host Detail

Posted: Wed Jun 17, 2015 10:17 am
by Cyber Saiyan
Negative, if I comment out anything INSIDE the windows.cfg file, nagios service fails to start:

administrator@Nagios:~$ sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.1.0rc1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 02-18-2015
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Could not find any host matching 'winserver' (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 66)
Error: Failed to expand host list 'winserver' for service 'NSClient++ Version' (/usr/local/nagios/etc/objects/windows.cfg:66)
Error processing object config files!


***> One or more problems was encountered while processing the config files...

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.

administrator@Nagios:~$





Likewise, if I comment out the entry for the windows.cfg INSIDE of the nagios.cfg file, it does the same.

Re: Cannot remove "winserver" from Host Detail

Posted: Wed Jun 17, 2015 2:24 pm
by tgriep
Could you run the following and post the output?

Code: Select all

cd /usr/local/nagios/etc
grep -R -i winserver *

Re: Cannot remove "winserver" from Host Detail

Posted: Wed Jun 17, 2015 3:40 pm
by Cyber Saiyan
administrator@Nagios:/usr/local/nagios/etc$ sudo grep -R -i winserver *
objects/windows.cfg: host_name winserver ; The name we're giving to this host
objects/windows.cfg: host_name winserver
objects/windows.cfg:# host_name winserver
objects/windows.cfg:# host_name winserver
objects/windows.cfg:# host_name winserver
objects/windows.cfg:# host_name winserver
objects/windows.cfg:# host_name winserver
objects/windows.cfg:# host_name winserver
objects/windows.cfg.save:# host_name winserver ; The name we're giving to this host
objects/windows.cfg.save: host_name winserver
objects/windows.cfg.save:# host_name winserver
objects/windows.cfg.save:# host_name winserver
objects/windows.cfg.save:# host_name winserver
objects/windows.cfg.save:# host_name winserver
objects/windows.cfg.save:# host_name winserver
objects/windows.cfg.save:# host_name winserver
objects/windows.cfg~: host_name winserver ; The name we're giving to this host
objects/windows.cfg~: host_name winserver
objects/windows.cfg~: host_name winserver
objects/windows.cfg~: host_name winserver
objects/windows.cfg~: host_name winserver
objects/windows.cfg~: host_name winserver
objects/windows.cfg~: host_name winserver
objects/windows.cfg~: host_name winserver

Re: Cannot remove "winserver" from Host Detail

Posted: Wed Jun 17, 2015 4:18 pm
by tgriep
Stop the nagios process by running the following

Code: Select all

service nagios stop
killall nagios
Edit the nagios.cfg file and comment out or delete the following line

Code: Select all

 cfg_file=/usr/local/nagios/etc/objects/windows.cfg
Run the check

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If it is error free, start the nagios process

Code: Select all

service nagios start

Re: Cannot remove "winserver" from Host Detail

Posted: Thu Jun 18, 2015 7:56 am
by Cyber Saiyan
administrator@Nagios:~$ sudo service nagios stop
[sudo] password for administrator:

administrator@Nagios:~$ killall nagios
nagios: no process found

administrator@Nagios:~$




# Definitions for monitoring the local (Linux) host
# cfg_file=/usr/local/nagios/etc/objects/localhost.cfg

# Definitions for monitoring a Windows machine
# cfg_file=/usr/local/nagios/etc/objects/windows.cfg <-------- just commented out

# Definitions for monitoring a router/switch
#cfg_file=/usr/local/nagios/etc/objects/switch.cfg

# Definitions for monitoring a network printer
#cfg_file=/usr/local/nagios/etc/objects/printer.cfg





Nagios service fails to start;

administrator@Nagios:~$ sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.1.0rc1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 02-18-2015
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Error: Could not find any hostgroup matching 'windows-servers' (config file '/usr/local/nagios/etc/objects/xxxxxxxx.cfg', starting on line 4)
Error: Failed to process hostgroup names for host 'xxxxxxxxxx' (config file '/usr/local/nagios/etc/objects/xxxxxxxxx.cfg', starting at line 4)
Error processing object config files!


***> One or more problems was encountered while processing the config files...

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.

Re: Cannot remove "winserver" from Host Detail

Posted: Thu Jun 18, 2015 7:58 am
by Cyber Saiyan
Here is the output if windows.cfg is included in nagios.cfg:

administrator@Nagios:~$ sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.1.0rc1
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 02-18-2015
License: GPL

Website: http://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 1 services.
Checked 25 hosts.
Checked 1 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 24 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 25 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 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
administrator@Nagios:~$

Re: Cannot remove "winserver" from Host Detail

Posted: Thu Jun 18, 2015 12:40 pm
by ssax
So it looks like the hostgroup windows-servers is defined in your windows.cfg?

This file (/usr/local/nagios/etc/objects/xxxxxxxx.cfg) has a host that is referencing the windows-server hostgroup, that hostgroup needs to be defined somewhere (like /usr/local/nagios/etc/objects/hostgroups.cfg).

Re: Cannot remove "winserver" from Host Detail

Posted: Thu Jun 18, 2015 12:42 pm
by ssax
Make sure that it's included in your nagios.cfg

Code: Select all

cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg