我正在尝试将主机添加到我的 Nagios Core 服务器 si 它检查其可用性的方式与您在 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
您的模板
generic-host
可能不包括max_check_attempts
手动设置,因为它max_check_attempts
是必需的属性。顺便说一句:你不应该在没有使用 -v 参数测试配置的情况下重启 Nagios