(check, metric_name, modifiers, global_options)
return service_check
This submits metrics as service checks.

    The required modifier `status_map` is a mapping of values to statuses. Valid statuses include:

    - `OK`
    - `WARNING`
    - `CRITICAL`
    - `UNKNOWN`

    Any encountered values that are not defined will be sent as `UNKNOWN`.
This submits metrics as service checks.
This submits metrics as service checks .
def get_service_check(check, metric_name, modifiers, global_options):
    """
    This submits metrics as service checks.

    The required modifier `status_map` is a mapping of values to statuses. Valid statuses include:

    - `OK`
    - `WARNING`
    - `CRITICAL`
    - `UNKNOWN`

    Any encountered values that are not defined will be sent as `UNKNOWN`.
    """
    # Do work in a separate function to avoid having to `del` a bunch of variables
    status_map = compile_service_check_statuses(modifiers)

    service_check_method = check.service_check

    def service_check(metric, sample_data, runtime_data):
        static_tags = runtime_data['static_tags']

        for sample, _, hostname in sample_data:
            service_check_method(
                metric_name,
                status_map.get(int(sample.value), ServiceCheck.UNKNOWN),
                tags=static_tags,
                hostname=hostname,
            )

    del check
    del modifiers
    del global_options
    return service_check
def get_service_check ( check , metric_name , modifiers , global_options ) : # Do work in a separate function to avoid having to `del` a bunch of variables status_map = compile_service_check_statuses ( modifiers ) service_check_method = check . service_check def service_check ( metric , sample_data , runtime_data ) : static_tags = runtime_data [ 'static_tags' ] for sample , _ , hostname in sample_data : service_check_method ( metric_name , status_map . get ( int ( sample . value ) , ServiceCheck . UNKNOWN ) , tags = static_tags , hostname = hostname , ) del check del modifiers del global_options return service_check