为打印机创建新的主机定义后测试 centreon 引擎时出错

为打印机创建新的主机定义后测试 centreon 引擎时出错

我正在测试 CENTREON 作为我所在公司监控日志的主要工具。

我在使用 CENTERON SNMP 和打印机时遇到了问题。

当我测试 centreon 引擎时,我的 centreon 服务器命令行中出现此错误:

处理配置文件时出错:全局配置解析失败:无法打开文件“/etc/centreon-engine/engine.cfg

处理配置文件时发生一个或多个问题。

我的‘centengine.cfg’:

################################################## #################
# #
# GENERATED BY CENTREON #
# #
# Developped by : #
# - Julien Mathis #
# - Romain Le Merlus #
# #
# www.centreon.com #
# For information : [email protected] #
################################################## #################
# #
# Last modification 2018-03-16 15:30 #
# By unknown #
# #
################################################## #################

cfg_file=/etc/centreon-engine/hostTemplates.cfg

cfg_file=/etc/centreon-engine/hosts.cfg

cfg_file=/etc/centreon-engine/serviceTemplates.cfg

cfg_file=/etc/centreon-engine/services.cfg

cfg_file=/etc/centreon-engine/commands.cfg

cfg_file=/etc/centreon-engine/contactgroups.cfg

cfg_file=/etc/centreon-engine/contacts.cfg

cfg_file=/etc/centreon-engine/hostgroups.cfg

cfg_file=/etc/centreon-engine/servicegroups.cfg

cfg_file=/etc/centreon-engine/timeperiods.cfg

cfg_file=/etc/centreon-engine/escalations.cfg

cfg_file=/etc/centreon-engine/dependencies.cfg

cfg_file=/etc/centreon-engine/connectors.cfg

cfg_file=/etc/centreon-engine/meta_commands.cfg

cfg_file=/etc/centreon-engine/meta_timeperiod.cfg

cfg_file=/etc/centreon-engine/meta_host.cfg

cfg_file=/etc/centreon-engine/meta_services.cfg

cfg_file=/etc/centreon-engine/objects/printer.cfg

broker_module=/usr/lib64/centreon-engine/externalcmd.so

broker_module=/usr/lib64/nagios/cbmod.so /etc/centreon-broker/central-module.xml

interval_length=60

resource_file=/etc/centreon-engine/resource.cfg

log_file=/var/log/centreon-engine/centengine.log

status_file=/var/log/centreon-engine/status.dat

use_check_result_path=0

command_check_interval=1s

command_file=/var/lib/centreon-engine/rw/centengine.cmd

state_retention_file=/var/log/centreon-engine/retention.dat

retention_update_interval=60

sleep_time=0.2

service_inter_check_delay_method=s

service_interleave_factor=s

max_concurrent_checks=400

max_service_check_spread=5

check_result_reaper_frequency=5

low_service_flap_threshold=25.0

high_service_flap_threshold=50.0

low_host_flap_threshold=25.0

high_host_flap_threshold=50.0

service_check_timeout=60

host_check_timeout=12

event_handler_timeout=30

notification_timeout=30

ocsp_timeout=5

ochp_timeout=5

perfdata_timeout=5

date_format=euro

illegal_object_name_chars=~!$%^&*"|'<>?,()=
illegal_macro_output_chars=`~$^&"|'<>

admin_email=admin@localhost

admin_pager=admin

event_broker_options=-1

cached_host_check_horizon=60

debug_file=/var/log/centreon-engine/centengine.debug

debug_level=0

debug_verbosity=2

log_pid=1

enable_notifications=1

execute_service_checks=1

accept_passive_service_checks=1

enable_event_handlers=1

check_external_commands=1

use_retained_program_state=1

use_retained_scheduling_info=1

use_syslog=0

log_notifications=1

log_service_retries=1

log_host_retries=1

log_event_handlers=1

log_initial_states=1

log_external_commands=1

use_aggressive_host_checking=1

soft_state_dependencies=0

obsess_over_services=0

process_performance_data=0

check_for_orphaned_services=0

check_for_orphaned_hosts=0

check_service_freshness=1

enable_flap_detection=0


###end###

我的打印机配置在‘printer.cfg’中:

##
## Copyright 1999-2009 Ethan Galstad
## Copyright 2011-2013 Merethis
##
## This file is part of Centreon Engine.
##
## Centreon Engine is free software: you can redistribute it and/or
## modify it under the terms of the GNU General Public License version 2
## as published by the Free Software Foundation.
##
## Centreon Engine is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Centreon Engine. If not, see
## <http://www.gnu.org/licenses/>.
##

# file: printer.cfg
# brief: Sample config file for monitoring a network printer.
#
# notes: This config file assumes that you are using the sample configuration
# files that get installed with the Centreon Engine quickstart guide.


# info: host definitions.
# brief: Define a host for the printer we'll be monitoring
# Change the host_name, alias, and address to fit your situation

define host{

use generic-printer ; Inherit default values from a template.

host_namH HP_laserJet_400 ; The name we're giving to this printer.

alias HP LaserJet 400 MFP M425dw ; A longer name associated with the printer.

address xxx.xxx.xxx.xxx ; IP address of the printer.

hostgroupl allhosts ; Host groups this printer is associated with.

}

# info: Host group definitions.
# brief: A hostgroup for network printers.

define hostgroup{

hostgroup_name acs-net-printers ; The name of the hostgroup.

alias acs net Printers ; Long name of the group.

}

# info: Service definitions.
# brief: Create a service for monitoring the status of the printer Change the
# host_name to match the name of the host you defined above If the
# printer has an SNMP community string other than "public", change the
# check_command directive to reflect that.

define service{

use generic_service ; Inherit values from a template.

host_name HP_laserJet_400 ; The name of the host the service is associated with.

service_description Printer Status ; The service description.

check_command check_hpjd!-C xxx ; The command used to monitor the service.

normal_check_interval 10 ; Check the service every 10 minutes under normal conditions.

retry_check_interval 1 ; Re-check the service every minute until its final/hard state is determined.

}

# Create a service for "pinging" the printer occassionally.
# Useful for monitoring RTA, packet loss, etc.

define service{

use generic_service

host_name HP_laserJet_400

service_description PING

check_command check_ping!3000.0,80%!5000.0,100%

normal_check_interval 10

retry_check_interval 1

}

###end###

注:‘x’是编码的敏感数据。

我正在使用 SNMP 来获取其他服务器的信息,并且它可以工作。

当我在服务器中尝试命令“snmpwalk”时,打印机返回数据。

那么我的配置存在什么问题?

答案1

您给出了一个centengine.cfg丢失的文件似乎是engine.cfg- 如果您将 centengine.cfg 的副本重命名为 engine.cfg(因此其查找的文件存在),则该错误应该可以解决。如果配置文件格式发生变化,您可能需要进行其他更改

OP 在评论中提到手册中指出文件的名称来自手册 - 所以如果发生这种情况,可能值得检查更新的手册。

相关内容