Please review my config


#1

Hi all.

I have been banging my head against my desk trying to figure this one out. I am posting it here in the hope that someone can spot my error.

filename - /etc/nagios3/conf.d/templates/template_windows_dc.cfg

# Windows domain controller template
define hostgroup        {
                        hostgroup_name          DC
                        alias                   Domain Controllers
       }

define host             {
                        name                    domain_controller
                        use                     generic-windows
                        hostgroups              DC
                        icon_image              base/win40.png
                        icon_image_alt          MS Windows Domain Controllers
                        vrml_image              win40.png
                        statusmap_image         base/win40.gd2
                        notes_url               http://sysmon-svr/dokuwiki/doku.php?id=$HOSTNAME$

                        register                0
        }

define service          {
                        service_description     DC_services
                        display_name            DC essential services
                        use                     generic-service
                        hostgroup_name          DC
                        check_command           check_DC_services!$HOSTADDRESS$
                        notes_url               http://sysmon-svr/dokuwiki/doku.php?id=DC_services
        }

result from nagios3 -v /etc/nagios3/nagios.cfg -

sysmon-svr:/etc/nagios3# nagios3 -v nagios.cfg
Nagios 3.0.6
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 12-01-2008
License: GPL
Reading configuration data...
Error: Could not expand hostgroups and/or hosts specified in service (config file '/etc/nagios3/conf.d/templates/template_windows_dc.cfg', starting on line 22)
***> 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 have other similar templates which work…
I have tried moving the hostgroup definition to the main hostgroups file. Same error.
Also tried striping to bare minimum - Same error.
If I remove the service definition I note that nagios -v returns an extra hostgroup as desired.
If I provide the name of an existing, working hostgroup nagios -v returns no errors.

help.

Matthew.


#2

Hi

I don’t think you should include $HOSTADDRESS$ in your service definition, it should be in the check_DC_services command object, like for example

define command{ command_name check_DC_services command_line <your-path...>/check_DC_services -H $HOSTADDRESS$ }

HTH

/S


#3

[quote=“Strides”]Hi

I don’t think you should include $HOSTADDRESS$ in your service definition, it should be in the check_DC_services command object, like for example

define command{ command_name check_DC_services command_line <your-path...>/check_DC_services -H $HOSTADDRESS$ }

HTH

/S[/quote]

Agreed. - it makes the config file easier to read. I have updated the check command definition and the service definition appropriately.
However I still get the same error…

config file /etc/nagios3/conf.d/templates/template_windows_dc.cfg:

# Windows domain controllers
define hostgroup        {
                        hostgroup_name          DC
                        alias                   Domain Controllers
       }


define host             {
                        name                    domain_controller
                        use                     generic-windows
                        hostgroups              DC
                        icon_image              base/win40.png
                        icon_image_alt          MS Windows Domain Controllers
                        vrml_image              win40.png
                        statusmap_image         base/win40.gd2
                        notes_url               http://sysmon-svr/dokuwiki/doku.php?id=$HOSTNAME$

                        register                0
        }

define service          {
                        service_description     DC_services
                        display_name            DC essential services
                        use                     generic-service
                        hostgroup_name          DC
                        check_command           check_DC_services
                        notes_url               http://sysmon-svr/dokuwiki/doku.php?id=DC_services
        }

and the error, as before:

sysmon-svr:/etc/nagios3/conf.d/templates# nagios3 -v /etc/nagios3/nagios.cfg 

Nagios 3.0.6
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 12-01-2008
License: GPL

Reading configuration data...

Error: Could not expand hostgroups and/or hosts specified in service (config file '/etc/nagios3/conf.d/templates/template_windows_dc.cfg', starting on line 22)

***> 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.

#4

OK… have you defined any hosts which use your domain_controller template? If not, I think it is causing an error trying to assign the service to the empty hostgroup. That would explain why it works when you remove the service definition, as it is no longer trying to assign any services to the empty group.

/S


#5

[quote=“Strides”]OK… have you defined any hosts which use your domain_controller template? If not, I think it is causing an error trying to assign the service to the empty hostgroup. That would explain why it works when you remove the service definition, as it is no longer trying to assign any services to the empty group.

/S[/quote]

:oops: