(self, name, nb_procs, bounds, tags)
Report a service check, for each process in search_string.
        Report as OK if the process is in the warning thresholds
                   CRITICAL             out of the critical thresholds
                   WARNING              out of the warning thresholds
Report a service check, for each process in search_string.
        Report as OK if the process is in the warning thresholds
                   CRITICAL             out of the critical thresholds
                   WARNING              out of the warning thresholds
Report a service check for each process in search_string . Report as OK if the process is in the warning thresholds CRITICAL out of the critical thresholds WARNING out of the warning thresholds
def _process_service_check(self, name, nb_procs, bounds, tags):
        """
        Report a service check, for each process in search_string.
        Report as OK if the process is in the warning thresholds
                   CRITICAL             out of the critical thresholds
                   WARNING              out of the warning thresholds
        """
        # FIXME 8.x remove the `process:name` tag
        service_check_tags = tags + ["process:{}".format(name)]
        status = AgentCheck.OK
        status_str = {AgentCheck.OK: "OK", AgentCheck.WARNING: "WARNING", AgentCheck.CRITICAL: "CRITICAL"}

        if not bounds and nb_procs < 1:
            status = AgentCheck.CRITICAL
        elif bounds:
            warning = bounds.get('warning', [1, float('inf')])
            critical = bounds.get('critical', [1, float('inf')])

            if warning[1] < nb_procs or nb_procs < warning[0]:
                status = AgentCheck.WARNING
            if critical[1] < nb_procs or nb_procs < critical[0]:
                status = AgentCheck.CRITICAL

        self.service_check(
            "process.up",
            status,
            tags=service_check_tags,
            message="PROCS {}: {} processes found for {}".format(status_str[status], nb_procs, name)
            if status is not AgentCheck.OK
            else None,
        )
def _process_service_check ( self , name , nb_procs , bounds , tags ) : # FIXME 8.x remove the `process:name` tag service_check_tags = tags + [ "process:{}" . format ( name ) ] status = AgentCheck . OK status_str = { AgentCheck . OK : "OK" , AgentCheck . WARNING : "WARNING" , AgentCheck . CRITICAL : "CRITICAL" } if not bounds and nb_procs < 1 : status = AgentCheck . CRITICAL elif bounds : warning = bounds . get ( 'warning' , [ 1 , float ( 'inf' ) ] ) critical = bounds . get ( 'critical' , [ 1 , float ( 'inf' ) ] ) if warning [ 1 ] < nb_procs or nb_procs < warning [ 0 ] : status = AgentCheck . WARNING if critical [ 1 ] < nb_procs or nb_procs < critical [ 0 ] : status = AgentCheck . CRITICAL self . service_check ( "process.up" , status , tags = service_check_tags , message = "PROCS {}: {} processes found for {}" . format ( status_str [ status ] , nb_procs , name ) if status is not AgentCheck . OK else None , )