Esempio n. 1
0
def test_simple_rbn_notification(test_config, site, core):
    site.set_config("CORE", core, with_restart=True)

    # Open the log file and scan to end
    l = WatchLog(site, "var/log/notify.log")

    # Set object down to trigger a notification
    site.send_host_check_result("notify-test", 1, "FAKE DOWN", expected_state=1)

    # Now check for appearing log lines - one after the other
    l.check_logged("Got raw notification (notify-test)", timeout=20)
    l.check_logged("notifying hh via mail", timeout=20)
    l.check_logged("Creating spoolfile:", timeout=20)
    l.check_logged("(notify-test) for local delivery", timeout=20)
    l.check_logged("Output: Spooled mail to local mail transmission agent", timeout=20)
Esempio n. 2
0
def test_simple_rbn_host_notification(test_config, site, core, log):
    site.set_config("CORE", core, with_restart=True)

    # Open the log file and scan to end
    l = WatchLog(site, log)

    # Set object down to trigger a notification
    site.send_host_check_result("notify-test",
                                1,
                                "FAKE DOWN",
                                expected_state=1)

    # Now check for appearing log lines - one after the other
    # NOTE: "] " is necessary to get the actual log line and not the external command execution
    l.check_logged(
        "] HOST NOTIFICATION: check-mk-notify;notify-test;DOWN;check-mk-notify;FAKE DOWN",
        timeout=20,
    )
    l.check_logged(
        "] HOST NOTIFICATION: hh;notify-test;DOWN;mail;FAKE DOWN",
        timeout=20,
    )
    l.check_logged(
        "] HOST NOTIFICATION RESULT: hh;notify-test;OK;mail;Spooled mail to local mail transmission agent;",
        timeout=20,
    )