我正在尝试向我的 Nagios Core 服务器添加一个主机,它会以与您在 Nagios XI 上检查相同的方式检查其可用性,因此我创建了我的.cfg
文件,添加了主机信息并尝试检查 .cfg 文件,但每次运行时/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
我都会收到以下错误:
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.
我的webpages.cfg
文件如下所示:
#########################################
# #
# 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
答案1
您的模板generic-host
可能没有包含max_check_attempts
手动设置,因为max_check_attempts
这是必需的属性。