Beispiel #1
0
def execute(params):
    """Execute a service discovery on a host"""
    host = watolib.Host.host(params["host_name"])
    discovery_request = StartDiscoveryRequest(host=host,
                                              folder=host.folder(),
                                              options=DiscoveryOptions(
                                                  action=DISCOVERY_ACTION[params["discover_mode"]],
                                                  show_checkboxes=False,
                                                  show_parameters=False,
                                                  show_discovered_labels=False,
                                                  show_plugin_names=False,
                                                  ignore_errors=True))
    _discovery_result = get_check_table(discovery_request)
    return Response(status=204)
Beispiel #2
0
def show_services(params):
    """Show all services of specific state"""
    host = watolib.Host.host(params["host_name"])
    discovery_request = StartDiscoveryRequest(
        host=host,
        folder=host.folder(),
        options=DiscoveryOptions(action='',
                                 show_checkboxes=False,
                                 show_parameters=False,
                                 show_discovered_labels=False,
                                 show_plugin_names=False,
                                 ignore_errors=True),
    )
    discovery_result = get_check_table(discovery_request)
    return _serve_services(host, discovery_result.check_table, params["discovery_state"])
Beispiel #3
0
def show_services(params) -> Response:
    """Show all services of specific phase"""
    host = Host.load_host(params["host_name"])
    discovery_request = StartDiscoveryRequest(
        host=host,
        folder=host.folder(),
        options=DiscoveryOptions(
            action="",
            show_checkboxes=False,
            show_parameters=False,
            show_discovered_labels=False,
            show_plugin_names=False,
            ignore_errors=True,
        ),
    )
    discovery_result = get_check_table(discovery_request)
    return _serve_services(
        host,
        discovery_result.check_table,
        [params["discovery_phase"]],
    )
Beispiel #4
0
def execute(params):
    """Execute a service discovery on a host"""
    host = watolib.Host.host(params["host_name"])
    body = params['body']
    discovery_request = StartDiscoveryRequest(
        host=host,
        folder=host.folder(),
        options=DiscoveryOptions(
            action=DISCOVERY_ACTION[body["mode"]],
            show_checkboxes=False,
            show_parameters=False,
            show_discovered_labels=False,
            show_plugin_names=False,
            ignore_errors=True,
        ),
    )
    discovery_result = get_check_table(discovery_request)
    return _serve_services(
        host,
        discovery_result.check_table,
        list(SERVICE_DISCOVERY_PHASES.keys()),
    )