Query and parse Apache Web Server Status Page.
178247
def initStats(self):
        """"""
        url = "%s://%s:%d/%s?auto"  % (self._proto, self._host, self._port, 
                                       self._statuspath)
        response = util.get_url(url, self._user, self._password)
        self._statusDict = {}
        for line in response.splitlines():
            mobj = re.match('(\S.*\S)\s*:\s*(\S+)\s*$', line)
            if mobj:
                self._statusDict[mobj.group(1)] = util.parse_value(mobj.group(2))
        if self._statusDict.has_key('Scoreboard'):
            self._statusDict['MaxWorkers'] = len(self._statusDict['Scoreboard'])
263325
def server_status
      candlepin_response = Resources::Candlepin::CandlepinPing.ping
      status = { :managerCapabilities => candlepin_response['managerCapabilities'] + ["combined_reporting"],
                 :result => candlepin_response['result'],
                 :rulesSource => candlepin_response['rulesSource'],
                 :rulesVersion => candlepin_response['rulesVersion'],
                 :standalone => candlepin_response['standalone'],
                 :timeUTC => Time.now.getutc,
                 :version => Katello::VERSION }

      render :json => status
    end
349211
def get_load_status(self):
        
        url, method = self.command_set['daemonstatus'][0], self.command_set['daemonstatus'][1]
        response = http_utils.request(url, method_type=method, return_type=http_utils.RETURN_JSON)
        if response is None:
            logging.warning('%s failure: not found or connection fail' % sys._getframe().f_code.co_name)
            response = DaemonStatus().__dict__
        return response
194040
def get_content(self):
        """"""
        url = self.build_url()
        try:
            self.content_page = requests.get(url)
            if not(self.content_page.status_code == requests.codes.ok):
                self.content_page.raise_for_status()
        except requests.exceptions.RequestException as ex:
            logging.info('A requests exception has ocurred: ' + str(ex))
            logging.error(traceback.format_exc())
            sys.exit(0)
206073
def status(gandi, service):
    """"""

    if not service:
        global_status = gandi.status.status()
        if global_status['status'] == 'FOGGY':
            # something is going on but not affecting services
            filters = {
                'category': 'Incident',
                'current': True,
            }
            events = gandi.status.events(filters)
            for event in events:
                if event['services']:
                    # do not process services
                    continue
                event_url = gandi.status.event_timeline(event)
                service_detail = '%s - %s' % (event['title'], event_url)
                gandi.echo(service_detail)

    # then check other services
    descs = gandi.status.descriptions()
    needed = services = gandi.status.services()
    if service:
        needed = [serv for serv in services
                  if serv['name'].lower() == service.lower()]

    for serv in needed:
        if serv['status'] != 'STORMY':
            output_service(gandi, serv['name'], descs[serv['status']])
            continue

        filters = {
            'category': 'Incident',
            'services': serv['name'],
            'current': True,
        }
        events = gandi.status.events(filters)
        for event in events:
            event_url = gandi.status.event_timeline(event)
            service_detail = '%s - %s' % (event['title'], event_url)
            output_service(gandi, serv['name'], service_detail)

    return services
432645
public int getHTTPStatus() throws InterruptedException, BOSHException {
        if (toThrow != null) {
            throw(toThrow);
        }
        lock.lock();
        try {
            if (!sent) {
                awaitResponse();
            }
        } finally {
            lock.unlock();
        }
        return statusCode;
    }
487785
def fetch_and_parse(url, bodyLines):
    """"""

    pageHtml = fetch_page(url)
    return parse(url, pageHtml, bodyLines)
334971
async def get_status_info(self) -> Tuple[str, str, int]:
        """"""
        return await self.gateway.commands.GetStatusInfo()
333428
protected void handleStatsResetIfNeeded(StatusData<ApacheMetrics> status) {
        StatValue uptime = getStatValue(ApacheMetrics.SERVER_UPTIME);
        Long currUptime = Long.class.cast(status.get(ApacheMetrics.SERVER_UPTIME));
        if (uptime != null && currUptime != null && uptime.getValueAsLong() > currUptime) {
            for (ApacheMetrics metric : getAvailableMetrics()) {
                if (metric.getType() == StatValueTypes.DIFFLONG) {
                    StatValue stat = getStatValue(metric);
                    if (stat != null)
                        stat.reset();
                }
            }
        }
    }
607293
protected function parseStatusCode()
	{
		try
		{
			// Check if a result status is configured.
			if( ! array_key_exists($this->result->getStatus(), $this->getStatus()))
			{
				throw new MisconfiguredStatusException();
			}

			return $this->getStatus()[$this->result->getStatus()];
		}
		catch(MisconfiguredStatusException $e)
		{
			return self::HTTP_INTERNAL_SERVER_ERROR;
		}
		catch(Exception $e)
		{
			return self::HTTP_BAD_REQUEST;
		}
	}
447995
def status(self, status_id, raise_exception_on_failure=False):
        """"""
        query = {"output": "json", "user_credentials": self.api_key}

        resp = requests.get(
            "%sstatus/%s" % (self._url, status_id), params=query, timeout=self._timeout
        )

        if raise_exception_on_failure and resp.status_code != 200:
            raise DocumentStatusFailure(resp.content, resp.status_code)

        if resp.status_code == 200:
            as_json = json.loads(resp.content)
            if as_json["status"] == "completed":
                as_json["download_key"] = _get_download_key(as_json["download_url"])
            return as_json
        return resp
379460
private function parseStatusLine($headers): string {
        if (empty($headers)) {
            return '';
        }

        if (is_string($headers)) {
            if (preg_match_all('`(?:^|\n)(HTTP/[^\r]+)\r\n`', $headers, $matches)) {
                $firstLine = end($matches[1]);
            } else {
                $firstLine = trim(strstr($headers, "\r\n", true));
            }
        } else {
            $firstLine = (string)reset($headers);
        }

        // Test the status line.
        if (strpos($firstLine, 'HTTP/') === 0) {
            return $firstLine;
        }
        return '';
    }
1176090
def response(self, url):
        """"""
        
        resp = requests.get(url).content
        return self.parseresponse(resp)
1340983
function getStatus(url, callback) {
  var client = new HttpClient(url);
  var executor = new Executor(client);
  var command = new Command(CommandName.GET_SERVER_STATUS);
  executor.execute(command, function(err, responseObj) {
    if (err) return callback(err);
    try {
      checkResponse(responseObj);
    } catch (ex) {
      return callback(ex);
    }
    callback(null, responseObj['value']);
  });
}
926758
def table_server_status():
    """"""
    table_data = [
        [Color('Low Space'), Color('{autocyan}Nominal Space{/autocyan}'), Color('Excessive Space')],
        [Color('Low Load'), Color('Nominal Load'), Color('{autored}High Load{/autored}')],
        [Color('{autocyan}Low Free RAM{/autocyan}'), Color('Nominal Free RAM'), Color('High Free RAM')],
    ]
    table_instance = SingleTable(table_data, '192.168.0.105')
    table_instance.inner_heading_row_border = False
    table_instance.inner_row_border = True
    table_instance.justify_columns = {0: 'center', 1: 'center', 2: 'center'}
    return table_instance.table
35933
public static function getStatusInformations()
    {
        $html = null;

        try {
            //====================================================================//
            // Output Server Informations
            $html .= Splash::log()->getHtmlListItem("Server Informations");
            $html .= "<PRE>".print_r(Splash::ws()->getServerInfos()->getArrayCopy(), true)."</PRE>";

            //====================================================================//
            // Verify PHP Version
            Splash::validate()->isValidPHPVersion();
            //====================================================================//
            // Verify PHP Extensions
            Splash::validate()->isValidPHPExtensions();
            //====================================================================//
            // Verify SOAP Method
            Splash::validate()->isValidSOAPMethod();
            //====================================================================//
            // Execute Splash Local SelfTest
            Splash::selfTest();
            //====================================================================//
            //  Verify Server Webservice Connection
            Splash::ws()->selfTest();
        } catch (\Exception $ex) {
            echo $ex->getMessage();
            $html .= Splash::log()->getHtmlLogList(true);
            echo $html;

            return null;
        }

        $html .= Splash::log()->getHtmlLogList(true);

        return $html;
    }
332467
function(status) {

      // Page is now opened
      pageInformation.isOpened = true;
      pageInformation.status = status;

      // Failing
      if (status !== 'success') {
        parent.replyTo(callId, wrapFailure('fail'));
        return cleanup();
      }

      // Wrong status code
      if (!pageInformation.response.status || pageInformation.response.status >= 400) {
        parent.replyTo(callId, wrapFailure('status'));
        return cleanup();
      }

      // Waiting for body to load
      page.evaluateAsync(function() {
        var interval = setInterval(function() {
          if (document.readyState === 'complete' || document.readyState === 'interactive') {
            clearInterval(interval);
            window.callPhantom({
              head: 'documentReady',
              body: true,
              passphrase: 'detoo'
            });
          }
        }, 30);
      });
    }