nagios core 4.4.5 error defining host

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Hoygen83
Posts: 16
Joined: Mon Oct 28, 2019 10:30 am

nagios core 4.4.5 error defining host

Post by Hoygen83 »

hello, I have nagios core 4.4.5
i have the templates.cfg file with this definition of generic-host

define host {

name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
notification_period 24x7 ; Send host notifications at any time
register 0 ; DON'T REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A$
}

I just made two config files.

hg-nas.cfg

define hostgroup{
hostgroup_name NAS
alias NETWORK DRIVE
}

recserver.cfg

define host {
use generic_host ;template
host_name name-of-nas ; The name we're giving to this host
alias Qnap network drive ; A longer name associated with the host
address the-ip-address ; IP address of the host
hostgroups NAS ; Host groups this host is associated with
}

If I issue: service nagios restart, i get errors.

Error: Could not register host (config file '/usr/local/nagios/etc/hosts/recserver.cfg', starting on line 1)

What's wrong in that file?
If I remove recserver.cfg and restart nagios service everything is fine.
I don't understand or perhaps I need a better knowledge of nagios.
playzoneuk
Posts: 4
Joined: Thu Nov 28, 2019 9:27 am

Re: nagios core 4.4.5 error defining host

Post by playzoneuk »

In your recserver.cfg file you've declared:

use generic_host

when it should be:

use generic-host
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: nagios core 4.4.5 error defining host

Post by scottwilkerson »

playzoneuk wrote:In your recserver.cfg file you've declared:

use generic_host

when it should be:

use generic-host
Thanks @playzoneuk!
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Hoygen83
Posts: 16
Joined: Mon Oct 28, 2019 10:30 am

Re: nagios core 4.4.5 error defining host

Post by Hoygen83 »

thanks

but now i get

Error: Invalid max_check_attempts value for host 'RECSERVER'
Error: Could not register host (config file '/usr/local/nagios/etc/hosts/recserver.cfg', starting on line 1)
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 definitions. 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.


the file that should represent the host is now: /usr/local/nagios/etc/hosts/recserver.cfg

define host {
use generic-host ;template
host_name RECSERVER ; The name we're giving to this host
alias Qnap su cui salvano le videocamere ; A longer name associated with the host
address 10.100.0.17 ; IP address of the host
hostgroups NAS ; Host groups this host is associated with
}

I'm sure I'm doing something wrong in my recserver.cfg file because every time I write it and restart nagios service I get errors.
But how can I define a host that uses the generic-host template and is part of hostgroup NAS without having errors?
Reading around It seems that now I've written it well.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: nagios core 4.4.5 error defining host

Post by scottwilkerson »

Change this

Code: Select all

define host {

name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
notification_period 24x7 ; Send host notifications at any time
register 0 ; DON'T REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A$
}
max_check_attempts 5
check_interval 10
retry_interval 1

to this

Code: Select all

define host {

name generic-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
notification_period 24x7 ; Send host notifications at any time
max_check_attempts       5
check_interval           5
retry_interval           1
register 0 ; DON'T REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A$
}
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Hoygen83
Posts: 16
Joined: Mon Oct 28, 2019 10:30 am

Re: nagios core 4.4.5 error defining host

Post by Hoygen83 »

thank you very much.
it's working now.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: nagios core 4.4.5 error defining host

Post by scottwilkerson »

Hoygen83 wrote:thank you very much.
it's working now.
Great!

Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked