2

I've just started configuring Nagios from scratch, and I'm new at this.

I've been getting this error after adding objects/printer.cfg

Error: Could not find any hostgroup matching 'allhosts'
(config file '/etc/nagios3/objects/printer.cfg', starting on line 1)    
Error processing object config files!

And this is the content of the printer.cfg

define host{
        use             generic-host            ; Inherit default values from a template    
        host_name       Printer_klen    ; The name we're giving to this printer    
        alias           Printer_klen    ; A longer name associated with the printer    
        address         10.1.0.45       ; IP address of the printer    
        hostgroups      allhosts        ; Host groups this printer is associated with    
        }

define service{    
        use                     generic-service         ; Inherit values from a template    
        host_name               Printer_klen            ; The name of the host the service is associated with    
        service_description     Printer Status          ; The service description    
        check_command           check_Printer_klen!-C public    ; The command used to monitor the service    
        normal_check_interval   10      ; Check the service every 10 minutes under normal conditions    
        retry_check_interval    1       ; Re-check the service every minute until its final/hard state is determined    
        }

define service{    
        use                     generic-service    
        host_name               Printer_klen    
        service_description     PING    
        check_command           check_ping!3000.0,80%!5000.0,100%    
        normal_check_interval   10    
        retry_check_interval    1    
        }
slm
  • 363,520
  • 117
  • 767
  • 871
Rene
  • 179
  • 2
  • 9

1 Answers1

2

The problem

The error is actually pretty self explanatory.

Error: Could not find any hostgroup matching 'allhosts'

You have this line in your define host{...} block:

hostgroups      allhosts        ; Host groups this printer is associated with

Solution

You need to create a hostgroup called allhosts.

In the file /etc/nagios/hostgroups.cfg, most likely, you'll need to add a stanza that defines the hostgroup, allhosts.

Example

define hostgroup{
    hostgroup_name          allhosts
    alias               All Hosts
}
slm
  • 363,520
  • 117
  • 767
  • 871
  • I've just installed Nagios 3 days ago, and I've been looking at the documentation - but I got stuck on this part. Anyway thank you for taking the time to answer this! – Rene Nov 11 '13 at 08:52
  • 1
    @ReneBrakus - You're welcome. Yes I've been using Nagios for 10+ years, it's extremely powerful but takes a fair amount of time to learn and grok. Good luck! – slm Nov 11 '13 at 13:50