Page 1 of 1

nagios core 4.4.5 error defining host

Posted: Fri Nov 29, 2019 9:08 am
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.

Re: nagios core 4.4.5 error defining host

Posted: Fri Nov 29, 2019 5:19 pm
by playzoneuk
In your recserver.cfg file you've declared:

use generic_host

when it should be:

use generic-host

Re: nagios core 4.4.5 error defining host

Posted: Sun Dec 01, 2019 1:28 pm
by scottwilkerson
playzoneuk wrote:In your recserver.cfg file you've declared:

use generic_host

when it should be:

use generic-host
Thanks @playzoneuk!

Re: nagios core 4.4.5 error defining host

Posted: Wed Dec 04, 2019 4:53 am
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.

Re: nagios core 4.4.5 error defining host

Posted: Wed Dec 04, 2019 8:01 am
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$
}

Re: nagios core 4.4.5 error defining host

Posted: Fri Dec 06, 2019 9:52 am
by Hoygen83
thank you very much.
it's working now.

Re: nagios core 4.4.5 error defining host

Posted: Fri Dec 06, 2019 10:10 am
by scottwilkerson
Hoygen83 wrote:thank you very much.
it's working now.
Great!

Locking thread