【问题标题】:Parsing ICINGA status.dat file解析 ICINGA status.dat 文件
【发布时间】: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 之外的任何值,我必须获取服务和主机模板的前两行中存在的主机名和服务名。

谢谢

【问题讨论】:

标签: python linux bash nagios


【解决方案1】:

关于 REST API 问题,请继续创建一个新线程。

要从旧的 Icinga1/Nagios 世界解析 status.dat,您可以查看以下适用于 Nagios 的工具或脚本:

https://pypi.python.org/pypi/NagParser/0.0.19 https://codereview.stackexchange.com/questions/48664/nagios-status-dat-to-dict-could-it-be-better https://gist.github.com/koemu/5553394

How to parse nagios status.dat file?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-20
    • 1970-01-01
    • 2020-11-27
    • 2023-03-25
    • 1970-01-01
    • 2011-12-26
    相关资源
    最近更新 更多