Error when add remote windows server

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Error when add remote windows server

Postby rafael » Fri Jul 14, 2017 1:11 am

Hello,
I'm configuring Nagios 4.x monitor remote Windows host using NSClient++.And, i got error message as blow,
Error: Template 'windows-server' specified in host definition could not be not found (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 24)
Error processing object config files!

Here is short host defination
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 172.16.201.2 ; IP address of the host
}

Here is short template
# Windows host definition template - This is NOT a real host, just a template!

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'm newbies in Nagios, hope you could help me troubleshoot. Tks
rafael
 
Posts: 4
Joined: Thu Jul 13, 2017 11:06 pm

Re: Error when add remote windows server

Postby dwhitfield » Fri Jul 14, 2017 2:07 pm

Please attach your entire windows.cfg. Also, please attach your entire nagios.cfg.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
dwhitfield
The Doctor
 
Posts: 3239
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC

Re: Error when add remote windows server

Postby rafael » Fri Jul 14, 2017 10:31 pm

Hi dwhitfield,
Please refer attached files.
One more information, I had upgraded Nagios 3.x to 4.x. But, I have never do anything since installed Nagios 3.x last year.
Thanks.
Attachments
nagios.cfg
(4.12 KiB) Downloaded 6 times
windows.cfg
(4.03 KiB) Downloaded 7 times
rafael
 
Posts: 4
Joined: Thu Jul 13, 2017 11:06 pm

Re: Error when add remote windows server

Postby tgriep » Mon Jul 17, 2017 12:17 pm

When the Nagios system starts up, it reads the configuration files in order and if you create templates, etc... they have to be defined in the nagios.cfg file before the host or service configs.
In your nagios.cfg file, the windows.cfg file is first in the list, move it to the bottom of the list and that should fix the error when starting the nagios process.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 5634
Joined: Thu Oct 30, 2014 9:02 am

Re: Error when add remote windows server

Postby rafael » Thu Jul 20, 2017 12:38 am

Hello All,
Sorry for my replying too late due to busy other jobs.
I was followed up your guide but still failure. Please refer photo and windows.cfg
Image
wha't wrong from line 24 ?
Also, I tried reinstall NSClient++ (NSCP-0.5.0.62-x64.msi). But, I did not find NSC.INI file to uncomment module as some website comment
Image

Any help, Thanks you !
Attachments
windows.cfg
(3.9 KiB) Downloaded 3 times
rafael
 
Posts: 4
Joined: Thu Jul 13, 2017 11:06 pm

Re: Error when add remote windows server

Postby mcapra » Thu Jul 20, 2017 2:38 pm

Can you share an updated copy of:
Code: Select all
/usr/local/nagios/etc/nagios.cfg
/usr/local/nagios/etc/hostTemplates.cfg


This doesn't have anything to do with NSClient++ as of right now. Your windows.cfg file is referencing the windows-server template which needs to exist somewhere. Nagios can't seem to find it as of right now.

The output of a tree run against your Nagios installation path might also be useful. If you're using Debian or Ubuntu, use apt-get instead of yum:
Code: Select all
yum install -y tree
tree /usr/local/nagios/etc
Former Nagios employee - https://github.com/mcapra/
User avatar
mcapra
 
Posts: 2561
Joined: Thu May 05, 2016 3:54 pm

Re: Error when add remote windows server

Postby tgriep » Thu Jul 20, 2017 3:35 pm

The issue is that you are using a template called windows-servers for your host called winserver that is missing and that causes the configuration error.

Try adding the following to the hosttemplates.cfg file to create the missing template.

Code: Select all
define host {
       name                                windows-server
       hostgroups                          windows-servers
       check_command                       check-host-alive
       use                                 generic-host
       max_check_attempts                  10
       check_interval                      5
       retry_interval                      1
       check_period                        24x7
       contact_groups                      admins
       notification_interval               30
       notification_period                 24x7
       notification_options                d,r
       register                          0

}


See if that resolves the configuration error.

FYI, the newer version of the NSClient++, version 4.x.x or greater, the configuration file is called nsclient.ini so that is what you would need to edit.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
 
Posts: 5634
Joined: Thu Oct 30, 2014 9:02 am

Re: Error when add remote windows server

Postby rafael » Fri Jul 21, 2017 4:24 am

Dear All,
Other error relating contact defination,
[root@fepv-ms ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.2.0
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-01-2016
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Warning: sleep_time is deprecated and will be removed.
Warning: command_check_interval is deprecated and will be removed. Commands are always handled on arrival
Warning: p1_file is deprecated and will be removed.
Read main config file okay...
Error: Contactgroup 'admins' is not defined anywhere
Error: Could not add contactgroup 'admins' to host (config file '/usr/local/nagios/etc/objects/windows.cfg', starting on line 24)
Error processing object config files!

Maybe, I need someone share "contact sample" suite my state. Also, I attached my orginal "contact and contact template" files.
In other hand, Anyone can show me whole process of Nagios, how it's work ?. For me, It's too hard too understand. To feel ashame of me.
Thank you!
Attachments
contactTemplates.cfg
(1.06 KiB) Downloaded 1 time
contacts.cfg
(1.5 KiB) Downloaded 2 times
rafael
 
Posts: 4
Joined: Thu Jul 13, 2017 11:06 pm

Re: Error when add remote windows server

Postby mcapra » Fri Jul 21, 2017 8:42 am

If you're interested in a monitoring solution for your organization, you might find Nagios XI to be a bit more accessible than Nagios Core. You can also get a free 1-hour consultation with a support technician by signing up for a Quickstart:
https://www.nagios.com/services/quickstart/

As a note, they do not offer quickstarts for Nagios Core; Just Nagios XI. It might also be worthwhile to spend some time understanding the different Nagios configuration objects:
https://assets.nagios.com/downloads/nag ... tions.html

Nagios configuration objects are the "building blocks" of how Nagios understands the infrastructure you want to monitor. Understanding them is critical in getting the most out of the software.

Here's the default Nagios Core contacts sample:

Code: Select all
###############################################################################
# CONTACTS.CFG - SAMPLE CONTACT/CONTACTGROUP DEFINITIONS
#
#
# NOTES: This config file provides you with some example contact and contact
#        group definitions that you can reference in host and service
#        definitions.
#
#        You don't need to keep these definitions in a separate file from your
#        other object definitions.  This has been done just to make things
#        easier to understand.
#
###############################################################################



###############################################################################
###############################################################################
#
# CONTACTS
#
###############################################################################
###############################################################################

# Just one contact defined by default - the Nagios admin (that's you)
# This contact definition inherits a lot of default values from the 'generic-contact'
# template which is defined elsewhere.

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           nagios@localhost        ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }



###############################################################################
###############################################################################
#
# CONTACT GROUPS
#
###############################################################################
###############################################################################

# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.

define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 nagiosadmin
        }


Though, the above contact object references the "generic-contact" template, so you will need to make sure that template exists somewhere. Here's the one I currently have:

Code: Select all
define contact{
        name                            generic-contact         ; The name of this contact template
        service_notification_period     24x7                    ; service notifications can be sent anytime
        host_notification_period        24x7                    ; host notifications can be sent anytime
        service_notification_options    w,u,c,r,f,s             ; send notifications for all service states, flapping events, and scheduled downtime events
        host_notification_options       d,u,r,f,s               ; send notifications for all host states, flapping events, and scheduled downtime events
        service_notification_commands   notify-service-by-email ; send service notifications via email
        host_notification_commands      notify-host-by-email    ; send host notifications via email
        register                        0                       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE!
        }


So you might want to add the admins contactgroup to your environment, if you intend to use it.
Former Nagios employee - https://github.com/mcapra/
User avatar
mcapra
 
Posts: 2561
Joined: Thu May 05, 2016 3:54 pm

Re: Error when add remote windows server

Postby dwhitfield » Fri Jul 21, 2017 12:21 pm

mcapra wrote:As a note, they do not offer quickstarts for Nagios Core; Just Nagios XI.


Although, for clarity, we do offer Core support contracts: https://www.nagios.com/services/nagios- ... ort-plans/
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
dwhitfield
The Doctor
 
Posts: 3239
Joined: Wed Sep 21, 2016 10:29 am
Location: Nagios Enterprises, LLC


Return to Nagios Core

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests