Start monitoring the online status of a user. Returns whether or not the server supports monitoring.
7277
def monitor(self, target):
        
        if 'monitor-notify' in self._capabilities and not self.is_monitoring(target):
            yield from self.rawmsg('MONITOR', '+', target)
            self._monitoring.add(target)
            return True
        else:
            return False
1037170
def is_available(self):
        
        # if the availability flag is raised, return True immediately.
        # NOTE: subsequent API failures will lower this flag. we do this here
        # to ensure we don't keep hitting Joe with requests while availability
        # is there.
        if self.server_available:
            return True

        # otherwise, we have to check with the cloud.
        else:

            try:
                self.server_available = self.jbx.server_online()
                return self.server_available
            except jbxapi.JoeException:
                pass

        self.server_available = False
        return False
71630
def status(self):
        """"""
        try:
            # -- Check client
            res = self.run(['info'])
            if res[0]['clientName'] == '*unknown*':
                return ConnectionStatus.INVALID_CLIENT
            # -- Trigger an auth error if not logged in
            self.run(['user', '-o'])
        except errors.CommandError as err:
            if 'password (P4PASSWD) invalid or unset' in str(err.args[0]):
                return ConnectionStatus.NO_AUTH
            if 'Connect to server failed' in str(err.args[0]):
                return ConnectionStatus.OFFLINE

        return ConnectionStatus.OK
722237
def turn_off
      _check_server!

      fail "Not active!" unless active?

      @detected.available.each do |obj|
        obj.turn_off if obj.respond_to?(:turn_off)
      end

      _env.notify_active = false
    end
1307382
def _monitor_pbc_status(self):
        """"""
        LOG.info('Starting to Monitor PBC status.')
        inspect = celery.current_app.control.inspect()
        workers = inspect.ping()
        start_time = time.time()
        while workers is None:
            time.sleep(0.1)
            elapsed = time.time() - start_time
            if elapsed > 20.0:
                LOG.warning('PBC not found!')
                break
        if workers is not None:
            for worker in workers:
                _tasks = inspect.registered_tasks()[worker]
                LOG.info('Worker: %s tasks:', worker)
                for task_index, task_name in enumerate(_tasks):
                    LOG.info('  %02d : %s', task_index, task_name)

        while True:
            LOG.info('Checking PBC status (%d/%d)', self._num_pbcs,
                     self._max_pbcs)
            celery_app = celery.current_app
            inspect = celery_app.control.inspect()
            workers = inspect.ping()
            if workers is None:
                LOG.warning('PBC service not found!')
            else:
                LOG.info('PBC state:  %s', celery_app.events.State())
                _active = inspect.active()
                _scheduled = inspect.scheduled()
                for worker in workers:
                    LOG.info('  Worker %s: scheduled: %s, active: %s',
                             worker, _active[worker], _scheduled[worker])
            time.sleep(self._report_interval)
929446
def check_health
      begin
        @http_client.check_health
        self.state = :connected
      rescue BalancedHttpClient::NotResponding => e
        ErrorTracker.log(self, "Failed #{@options[:server_name]} health check", e.nested_exception)
        self.state = :disconnected
      rescue StandardError => e
        ErrorTracker.log(self, "Failed #{@options[:server_name]} health check", e, nil, :caller)
        self.state = :disconnected
      end
    end
853344
def is_runnnig(self):
        
        resp = None
        try:
            resp = requests.get("http://%s:%s" %(self._ip, self._port))

            if resp.status_code == 200:
                return True
            else:
                return False
        except:
            return False
344676
def status(host=DEFAULT_HOST, port=DEFAULT_PORT):
    '''
    
    '''
    conn = _connect(host, port)
    try:
        stats = _check_stats(conn)[0]
    except (CommandExecutionError, IndexError):
        return False
    else:
        return {stats[0]: stats[1]}
829589
public function initStatusFromResponse()
    {
        // Setting wrapper status
        if ($this->serverRawResponse->isSuccess()) {
            $this->status = true;
        } else {
            $this->status = false;
        }
    }
870246
private void startActiveMonitoring(final StatusAggregator aggregator) {

    	log.info("Starting application health monitoring in ACTIVE mode");

    	ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {

			@Override
			public Thread newThread(Runnable r) {
				Thread t = new Thread(r,"SocketTransport App Health Monitor");
				t.setDaemon(true);
				return t;
			}
		});

    	executor.scheduleWithFixedDelay(new Runnable() {

			@Override
			public void run() {
                try {
                    boolean healthy = !Status.FAIL.equals(aggregator.getStatus());

                    setStatus(healthy ? Status.OK : Status.FAIL);
                }
                catch (Exception e) {
                    log.warn("Error whilst setting health status",e);
                }
			}
		}, monitorInterval, monitorInterval, TimeUnit.MILLISECONDS);
    }
691293
async def monitor_start(self, monitor):
        '''
        '''
        cfg = self.cfg
        if (not platform.has_multiprocessing_socket or
                cfg.concurrency == 'thread'):
            cfg.set('workers', 0)
        servers = await self.binds(monitor)
        if not servers:
            raise ImproperlyConfigured('Could not open a socket. '
                                       'No address to bind to')
        addresses = []
        for server in servers.values():
            addresses.extend(server.addresses)
        self.cfg.addresses = addresses
273821
def set_status(self, status: Status, increment_try_count: bool=True,
                   filename: str=None):
        '''
        '''
        url = self.url_record.url
        assert not self._try_count_incremented, (url, status)

        if increment_try_count:
            self._try_count_incremented = True

        _logger.debug(__('Marking URL {0} status {1}.', url, status))

        url_result = URLResult()
        url_result.filename = filename

        self.app_session.factory['URLTable'].check_in(
            url,
            status,
            increment_try_count=increment_try_count,
            url_result=url_result,
        )

        self._processed = True
612102
def check_webserver_running(url="http://localhost:8800", max_retries=30):
    

    retry = 0
    response = ''
    success = False

    while response != requests.codes.ok and retry < max_retries:
        try:
            response = requests.head(url, allow_redirects=True).status_code
            success = True
        except:
            sleep(1)

        retry += 1

    if not success:
        logging.warning('Unable to connect to %s within %s retries'
                     % (url, max_retries))
    return success
161081
def ismonitor(self):
        """"""
        if self.cache_mode is not None:
            return self.cache_mode
        try:
            res = (self.mode() == "monitor")
            self.cache_mode = res
            return res
        except Scapy_Exception:
            return False
690210
def is_running(self):
        """"""
        try:
            result = requests.get(self.proxy_url)
        except RequestException:
            return False

        if 'ZAP-Header' in result.headers.get('Access-Control-Allow-Headers', []):
            return True

        raise ZAPError('Another process is listening on {0}'.format(self.proxy_url))
119470
def _get_monitoring_heartbeat(self):
        
        target = self.uri + '/monitoring/heartbeat'
        response = self.session.get(target)
        return response
596650
def _server_enable():
    
    prev = None if "enabled" not in db else db["enabled"]
    if args["disable"]:
        db["enabled"] = False
        okay("Disabled the CI server. No pull requests will be processed.")

    if args["enable"]:
        db["enabled"] = True
        okay("Enabled the CI server. Pull request monitoring online.")

    #Only perform the save if something actually changed.
    if prev != db["enabled"]:
        _save_db()