problem with using "hostgroup_name" in service definitions: Error: Hostgroup name and/or alias is NULL

Joost van Baal j.e.vanbaal+nagios-users at uvt.nl
Fri Feb 8 17:06:12 CET 2008


Hi,

Is it possible at all to _not_ have an explicit object (with it's own
"define") in the nagios configuration for the number of hosts times the
number of services on each such host?

I assume it _is_ possible, using "hostgroup_name" in service definitions
(I've seen it documented on
http://nagios.sourceforge.net/docs/2_0/templatetricks.html#service ).

However, when I do:

 define service {
        hostgroup_name                  load-cat3-unix-hostgroup
        check_command                   check_nrpe!check_load
[...]
 }

 define service {
        hostgroup_name                  ssh-cat3-unix-hostgroup
        check_command                   check_ssh
[...]
 }

 define host {
        name                            cat3-unix-host
        hostgroups                      [...], load-cat3-unix-hostgroup, ssh-cat3-unix-hostgroup
[...]
 }

 define host {
        host_name                       radix
[...]
        use                             cat3-unix-host
 }

nagios -v gives:

 Error: Hostgroup name and/or alias is NULL
 Error: Could not register hostgroup

How should I use the hostgroup_name-trick in a service-definition?


Below is a more complete story of the setup we're using, giving more
details.  If even more details are needed, I'll happily supply them.

At our site, we're upgrading our monitoring-server from Nagios1 to
Nagios2 (and from Debian sarge to Debian etch).  In the process, we'd
like to trim our unwieldy Nagios configuration (it's > 400 K currently,
we're monitoring > 500 hosts).

Here are some relevant bits of our proposed configuration:

/etc/nagios2-test/nagios.cfg :

 [...]
 cfg_file=/etc/nagios2-test/contactgroups.cfg
 cfg_file=/etc/nagios2-test/contacts.cfg
 cfg_file=/etc/nagios2-test/hostgroups.cfg
 cfg_file=/etc/nagios2-test/head_hosts.cfg
 cfg_file=/etc/nagios2-test/unix_hosts.cfg
 cfg_file=/etc/nagios2-test/head_services.cfg
 cfg_file=/etc/nagios2-test/unix_services.cfg
 [...]


/etc/nagios2-test/hostgroups.cfg :

 define hostgroup {
        hostgroup_name  disk-cat3-unix-hostgroup
 }

 define hostgroup {
        hostgroup_name  load-cat3-unix-hostgroup
 }

 define hostgroup {
        hostgroup_name  ssh-cat3-unix-hostgroup
 }


/etc/nagios2-test/head_hosts.cfg :

 define host {
        name                            lean-host
        notifications_enabled           1
        event_handler_enabled           1
        flap_detection_enabled          1
        process_perf_data               1
        retain_status_information       1
        retain_nonstatus_information    1
        max_check_attempts              10
        check_command                   check-host-alive
        max_check_attempts              5
        check_period                    24x7
        register                        0
 }

 define host {
        name                            cat3-unix-host
        hostgroups                      disk-cat3-unix-hostgroup, load-cat3-unix-hostgroup, ssh-cat3-unix-hostgroup
        use                             lean-host
        notification_interval           720
        notification_period             workhours
        notification_options            d,u,r
        contact_groups                  categorie3-unix-admins
        register                        0
 }


/etc/nagios2-test/unix_hosts.cfg :

 define host {
        alias                           radix
        host_name                       radix
        address                         10.1.2.3

        use                             cat3-unix-host
 }

/etc/nagios2-test/head_services.cfg :

 [...]

 define service {
        name                            categorie3-service
        use                             generic-service
 [...]
        contact_groups                  categorie3-unix-admins
        register                        0
 }


/etc/nagios2-test/unix_services.cfg :

 define service {
        hostgroup_name                  disk-cat3-unix-hostgroup
        name                            disk-cat3-unix-service
        service_description             Disk Categorie 3
        check_command                   check_nrpe!check_disk
        use                             categorie3-service
 }

 define service {
        hostgroup_name                  load-cat3-unix-hostgroup
        name                            load-cat3-unix-service
        service_description             Load Categorie 3
        check_command                   check_nrpe!check_load
        use                             categorie3-service
 }

 define service {
        hostgroup_name                  ssh-cat3-unix-hostgroup
        name                            ssh-cat3-unix-service
        service_description             SSH Categorie 3
        check_command                   check_ssh
        use                             categorie3-service
 }


With this configuration, running

 joostvb at infix:~% /usr/sbin/nagios2 -v /etc/nagios2-test/nagios.cfg

gives

 Nagios 2.6
 Copyright (c) 1999-2006 Ethan Galstad (http://www.nagios.org)
 Last Modified: 11-27-2006
 License: GPL
 Reading configuration data...
 Error: Hostgroup name and/or alias is NULL
 Error: Could not register hostgroup (config file '/etc/nagios2-test/hostgroups.cfg', starting on line 2)
 ***> One or more problems was encountered while processing the config files...

We're using the nagios2 Debian package version 2.6-2+etch1 as shipped
with Debian GNU/Linux etch.

Any clues or hints on how to tackle this problem would be very much
appreciated.

Thanks, Bye,

Joost

-- 
Joost van Baal                            http://abramowitz.uvt.nl/
                                                 Tilburg University
mailto:joostvb.uvt.nl                               The Netherlands

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
URL: <https://www.monitoring-lists.org/archive/users/attachments/20080208/9457d389/attachment.sig>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list