【发布时间】:2017-09-09 05:50:03
【问题描述】:
我有一个需要解析的文件,我正在尝试列出 ICINGA2 的停机时间。 ICINGA 的 API 未按预期工作,并且未显示服务和主机文件的停机时间列表的完整列表。
文件名 - status.dat
programstatus {
host_name=demoserver.example.com
check_command=check_hostalive!
icinga_pid=85822
daemon_mode=1
program_start=1504843660
active_host_checks_enabled=1
passive_host_checks_enabled=1
active_service_checks_enabled=1
passive_service_checks_enabled=1
check_service_freshness=1
check_host_freshness=1
enable_notifications=1
enable_event_handlers=1
enable_flap_detection=1
enable_failure_prediction=0
process_performance_data=1
active_scheduled_host_check_stats=1,5,15
passive_host_check_stats=0,0,0
active_scheduled_service_check_stats=12,60,180
passive_service_check_stats=0,0,0
next_downtime_id=18
next_comment_id=4
scheduled_downtime_depth=2
}
如果我们注意到上述文件的最后一行,我必须查找“scheduled_downtime_depth=2”行。如果该值不是 Zero 之外的任何值,我必须获取服务和主机模板的前两行中存在的主机名和服务名。
谢谢
【问题讨论】:
-
那么...您遇到了什么问题?到目前为止,您是如何尝试解决的?
-
不。仍在检查。