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

Cannot remove "winserver" from Host Detail

Post by Cyber Saiyan »

I am having an issue after installing Core 4 on Ubuntu 15.x.

I followed the install guide by Unixmen (http://www.unixmen.com/install-configur ... 4-1014-04/). I have all of my windows server config files under the /usr/local/nagios/etc/objects, each in their own CFG file; and added the path of each CFG file to /usr/local/nagios/etc/nagios.cfg; everything is working great.

The issue I have is that I have one extra server named winserv hanging out in my server list on the Host Detail page. I know where it is coming from, but I cannot figure out how to remove it. This is coming from the windows.cfg file inside the objects folder where all my other config files are, but if I remove this file and remove the line entry from nagios.cfg, the nagios service fails to start up. Here is the contents of the file:

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
}


I have commented out everything that I can without the service crashing, but I cannot get this machine off the monitoring page. I don't want to monitor the NSClient++ service, nor do I even want this machine on the monitoring page. Here is the verbose output from the sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg test:


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: Invalid max_check_attempts value for host 'xxxxxxxxx'
Error: Could not register host (config file '/usr/local/nagios/etc/objects/xxxxxxxxxx.cfg', starting on 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.

administrator@Nagios:/usr/local/nagios/etc/objects$


I think this windows.cfg file is a template for other parts of Nagios Core 4 but I am not sure. How can I remove this entry?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Cannot remove "winserver" from Host Detail

Post by tgriep »

The file that is causing the error is missing the setting for

Code: Select all

 max_check_attempts
You can either set that up manually or add a template to that host/service that has the max_check_attempts defined.
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 »

max_check_attempts is defined in the TEMPLATES.CFG file, which is uncommented in NAGIOS.CFG:

Nagios.cfg:
# You can specify individual object config files as shown below:
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg

Templates.cfg:

define host{
name windows-server ; The name of this host template
use generic-host ; Inherit default values from the generic-host template
check_period 24x7 ; By default, Windows servers are monitored round the clock
check_interval 5 ; Actively check the server every 5 minutes
retry_interval 1 ; Schedule host check retries at 1 minute intervals
max_check_attempts 10 ; Check each server 10 times (max)
check_command check-host-alive ; Default command to check if servers are "alive"
notification_period 24x7 ; Send notification out at any time - day or night
notification_interval 30 ; Resend notifications every 30 minutes
notification_options d,r ; Only send notifications for specific host states
contact_groups admins ; Notifications get sent to the admins by default
hostgroups windows-servers ; Host groups that Windows servers should be a member of
register 0 ; DONT REGISTER THIS - ITS JUST A TEMPLATE
}




I tried to add it in to the individual server's config file:

define host{
use windows-server ; Inherit default values from a template
host_name (I REMOVED THIS) ; The name we're giving to this host
alias My Windows Server ; A longer name associated with the host
max_check_attempts 10 ; Check each server 10 times (max)
address (I REMOVED THIS) ; IP address of the host
}

This did not work either............
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Cannot remove "winserver" from Host Detail

Post by ssax »

If adding it to the individual server's config file didn't work, it must be defined elsewhere, check with this command:

Code: Select all

grep -R "YOUR_SERVER_NAME" /usr/local/nagios/etc
Cyber Saiyan
Posts: 14
Joined: Mon Jun 15, 2015 7:01 am

Re: Cannot remove "winserver" from Host Detail

Post by Cyber Saiyan »

The only results when grepping for the sever name is the SERVERNAME.cfg file inside of /usr/local/nagios/etc/objects

There are a few .SAVE files as backups but nothing other than that.

I also grepped for max_check_attempts and it is defined in the templates.cfg file (like I THINK it should be).

administrator@Nagios:/usr/local/nagios/etc$ sudo grep -R "max_check_attempts" /usr/local/nagios/etc
/usr/local/nagios/etc/servers/client.cfg: max_check_attempts 5
/usr/local/nagios/etc/servers/client.cfg.save:max_check_attempts 5
/usr/local/nagios/etc/objects/templates.cfg~: max_check_attempts 10 ; Check each Linux host 10 times (max)
/usr/local/nagios/etc/objects/templates.cfg~: max_check_attempts 10 ; Check each server 10 times (max)
/usr/local/nagios/etc/objects/templates.cfg~: max_check_attempts 10 ; Check each printer 10 times (max)
/usr/local/nagios/etc/objects/templates.cfg~: max_check_attempts 10 ; Check each switch 10 times (max)
/usr/local/nagios/etc/objects/templates.cfg~: max_check_attempts 3 ; Re-check the service up to 3 times in order to determine its final (hard) state
/usr/local/nagios/etc/objects/templates.cfg~: max_check_attempts 4 ; Re-check the service up to 4 times in order to determine its final (hard) state
/usr/local/nagios/etc/objects/xxxxxxxxx.cfg: max_check_attempts 10 ; Check each server 10 times (max)
/usr/local/nagios/etc/objects/templates.cfg: max_check_attempts 10 ; Check each Linux host 10 times (max)
/usr/local/nagios/etc/objects/templates.cfg:# max_check_attempts 10 ; Check each server 10 times (max)
/usr/local/nagios/etc/objects/templates.cfg: max_check_attempts 10 ; Check each printer 10 times (max)
/usr/local/nagios/etc/objects/templates.cfg: max_check_attempts 10 ; Check each switch 10 times (max)
/usr/local/nagios/etc/objects/templates.cfg: max_check_attempts 3 ; Re-check the service up to 3 times in order to determine its final (hard) state
/usr/local/nagios/etc/objects/templates.cfg: max_check_attempts 4 ; Re-check the service up to 4 times in order to determine its final (hard) state
/usr/local/nagios/etc/objects/xxxxx_orig.cfg: max_check_attempts 10 ; Check each server 10 times (max)


Is there any way to simply start the nagios service successfully without the windows.cfg line inside of /usr/local/nagios/etc/nagios.cfg file?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Cannot remove "winserver" from Host Detail

Post by ssax »

Please zip up your /usr/local/nagios/etc directory and PM it to me, I will look it over and find the solution for you.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Cannot remove "winserver" from Host Detail

Post by ssax »

Also, yes you can edit your /usr/local/nagios/etc/nagios.cfg and change:

Code: Select all

cfg_file=/usr/local/nagios/etc/objects/windows.cfg
To:

Code: Select all

#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
Then it won't process that file.
Cyber Saiyan
Posts: 14
Joined: Mon Jun 15, 2015 7:01 am

Re: Cannot remove "winserver" from Host Detail

Post by Cyber Saiyan »

I have tried that already but the Nagios service fails to start with that specific line commented out. I will try again in the morning and post the verbose output from the logs.

Thanks for the continued effort.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Cannot remove "winserver" from Host Detail

Post by lmiltchev »

I have tried that already but the Nagios service fails to start with that specific line commented out. I will try again in the morning and post the verbose output from the logs.
Run the following command and show us the output:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Note: Modify this command if paths are different on your system.

As ssax said, you can zip up your /usr/local/nagios/etc directory and PM it to any of us (on the Nagios support tech team). Thanks!
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 »

lmiltchev has reviewed the dir structure and did not get any errors during startup as is. The config included on that specific settings does not give me any issues either, but when I comment out the windows.cfg line inside of nagios.cfg is where it complains. I have an additional "winserv" machine hanging out on my host page that comes from the windows.cfg file.

I guess that I can remove one of the machines config file (domaincontroller.cfg) and use the windows.cfg file to monitor that specific machine to get rid of the "winserv" machine, but don't like that all machines have their own config files except for this one.

Unless someone can find a solution for me in the next day or two, I don't think its worth keeping open for a simple annoyance on my end.
Locked