Cannot remove "winserver" from Host Detail

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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Cannot remove "winserver" from Host Detail

Post 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
#}
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Cyber Saiyan
Posts: 14
Joined: Mon Jun 15, 2015 7:01 am

Re: Cannot remove "winserver" from Host Detail

Post 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.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Cannot remove "winserver" from Host Detail

Post by tgriep »

Could you run the following and post the output?

Code: Select all

cd /usr/local/nagios/etc
grep -R -i winserver *
Be sure to check out our Knowledgebase for helpful articles and solutions!
Cyber Saiyan
Posts: 14
Joined: Mon Jun 15, 2015 7:01 am

Re: Cannot remove "winserver" from Host Detail

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Cannot remove "winserver" from Host Detail

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Cyber Saiyan
Posts: 14
Joined: Mon Jun 15, 2015 7:01 am

Re: Cannot remove "winserver" from Host Detail

Post 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.
Cyber Saiyan
Posts: 14
Joined: Mon Jun 15, 2015 7:01 am

Re: Cannot remove "winserver" from Host Detail

Post 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:~$
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Cannot remove "winserver" from Host Detail

Post 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).
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Cannot remove "winserver" from Host Detail

Post by ssax »

Make sure that it's included in your nagios.cfg

Code: Select all

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