Page 1 of 1

How to add additional windows host to nagios?

Posted: Sat Dec 11, 2010 10:21 pm
by albie17
Hi Nagios,
I'm running Nagios 3.2.3 and CentOS 5.5. I'm wondering if what is the proper configuration to add a additional windows server host to my Nagios Server. I've already configured my *first* windows client to nagios using NSClient++, now I want to add another windows host to Nagios how it can be done? Thanks

Best Regards,
Albie17

Re: How to add additional windows host to nagios?

Posted: Tue Dec 14, 2010 11:01 am
by tonyyarusso
Pretty much the same was as the first one - just change the name and IP address. You can either put the configuration in the same file as the previous one, or a new one - Nagios doesn't care.

Re: How to add additional windows host to nagios?

Posted: Tue Jan 11, 2011 7:56 am
by umer_javed
tonyyarusso wrote:Pretty much the same was as the first one - just change the name and IP address. You can either put the configuration in the same file as the previous one, or a new one - Nagios doesn't care.
I though the same way you explained but naigos do care about it and generates an error message, let me put it this way it doesn't work by using the same file or creating a and defining new file into nagios.cfg.

but i will appreciate if any help in this regards, coz i'm new to nagios and keen to explore its usability.

Re: How to add additional windows host to nagios?

Posted: Tue Jan 11, 2011 10:06 am
by mguthrie
Can you post the config and the error message that you're getting when you check your config files?

Re: How to add additional windows host to nagios?

Posted: Wed Jan 12, 2011 2:19 am
by umer_javed
Here are the parameters from /usr/local/nagios/ets/nagios.cfg

# 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
cfg_file=/usr/local/nagios/etc/objects/bdc.cfg

here bdc is my backup domain controller primary is monitored and showing results according to my requirement.

down here is the output of my /usr/local/nagios/etc/objects/bdc.cfg

Code: Select all

###############################################################################
# BDC.CFG - SAMPLE CONFIG FILE FOR MONITORING A WINDOWS MACHINE
#
# Last Modified: 06-13-2007
#
# NOTES: This config file assumes that you are using the sample configuration
#        files that get installed with the Nagios quickstart guide.
#
###############################################################################




###############################################################################
###############################################################################
#
# HOST DEFINITIONS
#
###############################################################################
###############################################################################

# Define a host for the Windows machine we'll be monitoring
# Change the host_name, alias, and address to fit your situation

define host{
        use             windows-server  ; Inherit default values from a template
        host_name       BDC-AD  ; The name we're giving to this host
        alias           Backup Domain Controller        ; A longer name associated with the host
        address         192.168.10.24   ; IP address of the host
        }




###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#
###############################################################################
###############################################################################


# Define a hostgroup for Windows machines
# All hosts that use the windows-server template will automatically be a member of this group

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




###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################


# Create a service for monitoring the version of NSCLient++ that is installed
# Change the host_name to match the name of the host you defined above

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



# Create a service for monitoring the uptime of the server
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               BDC-AD
        service_description     Uptime
        check_command           check_nt!UPTIME
        }


# Create a service for monitoring CPU load
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               BDC-AD
        service_description     CPU Load
        check_command           check_nt!CPULOAD!-l 5,80,90
        }



# Create a service for monitoring memory usage
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               BDC-AD
        service_description     Memory Usage
        check_command           check_nt!MEMUSE!-w 80 -c 90
        }



# Create a service for monitoring C:\ disk usage
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               BDC-AD
        service_description     C:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l c -w 80 -c 90
        }


# Create a service for monitoring D:\ disk usage
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               PDC-AD
        service_description     D:\ Drive Space
        check_command           check_nt!USEDDISKSPACE!-l d -w 80 -c 90
        }

# Create a service for monitoring the W3SVC service
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               BDC-AD
        service_description     W3SVC
        check_command           check_nt!SERVICESTATE!-d SHOWALL -l W3SVC
        }



# Create a service for monitoring the Explorer.exe process
# Change the host_name to match the name of the host you defined above

define service{
        use                     generic-service
        host_name               BDC-AD
        service_description     Explorer
        check_command           check_nt!PROCSTATE!-d SHOWALL -l Explorer.exe
        }



so down here are the error message of following command

service nagios restart

[root@nagios ~]# service nagios restart
Running configuration check... CONFIG ERROR!  Restart aborted.  Check your Nagios configuration.

and following is the error message when tring to verify the configuration of nagios

[root@nagios ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 3.2.3
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-03-2010
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
Processing object config file '/usr/local/nagios/etc/objects/commands.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/templates.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/localhost.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/windows.cfg'...
Processing object config file '/usr/local/nagios/etc/objects/bdc.cfg'...
Warning: Duplicate definition found for hostgroup 'windows-servers' (config file '/usr/local/nagios/etc/objects/bdc.cfg', starting on line 47)
Error: Could not add object property in file '/usr/local/nagios/etc/objects/bdc.cfg' on line 48.
   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.
I hope this informaiton will help you to sort out my problem.

Thanks in advance.

Omer

Re: How to add additional windows host to nagios?

Posted: Wed Jan 12, 2011 2:33 am
by umer_javed
This is to reply my own post which i've just posted few minutes back reason behind is that i've found the solutions in the config file i just changed the host group name and find it working.

regards,

Omer