HTTP monitoring on Nagios Core

0

I'm trying to add a host to my Nagios Core server si it checks its availability the same way you check it on Nagios XI, so I create my .cfg file, I add the host info and try to check the .cfg file, but every time I run /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg i get the following error:

Website: https://www.nagios.org
Reading configuration data...
   Read main config file okay...
Error: Invalid max_check_attempts value for host 'myhost.com'
Error: Could not register host (config file '/usr/local/nagios/etc/objects/webpages.cfg', starting on line 7)
   Error processing object config files!


***> One or more problems were 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.

my webpages.cfg file looks like this:

#########################################
#                                       #
#                Hosts                  #
#                                       #
#########################################

define host {
        use             generic-host
        host_name       myhost.com
        alias           myhost
        check_interval  1
        address         xxx.xxx.xxx.xxx
}

#########################################
#                                       #
#               Services                #
#                                       #
#########################################
define service {
            host_name                       myhost.com
            service_description             URL: myhost.com
            check_command                   check_http_url!http://myhost.com
            max_check_attempts              5
            check_interval                  3
            retry_interval                  1
            check_period                    24x7

JoaquínH

Posted 2019-04-10T21:15:19.597

Reputation: 3

Answers

0

Your template generic-host probably don't include max_check_attempts set it manually since max_check_attempts is required atribute.

BTW: You should never restart Nagios without testing the configuration using the -v parameter

Aroly7

Posted 2019-04-10T21:15:19.597

Reputation: 328

Thanks for the advice, it worked just fine – JoaquínH – 2019-04-11T15:19:15.237